GNOME Bugzilla – Bug 789415
vtenc: vtenc_h264 causing too many Redistribute latency...
Last modified: 2018-11-03 14:14:54 UTC
I'm having some trouble with the pipeline: gst-launch-1.0 --gst-debug=*:2,vtenc:4 videotestsrc ! videorate ! video/x-raw, format=UYVY, width=1920, height=1080, framerate=30/1 ! queue ! vtenc_h264 ! fakesink I’m running gstreamer version 1.12.3 built from git source, on a 2017 15” Macbook Pro, w/macOS 10.12.6. The relevant output: Setting pipeline to PLAYING ... New clock: GstSystemClock 0:00:00.154950000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 5 fps 30/1 time 0:00:00.166666665 Redistribute latency... 0:00:00.235169000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 6 fps 30/1 time 0:00:00.199999998 Redistribute latency... 0:00:00.241439000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 5 fps 30/1 time 0:00:00.166666665 Redistribute latency... 0:00:00.253913000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 6 fps 30/1 time 0:00:00.199999998 Redistribute latency... 0:00:00.278467000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 7 fps 30/1 time 0:00:00.233333331 Redistribute latency... 0:00:00.288046000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 6 fps 30/1 time 0:00:00.199999998 Redistribute latency... 0:00:00.371569000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 7 fps 30/1 time 0:00:00.233333331 Redistribute latency... 0:00:03.043466000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 6 fps 30/1 time 0:00:00.199999998 Redistribute latency... 0:00:03.065692000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 5 fps 30/1 time 0:00:00.166666665 Redistribute latency... 0:00:03.090887000 72088 0x7ff6d7010370 INFO vtenc vtenc.c:1070:gst_vtenc_update_latency:<vtenc_h264-0> latency status 0 frames 4 fps 30/1 time 0:00:00.133333332 Redistribute latency... The vtenc_h264 element is calling gst_video_encoder_set_latency() seemingly way too often. It results in gst-launch printing "Redistribute latency..." quite often (several times per second sometimes). What's happening seems to be the element keeping track of the underlying encoder's pending frame count. If the pending frame count ever changes (checked every frame), then it calls gst_video_encoder_set_latency(). Is it not the case that instead of tracking exact latency each frame and forcing a pipeline latency redistribution every time it changes at all, the element should just check if the latency is greater than the currently configured range (checked via call to gst_video_encoder_get_latency()) and only call gst_video_encoder_set_latency() if it's outside the range? I will attach a patch that works for me shortly.
Created attachment 362199 [details] [review] proposed patch
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/626.