ffdec: do not try to resync to the next keyframe when late

A keyframe may be quite a while in the future, and the decoder
has no way of knowing this. A poor decision could mean quite some
time with no video output.
This decision should be left to the upstream element: a demuxer
might know about incoming keyframes, or some other element might
be able to request a keyframe.

Fixes bug #649372.
This commit is contained in:
Vincent Penquerc'h 2011-05-04 17:33:03 +03:00 committed by Sebastian Dröge
parent cc9d778844
commit 920bfb0da2

View file

@ -1380,14 +1380,7 @@ gst_ffmpegdec_do_qos (GstFFMpegDec * ffmpegdec, GstClockTime timestamp,
if (proportion < 0.4 && diff < 0) {
goto normal_mode;
} else {
/* if we're more than two seconds late, switch to the next keyframe */
/* FIXME, let the demuxer decide what's the best since we might be dropping
* a lot of frames when the keyframe is far away or we even might not get a new
* keyframe at all.. */
if (diff > ((GstClockTimeDiff) GST_SECOND * 2)
&& !ffmpegdec->waiting_for_key) {
goto skip_to_keyframe;
} else if (diff >= 0) {
if (diff >= 0) {
/* we're too slow, try to speed up */
if (ffmpegdec->waiting_for_key) {
/* we were waiting for a keyframe, that's ok */
@ -1414,16 +1407,6 @@ normal_mode:
}
return TRUE;
}
skip_to_keyframe:
{
ffmpegdec->context->skip_frame = AVDISCARD_NONKEY;
ffmpegdec->waiting_for_key = TRUE;
*mode_switch = TRUE;
GST_DEBUG_OBJECT (ffmpegdec,
"QOS: keyframe, %" G_GINT64_FORMAT " > GST_SECOND/2", diff);
/* we can skip the current frame */
return FALSE;
}
skip_frame:
{
if (ffmpegdec->context->skip_frame != AVDISCARD_NONREF) {