viddec: Set latency base on the number of bframes

This commit is contained in:
Nicolas Dufresne 2012-09-13 09:36:14 -04:00 committed by Edward Hervey
parent 1f74496b8a
commit 3ca45b8c45

View file

@ -403,6 +403,7 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
{
GstFFMpegVidDec *ffmpegdec;
GstFFMpegVidDecClass *oclass;
GstClockTime latency = GST_CLOCK_TIME_NONE;
gboolean ret = FALSE;
ffmpegdec = (GstFFMpegVidDec *) decoder;
@ -489,11 +490,20 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
gst_video_codec_state_unref (ffmpegdec->input_state);
ffmpegdec->input_state = gst_video_codec_state_ref (state);
if (ffmpegdec->input_state->info.fps_n) {
GstVideoInfo *info = &ffmpegdec->input_state->info;
latency = gst_util_uint64_scale_ceil (
(ffmpegdec->context->has_b_frames) * GST_SECOND, info->fps_d,
info->fps_n);
}
ret = TRUE;
done:
GST_OBJECT_UNLOCK (ffmpegdec);
gst_video_decoder_set_latency (decoder, latency, latency);
return ret;
/* ERRORS */