[FFmpeg-devel] [PATCH 4/4] avformat/demux: don't truncate the return value of ts_to_samples()

James Almer jamrial at gmail.com
Tue Feb 1 03:56:48 EET 2022


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/demux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 4509015847..ec34b65288 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1346,7 +1346,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
         if (sti->first_discard_sample && pkt->pts != AV_NOPTS_VALUE) {
             int64_t pts = pkt->pts - (is_relative(pkt->pts) ? RELATIVE_TS_BASE : 0);
             int64_t sample = ts_to_samples(st, pts);
-            int duration = ts_to_samples(st, pkt->duration);
+            int64_t duration = ts_to_samples(st, pkt->duration);
             int64_t end_sample = sample + duration;
             if (duration > 0 && end_sample >= sti->first_discard_sample &&
                 sample < sti->last_discard_sample)
-- 
2.34.1



More information about the ffmpeg-devel mailing list