Unified · Split
| @@ -202,10 +202,13 @@ static int read_seek(AVFormatContext *s, int stream_index, · 201 unmodified lines | |||
| 202 | MCADemuxContext *m = s->priv_data; | 202 | MCADemuxContext *m = s->priv_data; |
| 203 | int64_t ret = 0; | 203 | int64_t ret = 0; |
| 204 | 204 | ||
| 205 | if (timestamp < 0) | ||
| 206 | timestamp = 0; | ||
| 205 | timestamp /= m->samples_per_block; | 207 | timestamp /= m->samples_per_block; |
| 208 | if (timestamp >= m->block_count) | ||
| 209 | timestamp = m->block_count - 1; | ||
| 206 | ret = avio_seek(s->pb, m->data_start + timestamp * m->block_size * | 210 | ret = avio_seek(s->pb, m->data_start + timestamp * m->block_size * |
| 207 | st->codecpar->channels, SEEK_SET); | 211 | st->codecpar->channels, SEEK_SET); |
| 208 | |||
| 209 | if (ret < 0) | 212 | if (ret < 0) |
| 210 | return ret; | 213 | return ret; |
| 211 | 214 | ||