GNOME Bugzilla – Bug 735859
videomixer: Dynamically changing the FPS leads to an incorrect buffer time
Last modified: 2014-09-04 09:56:05 UTC
Created attachment 285111 [details] fix, line 407 When changing the FPS, update mix->ts_offset in gst_videomixer2_update_converters()
Please attach the fix as a patch in "git format-patch" format, and also provide some more information about what breaks and ideally also a testcase to show the problem.
Created attachment 285114 [details] [review] fix
In the dynamic change in the branch of pipeline (for example, when playing a sequential series of videos with different fps) during the transition to the next file can be observed freezing or skipping. Sorry for the google translate
gst_videomixer2_collected(...) ... output_end_time = mix->ts_offset + gst_util_uint64_scale_round (mix->nframes + 1, GST_SECOND * GST_VIDEO_INFO_FPS_D (&mix->info), GST_VIDEO_INFO_FPS_N (&mix->info)) + mix->segment.start; ... Example: 99 frames with 50fps buffer(99)->pts = 00:01.98 buffer(99)->duration = 00:00.02 output_end_time = 0 + (100 * 1 / 50) = 2 * GST_SECOND; caps negotiation 100th frame with 25fps buffer(100)->pts = 00:02.00 buffer(100)->duration = 00:00.04 output_end_time = 0 + (101 * 1 / 25) = 4 * GST_SECOND; !!! log (transition form framerate=(fraction)5000/167 to framerate=(fraction)25/1): 0:00:30.248874047 videomixer2.c:422:gst_videomixer2_update_converters:<mixer> The output format will now be : 12 with colorimetry : 1:1:0:0 and chroma : (null) 0:00:30.249005301 videomixer2.c:461:gst_videomixer2_update_converters:<mixer:sink_0> This pad will not need conversion 0:00:30.249024772 videomixer2.c:461:gst_videomixer2_update_converters:<mixer:sink_1> This pad will not need conversion 0:00:30.249469775 videomixer2.c:1662:gst_videomixer2_src_setcaps:<mixer:src> set src caps: video/x-raw, format=(string)BGRA, width=(int)400, height=(int)336, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)1:1:0:0, framerate=(fraction)25/1 [* note] 0:00:30.262908570 videomixer2.c:878:gst_videomixer2_fill_queues:<mixer> output_start_time 0:00:30.026600000, output_end_time 0:00:36.000000000 0:00:30.263004319 videomixer2.c:986:gst_videomixer2_fill_queues:<mixer:sink_0> Taking new buffer with start time 0:00:30.030000000 0:00:30.263081632 videomixer2.c:986:gst_videomixer2_fill_queues:<mixer:sink_1> Taking new buffer with start time 0:00:30.040000000 [** note] 0:00:30.275772139 videomixer2.c:878:gst_videomixer2_fill_queues:<mixer> output_start_time 0:00:36.000000000, output_end_time 0:00:36.040000000 0:00:30.275855789 videomixer2.c:1007:gst_videomixer2_fill_queues:<mixer:sink_0> Too old buffer -- dropping 0:00:30.275875036 videomixer2.c:1007:gst_videomixer2_fill_queues:<mixer:sink_1> Too old buffer -- dropping ... Too old buffer -- dropping
commit 558f9a2a6fa066ba597838a6793aa639cfd91e49 Author: Andrei Sarakeev <sarakusha@gmail.com> Date: Tue Sep 2 11:13:44 2014 +0400 videomixer: Fix synchronization if dynamically changing the FPS https://bugzilla.gnome.org/show_bug.cgi?id=735859