Commit 3ca45b8c authored by Nicolas Dufresne's avatar Nicolas Dufresne Committed by Edward Hervey

viddec: Set latency base on the number of bframes

parent 1f74496b
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment