[FFmpeg-cvslog] avformat/mca: clip timestamp when seeking into acceptable range

Paul B Mahol git at videolan.org
Thu Sep 10 18:43:25 EEST 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Sep 10 17:20:19 2020 +0200| [38be47017baff232d17a2964c8d82d55de5203d2] | committer: Paul B Mahol

avformat/mca: clip timestamp when seeking into acceptable range

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38be47017baff232d17a2964c8d82d55de5203d2
---

 libavformat/mca.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/mca.c b/libavformat/mca.c
index f3f34715cb..27cfb1c777 100644
--- a/libavformat/mca.c
+++ b/libavformat/mca.c
@@ -202,10 +202,13 @@ static int read_seek(AVFormatContext *s, int stream_index,
     MCADemuxContext *m = s->priv_data;
     int64_t ret = 0;
 
+    if (timestamp < 0)
+        timestamp = 0;
     timestamp /= m->samples_per_block;
+    if (timestamp >= m->block_count)
+        timestamp = m->block_count - 1;
     ret = avio_seek(s->pb, m->data_start + timestamp * m->block_size *
                     st->codecpar->channels, SEEK_SET);
-
     if (ret < 0)
         return ret;
 



More information about the ffmpeg-cvslog mailing list