[FFmpeg-devel] [PATCH] lavc: set best effort timestamp if unset when using new decode API
Michael Niedermayer
michael at niedermayer.cc
Tue Oct 4 19:21:39 EEST 2016
On Sun, Oct 02, 2016 at 06:56:48PM +0200, wm4 wrote:
> Some API users (in particular ffmpeg.c) check the best effort timestamp
> only.
> ---
> Still undecided if this is the right approach.
> ---
> libavcodec/utils.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index ef3da65..1875a69 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -2867,7 +2867,12 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
> if (avctx->codec->receive_frame) {
> if (avctx->internal->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
> return AVERROR_EOF;
> - return avctx->codec->receive_frame(avctx, frame);
> + ret = avctx->codec->receive_frame(avctx, frame);
> + if (ret >= 0) {
> + if (av_frame_get_best_effort_timestamp(frame) == AV_NOPTS_VALUE)
> + av_frame_set_best_effort_timestamp(frame, frame->pkt_pts);
i think the pkt_dts should be considered as well if available
as in/with guess_correct_pts()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161004/66390e64/attachment.sig>
More information about the ffmpeg-devel
mailing list