From c1ef273021c389b76c6bccb353113be7000bdcdb Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 29 Aug 2019 12:18:05 -0400 Subject: [PATCH] mss: Rework the pipeline to reduce CPU usage This adds tsparse and tsdemux sharing and globally reconfigure the pipeline so it better performs. --- src/main.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main.c b/src/main.c index dbb4c4d..0f93681 100644 --- a/src/main.c +++ b/src/main.c @@ -346,16 +346,19 @@ int main (int argc, char *argv[]) http_server = mss_http_server_new (); - "queue ! tsdemux latency=50 ! decodebin ! videoconvert ! autovideosink " - "t. ! queue leaky=downstream max-size-buffers=400 ! tsdemux ! h264parse ! video/x-h264, stream-format=avc ! h264parse ! mpegtsmux ! hlssink location=%s/segment%%05d.ts playlist-location=%s/playlist.m3u8 target-duration=1 playlist-length=3 " - pipeline_str = g_strdup_printf ("srtsrc uri=%s?mode=listener name=src latency=50 ! tsparse name=tsparse ! tee name=t ! " - "t. ! queue leaky=downstream max-size-buffers=10 ! rtpmp2tpay ! ristsink bonding-addresses=%s " - "t. ! queue leaky=downstream max-size-buffers=10 ! tsdemux ! rtph264pay config-interval=1 ! application/x-rtp,payload=96 ! tee name=webrtctee allow-not-linked=true " - "t. ! queue leaky=downstream max-size-buffers=10 ! srtsink uri=srt://:7002?mode=listener", + pipeline_str = g_strdup_printf ( + "srtsrc uri=%s?mode=listener name=src latency=50 ! queue name=srtqueue ! tsparse smoothing-latency=50000 set-timestamps=1 ! tee name=t " + "t. ! queue ! rtpmp2tpay ! ristsink bonding-addresses=%s async=0 " + "t. ! queue leaky=downstream ! srtsink uri=srt://:7002?mode=listener async=0 " + "t. ! queue ! tsdemux latency=50 ! tee name=h264_t " + "h264_t. ! queue ! decodebin ! videoconvert ! autovideosink async=0 " + "h264_t. ! queue ! h264parse ! video/x-h264, alignment=au ! mpegtsmux ! " + "hlssink location=%s/segment%%05d.ts playlist-location=%s/playlist.m3u8 target-duration=1 playlist-length=3 async=0 " + "h264_t. ! queue ! h264parse ! rtph264pay config-interval=1 ! application/x-rtp,payload=96 ! tee name=webrtctee allow-not-linked=true ", srt_uri, + rist_addresses, mss_http_server_get_hls_dir (http_server), - mss_http_server_get_hls_dir (http_server), - rist_addresses); + mss_http_server_get_hls_dir (http_server)); gst_init (&argc, &argv); pipeline = gst_parse_launch (pipeline_str, &error); -- GitLab