diff options
author | Paul B Mahol <onemda@gmail.com> | 2021-08-25 13:08:10 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2021-11-18 12:54:17 +0100 |
commit | e5367b481b5232182a4851dbd7fc5a7a5bd475de (patch) | |
tree | 60641b4ff9adf45fadf4dccd2704402492a7f2f3 /fftools/ffmpeg.c | |
parent | 85a6b7f7b746a7bf71146b1530f19f699c4f0fb4 (diff) | |
download | ffmpeg-e5367b481b5232182a4851dbd7fc5a7a5bd475de.tar.gz |
ffmpeg: fix loosing gaps between audio frame timestamps when filtering
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r-- | fftools/ffmpeg.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 7b2dcee838..b1d2c69fa7 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2382,6 +2382,11 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, decoded_frame->pts = ist->dts; decoded_frame_tb = AV_TIME_BASE_Q; } + if (pkt && pkt->duration && ist->prev_pkt_pts != AV_NOPTS_VALUE && + pkt->pts != AV_NOPTS_VALUE && pkt->pts - ist->prev_pkt_pts > pkt->duration) + ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE; + if (pkt) + ist->prev_pkt_pts = pkt->pts; if (decoded_frame->pts != AV_NOPTS_VALUE) decoded_frame->pts = av_rescale_delta(decoded_frame_tb, decoded_frame->pts, (AVRational){1, avctx->sample_rate}, decoded_frame->nb_samples, &ist->filter_in_rescale_delta_last, |