mavlink / mavlink-camera-manager

MAVLink Camera Manager Service
MIT License
103 stars 30 forks source link

src: logger: Fix gstreamer log integration #400

Closed joaoantoniocardoso closed 5 months ago

joaoantoniocardoso commented 5 months ago

This formatting follows the original default GStreamer format, and has little overhead. Example of output:

2024-05-30T21:35:37.556164Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PIPELINE ../gstreamer/subprojects/gstreamer/gst/gstparse.c:344:gst_parse_launch_full parsing pipeline description 'rtspsrc location=rtsp://127.0.0.1:8554/test is-live=true latency=0 ! application/x-rtp ! tee name=RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8 allow-not-linked=true'
2024-05-30T21:35:37.556565Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PLUGIN_LOADING ../gstreamer/subprojects/gstreamer/gst/gstplugin.c:995:_priv_gst_plugin_load_file_for_registry plugin "/usr/lib/gstreamer-1.0/libgstrtsp.so" loaded
2024-05-30T21:35:37.557034Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_FACTORY ../gstreamer/subprojects/gstreamer/gst/gstelementfactory.c:489:gst_element_factory_create_with_properties creating element "rtspsrc"
2024-05-30T21:35:37.557368Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PLUGIN_LOADING ../gstreamer/subprojects/gstreamer/gst/gstplugin.c:995:_priv_gst_plugin_load_file_for_registry plugin "/usr/lib/gstreamer-1.0/libgstasf.so" loaded
2024-05-30T21:35:37.557392Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_FACTORY ../gstreamer/subprojects/gstreamer/gst/gstelementfactory.c:489:gst_element_factory_create_with_properties creating element "rtspwms"
2024-05-30T21:35:37.557733Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PLUGIN_LOADING ../gstreamer/subprojects/gstreamer/gst/gstplugin.c:995:_priv_gst_plugin_load_file_for_registry plugin "/usr/lib/gstreamer-1.0/libgstcoreelements.so" loaded
2024-05-30T21:35:37.557786Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_FACTORY ../gstreamer/subprojects/gstreamer/gst/gstelementfactory.c:489:gst_element_factory_create_with_properties creating element "tee"
2024-05-30T21:35:37.557826Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstelement.c:758:gst_element_add_pad:<<null>> adding pad 'sink'
2024-05-30T21:35:37.557861Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_FACTORY ../gstreamer/subprojects/gstreamer/gst/gstelementfactory.c:489:gst_element_factory_create_with_properties creating element "pipeline"
2024-05-30T21:35:37.557936Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PIPELINE subprojects/gstreamer/gst/parse/grammar.y:1058:gst_parse_perform_link linking some pad of GstRTSPSrc named rtspsrc0 to some pad of GstTee named RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8 (0/0) with caps "application/x-rtp"
2024-05-30T21:35:37.557973Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_FACTORY ../gstreamer/subprojects/gstreamer/gst/gstelementfactory.c:489:gst_element_factory_create_with_properties creating element "capsfilter"
2024-05-30T21:35:37.558029Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstelement.c:758:gst_element_add_pad:<<null>> adding pad 'sink'
2024-05-30T21:35:37.558058Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstelement.c:758:gst_element_add_pad:<<null>> adding pad 'src'
2024-05-30T21:35:37.558088Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_STATES ../gstreamer/subprojects/gstreamer/gst/gstbin.c:2070:gst_bin_get_state_func:<pipeline0> getting state
2024-05-30T21:35:37.558122Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_STATES ../gstreamer/subprojects/gstreamer/gst/gstelement.c:2824:gst_element_continue_state:<capsfilter0> completed state change to NULL
2024-05-30T21:35:37.558149Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_EVENT ../gstreamer/subprojects/gstreamer/gst/gstevent.c:1687:gst_event_new_reconfigure creating reconfigure event
2024-05-30T21:35:37.558179Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstutils.c:1818:gst_element_link_pads_full trying to link element rtspsrc0:(any) to element capsfilter0:sink
2024-05-30T21:35:37.558206Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstelement.c:1016:gst_element_get_static_pad found pad capsfilter0:sink
2024-05-30T21:35:37.558241Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PADS ../gstreamer/subprojects/gstreamer/gst/gstpad.c:4398:gst_pad_peer_query:<capsfilter0:src> pad has no peer
2024-05-30T21:35:37.558279Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstelement.c:1013:gst_element_get_static_pad no such pad 'stream_%u' in element "rtspsrc0"
2024-05-30T21:35:37.558311Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstutils.c:1270:gst_element_get_compatible_pad:<rtspsrc0> Could not find a compatible pad to link to capsfilter0:sink
2024-05-30T21:35:37.558336Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstutils.c:1818:gst_element_link_pads_full trying to link element capsfilter0:src to element RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8:(any)
2024-05-30T21:35:37.558359Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstelement.c:1016:gst_element_get_static_pad found pad capsfilter0:src
2024-05-30T21:35:37.558388Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PADS ../gstreamer/subprojects/gstreamer/gst/gstutils.c:1080:gst_pad_check_link trying to link capsfilter0:src and RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8:sink
2024-05-30T21:35:37.558416Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PADS ../gstreamer/subprojects/gstreamer/gst/gstpad.c:4398:gst_pad_peer_query:<capsfilter0:sink> pad has no peer
2024-05-30T21:35:37.558449Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PADS ../gstreamer/subprojects/gstreamer/gst/gstutils.c:1634:prepare_link_maybe_ghosting capsfilter0 and RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8 in same bin, no need for ghost pads
2024-05-30T21:35:37.558488Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PADS ../gstreamer/subprojects/gstreamer/gst/gstpad.c:2440:gst_pad_link_prepare trying to link capsfilter0:src and RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8:sink
2024-05-30T21:35:37.558515Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PADS ../gstreamer/subprojects/gstreamer/gst/gstpad.c:4398:gst_pad_peer_query:<capsfilter0:sink> pad has no peer
2024-05-30T21:35:37.558544Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PADS ../gstreamer/subprojects/gstreamer/gst/gstpad.c:2621:gst_pad_link_full linked capsfilter0:src and RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8:sink, successful
2024-05-30T21:35:37.558569Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_EVENT ../gstreamer/subprojects/gstreamer/gst/gstevent.c:1687:gst_event_new_reconfigure creating reconfigure event
2024-05-30T21:35:37.558601Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_EVENT ../gstreamer/subprojects/gstreamer/gst/gstpad.c:6017:gst_pad_send_event_unchecked:<capsfilter0:src> Received event on flushing pad. Discarding
2024-05-30T21:35:37.558636Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: default ../gstreamer/subprojects/gstreamer/gst/gstutils.c:2193:gst_element_link_pads_filtered Could not link pads: rtspsrc0:(null) - capsfilter:sink
2024-05-30T21:35:37.558667Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_STATES ../gstreamer/subprojects/gstreamer/gst/gstelement.c:2824:gst_element_continue_state:<capsfilter0> completed state change to NULL
2024-05-30T21:35:37.558700Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstpad.c:2145:gst_pad_unlink unlinking capsfilter0:src(0x58f35087a8d0) and RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8:sink(0x58f350877ee0)
2024-05-30T21:35:37.558731Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstpad.c:2200:gst_pad_unlink unlinked capsfilter0:src and RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8:sink
2024-05-30T21:35:37.558764Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PARENTAGE ../gstreamer/subprojects/gstreamer/gst/gstbin.c:1805:gst_bin_remove_func:<pipeline0> removed child "capsfilter0"
2024-05-30T21:35:37.558800Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_REFCOUNTING ../gstreamer/subprojects/gstreamer/gst/gstelement.c:3400:gst_element_dispose:<capsfilter0> 0x58f35087a320 dispose
2024-05-30T21:35:37.558831Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstelement.c:875:gst_element_remove_pad:<capsfilter0> removing pad 'sink'
2024-05-30T21:35:37.558878Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_ELEMENT_PADS ../gstreamer/subprojects/gstreamer/gst/gstelement.c:875:gst_element_remove_pad:<capsfilter0> removing pad 'src'
2024-05-30T21:35:37.558915Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_REFCOUNTING ../gstreamer/subprojects/gstreamer/gst/gstelement.c:3446:gst_element_dispose:<capsfilter0> 0x58f35087a320 parent class dispose
2024-05-30T21:35:37.558948Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_REFCOUNTING ../gstreamer/subprojects/gstreamer/gst/gstelement.c:3478:gst_element_finalize:<capsfilter0> 0x58f35087a320 finalize
2024-05-30T21:35:37.558980Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_REFCOUNTING ../gstreamer/subprojects/gstreamer/gst/gstelement.c:3483:gst_element_finalize:<capsfilter0> 0x58f35087a320 finalize parent
2024-05-30T21:35:37.559081Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PARENTAGE ../gstreamer/subprojects/gstreamer/gst/gstbin.c:4395:gst_bin_get_by_name [pipeline0]: looking up child element VideoTee-ecf8c718-760c-4f78-adbf-78478d7a02f8
2024-05-30T21:35:37.559132Z  INFO                 main ThreadId(01) src/logger/manager.rs:110: GST_PARENTAGE ../gstreamer/subprojects/gstreamer/gst/gstbin.c:4395:gst_bin_get_by_name [pipeline0]: looking up child element RTPTee-ecf8c718-760c-4f78-adbf-78478d7a02f8
2024-05-30T21:35:37.559208Z DEBUG                 main ThreadId(01) start_default:add_stream_and_start{video_and_stream_information=VideoAndStreamInformation { name: "Redirect - Redirect source", stream_information: StreamInformation { endpoints: [Url { scheme: "rtsp", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("127.0.0.1")), port: Some(8554), path: "/test", query: None, fragment: None }], configuration: Redirect(RedirectCaptureConfiguration), extended_configuration: Some(ExtendedConfiguration { thermal: false, disable_mavlink: true }) }, video_source: Redirect(VideoSourceRedirect { name: "Redirect source", source: Redirect("Redirect") }) }}:try_new{video_and_stream_information=VideoAndStreamInformation { name: "Redirect - Redirect source", stream_information: StreamInformation { endpoints: [Url { scheme: "rtsp", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("127.0.0.1")), port: Some(8554), path: "/test", query: None, fragment: None }], configuration: Redirect(RedirectCaptureConfiguration), extended_configuration: Some(ExtendedConfiguration { thermal: false, disable_mavlink: true }) }, video_source: Redirect(VideoSourceRedirect { name: "Redirect source", source: Redirect("Redirect") }) }}:try_new{video_and_stream_information=VideoAndStreamInformation { name: "Redirect - Redirect source", stream_information: StreamInformation { endpoints: [Url { scheme: "rtsp", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("127.0.0.1")), port: Some(8554), path: "/test", query: None, fragment: None }], configuration: Redirect(RedirectCaptureConfiguration), extended_configuration: Some(ExtendedConfiguration { thermal: false, disable_mavlink: true }) }, video_source: Redirect(VideoSourceRedirect { name: "Redirect source", source: Redirect("Redirect") }) } pipeline_id=ecf8c718-760c-4f78-adbf-78478d7a02f8}:try_new{video_and_stream_information=VideoAndStreamInformation { name: "Redirect - Redirect source", stream_information: StreamInformation { endpoints: [Url { scheme: "rtsp", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("127.0.0.1")), port: Some(8554), path: "/test", query: None, fragment: None }], configuration: Redirect(RedirectCaptureConfiguration), extended_configuration: Some(ExtendedConfiguration { thermal: false, disable_mavlink: true }) }, video_source: Redirect(VideoSourceRedirect { name: "Redirect source", source: Redirect("Redirect") }) } pipeline_id=ecf8c718-760c-4f78-adbf-78478d7a02f8}:try_new{video_and_stream_information=VideoAndStreamInformation { name: "Redirect - Redirect source", stream_information: StreamInformation { endpoints: [Url { scheme: "rtsp", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("127.0.0.1")), port: Some(8554), path: "/test", query: None, fragment: None }], configuration: Redirect(RedirectCaptureConfiguration), extended_configuration: Some(ExtendedConfiguration { thermal: false, disable_mavlink: true }) }, video_source: Redirect(VideoSourceRedirect { name: "Redirect source", source: Redirect("Redirect") }) } pipeline_id=ecf8c718-760c-4f78-adbf-78478d7a02f8}:try_new{pipeline_id=ecf8c718-760c-4f78-adbf-78478d7a02f8 allow_block=false}: src/stream/pipeline/runner.rs:47: Starting PipelineRunner task...
2024-05-30T21:35:37.559378Z DEBUG tokio-runtime-worker ThreadId(10) src/stream/pipeline/runner.rs:52: PipelineRunner task started!
joaoantoniocardoso commented 5 months ago

@patrickelectric rebased, ready for review :)