avviddec: drain frames until libav doesn't have more data

We use have_data (that comes from libav), instead of only trying 10 times,
to know if there are more frames available. The old code was machine
dependant as different amount of frames could be decoded by different
type of (more powerful) machines, and 10 times was not always sufficient.

https://bugzilla.gnome.org/show_bug.cgi?id=736515
This commit is contained in:
IBM Thinklab 2014-09-11 19:37:33 -04:00 committed by Sebastian Dröge
parent f9db6274c2
commit 25ab0036c0

View file

@ -1438,7 +1438,7 @@ gst_ffmpegviddec_drain (GstFFMpegVidDec * ffmpegdec)
oclass = (GstFFMpegVidDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
gint have_data, len, try = 0;
gint have_data, len;
GST_LOG_OBJECT (ffmpegdec,
"codec has delay capabilities, calling until ffmpeg has drained everything");
@ -1448,9 +1448,7 @@ gst_ffmpegviddec_drain (GstFFMpegVidDec * ffmpegdec)
len = gst_ffmpegviddec_frame (ffmpegdec, NULL, 0, &have_data, NULL, &ret);
if (len < 0 || have_data == 0)
break;
} while (try++ < 10);
} while (len >= 0 && have_data == 1);
avcodec_flush_buffers (ffmpegdec->context);
}
}