Commit 3359246d authored by Joakim Plate's avatar Joakim Plate Committed by Janne Grunau

mxfdec: check return value of avio_seek

Avoid modifying state if avio_seek fails.
Signed-off-by: 's avatarJanne Grunau <janne-libav@jannau.net>
parent 0662eea6
...@@ -1127,13 +1127,16 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti ...@@ -1127,13 +1127,16 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
{ {
AVStream *st = s->streams[stream_index]; AVStream *st = s->streams[stream_index];
int64_t seconds; int64_t seconds;
int ret;
if (!s->bit_rate) if (!s->bit_rate)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (sample_time < 0) if (sample_time < 0)
sample_time = 0; sample_time = 0;
seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den); seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
if ((ret = avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET)) < 0)
return ret;
ff_update_cur_dts(s, st, sample_time); ff_update_cur_dts(s, st, sample_time);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment