Mercurial > libavformat.hg
changeset 1707:7e12a19c140f libavformat
more correct packet alignment check and correction
author | michael |
---|---|
date | Mon, 22 Jan 2007 12:52:49 +0000 |
parents | 5821b4b6d458 |
children | 2c4d5a3fbab1 |
files | asf.c |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/asf.c Mon Jan 22 12:33:10 2007 +0000 +++ b/asf.c Mon Jan 22 12:52:49 2007 +0000 @@ -474,8 +474,6 @@ 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 @@ //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))