mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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:
parent
cc9d778844
commit
920bfb0da2
1 changed files with 1 additions and 18 deletions
|
@ -1380,14 +1380,7 @@ gst_ffmpegdec_do_qos (GstFFMpegDec * ffmpegdec, GstClockTime timestamp,
|
||||||
if (proportion < 0.4 && diff < 0) {
|
if (proportion < 0.4 && diff < 0) {
|
||||||
goto normal_mode;
|
goto normal_mode;
|
||||||
} else {
|
} else {
|
||||||
/* if we're more than two seconds late, switch to the next keyframe */
|
if (diff >= 0) {
|
||||||
/* 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) {
|
|
||||||
/* we're too slow, try to speed up */
|
/* we're too slow, try to speed up */
|
||||||
if (ffmpegdec->waiting_for_key) {
|
if (ffmpegdec->waiting_for_key) {
|
||||||
/* we were waiting for a keyframe, that's ok */
|
/* we were waiting for a keyframe, that's ok */
|
||||||
|
@ -1414,16 +1407,6 @@ normal_mode:
|
||||||
}
|
}
|
||||||
return TRUE;
|
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:
|
skip_frame:
|
||||||
{
|
{
|
||||||
if (ffmpegdec->context->skip_frame != AVDISCARD_NONREF) {
|
if (ffmpegdec->context->skip_frame != AVDISCARD_NONREF) {
|
||||||
|
|
Loading…
Reference in a new issue