diff options
author | Edward Hervey <edward@centricular.com> | 2016-05-12 11:09:13 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2016-05-13 11:59:03 +0200 |
commit | b0380bb4dbfc479d51c7569c4e9887e68120bbdb (patch) | |
tree | b7fa67b37a7e4eb2d8e1cf164213aec37795acbd | |
parent | 7004c40fc2b2f5ba1866d4182b2385917e7d6ecf (diff) | |
download | gst-libav-b0380bb4dbfc479d51c7569c4e9887e68120bbdb.tar.gz |
avvidec: Report the latency once we're fully configured
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
-rw-r--r-- | ext/libav/gstavviddec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index cafd03c..8273dda 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -1011,6 +1011,7 @@ gst_ffmpegviddec_negotiate (GstFFMpegVidDec * ffmpegdec, GstVideoInfo *in_info, *out_info; GstVideoCodecState *output_state; gint fps_n, fps_d; + GstClockTime latency; if (!update_video_context (ffmpegdec, context, picture)) return TRUE; @@ -1093,6 +1094,13 @@ gst_ffmpegviddec_negotiate (GstFFMpegVidDec * ffmpegdec, 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 */ |