mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
videorate: Do not loop forever pushing first buffer when variable framerate
In the case the framerate is variable (represented by framerate=0/1), we currently end up loop pushing the first buffer and then recompute diff1 and diff2 without updating the videorate->next_ts at all leading to infinitely looping pushing that first buffer. In the case of variable framerate, we should just compute the next_ts as previous_pts + previous_duration. https://bugzilla.gnome.org/show_bug.cgi?id=734424
This commit is contained in:
parent
0ac3ad0abb
commit
1cda538e00
1 changed files with 8 additions and 0 deletions
|
@ -615,6 +615,8 @@ gst_video_rate_flush_prev (GstVideoRate * videorate, gboolean duplicate)
|
||||||
videorate->to_rate_denominator * GST_SECOND,
|
videorate->to_rate_denominator * GST_SECOND,
|
||||||
videorate->to_rate_numerator);
|
videorate->to_rate_numerator);
|
||||||
GST_BUFFER_DURATION (outbuf) = videorate->next_ts - push_ts;
|
GST_BUFFER_DURATION (outbuf) = videorate->next_ts - push_ts;
|
||||||
|
} else if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (outbuf))) {
|
||||||
|
videorate->next_ts = GST_BUFFER_PTS (outbuf) + GST_BUFFER_DURATION (outbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We do not need to update time in VFR (variable frame rate) mode */
|
/* We do not need to update time in VFR (variable frame rate) mode */
|
||||||
|
@ -1126,6 +1128,12 @@ gst_video_rate_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
|
||||||
GST_TIME_ARGS (diff1), GST_TIME_ARGS (diff2),
|
GST_TIME_ARGS (diff1), GST_TIME_ARGS (diff2),
|
||||||
GST_TIME_ARGS (videorate->next_ts));
|
GST_TIME_ARGS (videorate->next_ts));
|
||||||
|
|
||||||
|
if (!GST_BUFFER_DURATION_IS_VALID (videorate->prevbuf) &&
|
||||||
|
intime > prevtime) {
|
||||||
|
/* Make sure that we have a duration for previous buffer */
|
||||||
|
GST_BUFFER_DURATION (videorate->prevbuf) = intime - prevtime;
|
||||||
|
}
|
||||||
|
|
||||||
/* output first one when its the best */
|
/* output first one when its the best */
|
||||||
if (diff1 <= diff2) {
|
if (diff1 <= diff2) {
|
||||||
GstFlowReturn r;
|
GstFlowReturn r;
|
||||||
|
|
Loading…
Reference in a new issue