diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-07-11 10:20:12 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-07-19 12:27:17 +0200 |
commit | ac2cda4296dbbaf2580ec3aa404bb2f3a393159c (patch) | |
tree | bce0774740815db4f5ecd7d9fb231fd870af32ad /libavcodec/encode.c | |
parent | 4397f9a5a09d82846bf787295c60f1104cf7de9e (diff) |
lavc: use AVFrame.duration instead of AVFrame.pkt_duration
Diffstat (limited to 'libavcodec/encode.c')
-rw-r--r-- | libavcodec/encode.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 1f39ab1a2f..310fe20777 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -339,7 +339,7 @@ static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src) return ret; avctx->internal->last_audio_frame = 1; - return 0; + goto finish; } else if (src->nb_samples > avctx->frame_size) { av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) != frame_size (%d)\n", src->nb_samples, avctx->frame_size); return AVERROR(EINVAL); @@ -351,6 +351,15 @@ static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src) if (ret < 0) return ret; +finish: + +#if FF_API_PKT_DURATION +FF_DISABLE_DEPRECATION_WARNINGS + if (dst->pkt_duration && dst->pkt_duration != dst->duration) + dst->duration = dst->pkt_duration; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + return 0; } |