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

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


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Sep 10 17:23:41 2020 +0200| [f4b84d89d1cf17835a1ed2d2b8a0cfa08b810fe9] | committer: Paul B Mahol

avformat/brstm: clip timestamp when seeking into acceptable range

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

 libavformat/brstm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index ca965ed7e1..a63c7ee5ab 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -446,7 +446,11 @@ static int read_seek(AVFormatContext *s, int stream_index,
     BRSTMDemuxContext *b = s->priv_data;
     int64_t ret = 0;
 
+    if (timestamp < 0)
+        timestamp = 0;
     timestamp /= b->samples_per_block;
+    if (timestamp >= b->block_count)
+        timestamp = b->block_count - 1;
     ret = avio_seek(s->pb, b->data_start + timestamp * b->block_size *
                            st->codecpar->channels, SEEK_SET);
     if (ret < 0)



More information about the ffmpeg-cvslog mailing list