diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-01-22 12:52:49 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-01-22 12:52:49 +0000 |
commit | b04d5d3116f478010268b6ced09f5a6828c9703b (patch) | |
tree | a1ef9069f1daf1f4008d7178eb5292b87ebaced6 /libavformat/asf.c | |
parent | 5e2a485507365061275e7418b3307a3dde9b9c81 (diff) | |
download | ffmpeg-b04d5d3116f478010268b6ced09f5a6828c9703b.tar.gz |
more correct packet alignment check and correction
Originally committed as revision 7648 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/asf.c')
-rw-r--r-- | libavformat/asf.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/asf.c b/libavformat/asf.c index bd4b8e1ce1..22cf374f0a 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -474,8 +474,6 @@ static int asf_get_packet(AVFormatContext *s) int rsize = 9; int c; - assert((url_ftell(&s->pb) - s->data_offset) % asf->packet_size == 0); - c = get_byte(pb); if (c != 0x82) { if (!url_feof(pb)) @@ -545,11 +543,16 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt) //asf->packet_size_left <= asf->packet_padsize) { int ret = asf->packet_size_left + asf->packet_padsize; //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb)); - if((url_ftell(&s->pb) + ret - s->data_offset) % asf->packet_size) - ret += asf->packet_size - ((url_ftell(&s->pb) + ret - s->data_offset) % asf->packet_size); assert(ret>=0); /* fail safe */ url_fskip(pb, ret); + + ret= (url_ftell(&s->pb) - s->data_offset) % asf->packet_size; + if(asf->hdr.max_pktsize == asf->hdr.min_pktsize && ret){ + av_log(s, AV_LOG_ERROR, "packet end missaligned skiping %d\n", ret); + url_fskip(pb, asf->packet_size - ret); + } + asf->packet_pos= url_ftell(&s->pb); if (asf->data_object_size != (uint64_t)-1 && (asf->packet_pos - asf->data_object_offset >= asf->data_object_size)) |