Several decoders will only be able to report a real latency (has_b_frames)
once they're actually initialized (i.e. when they return their first frame).
Doing it earlier (in set_format) doesn't guarantee that the AVCodecContext
has_b_frames has been properly initialized.
https://bugzilla.gnome.org/show_bug.cgi?id=766362
GstVideoInfo *in_info, *out_info;
GstVideoCodecState *output_state;
gint fps_n, fps_d;
+ GstClockTime latency;
if (!update_video_context (ffmpegdec, context, picture))
return TRUE;
if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (ffmpegdec)))
goto negotiate_failed;
+ /* The decoder is configured, we now know the true latency */
+ latency =
+ gst_util_uint64_scale_ceil (ffmpegdec->context->has_b_frames * GST_SECOND,
+ fps_d, fps_n);
+ gst_video_decoder_set_latency (GST_VIDEO_DECODER (ffmpegdec), latency,
+ latency);
+
return TRUE;
/* ERRORS */