asf: Check return value of more avio_seek calls
This reduces problems when underlying protocol is not
seekable even if marked as such or if the file has been
cut short.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ac1d489320
)
This commit is contained in:
committed by
Michael Niedermayer
parent
be82df9e12
commit
f0869d3721
@@ -1158,7 +1158,8 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
|
|||||||
if (s->packet_size > 0)
|
if (s->packet_size > 0)
|
||||||
pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
|
pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
|
||||||
*ppos= pos;
|
*ppos= pos;
|
||||||
avio_seek(s->pb, pos, SEEK_SET);
|
if (avio_seek(s->pb, pos, SEEK_SET) < 0)
|
||||||
|
return AV_NOPTS_VALUE;
|
||||||
|
|
||||||
//printf("asf_read_pts\n");
|
//printf("asf_read_pts\n");
|
||||||
asf_reset_header(s);
|
asf_reset_header(s);
|
||||||
@@ -1200,7 +1201,9 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
|
|||||||
int64_t current_pos= avio_tell(s->pb);
|
int64_t current_pos= avio_tell(s->pb);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
|
if(avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
ff_get_guid(s->pb, &g);
|
ff_get_guid(s->pb, &g);
|
||||||
|
|
||||||
/* the data object can be followed by other top-level objects,
|
/* the data object can be followed by other top-level objects,
|
||||||
@@ -1272,7 +1275,8 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
|
|||||||
|
|
||||||
/* do the seek */
|
/* do the seek */
|
||||||
av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
|
av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
|
||||||
avio_seek(s->pb, pos, SEEK_SET);
|
if(avio_seek(s->pb, pos, SEEK_SET) < 0)
|
||||||
|
return -1;
|
||||||
asf_reset_header(s);
|
asf_reset_header(s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user