lavc: use AVFrame.duration instead of AVFrame.pkt_duration

This commit is contained in:
Anton Khirnov
2022-07-11 10:20:12 +02:00
parent 4397f9a5a0
commit ac2cda4296
8 changed files with 26 additions and 11 deletions

View File

@@ -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;
}