summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-01-14 21:27:59 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-01-14 21:27:59 +0000
commit1305a9d55e2b3e0e3e78478548d3c8e0f736d08e (patch)
tree666d41f72b11de476255082a39bd7e0f14654c99 /libavformat
parent0c904df2b667d4318828d9d06638125d3079b1b9 (diff)
replic_size==0 fix, needed so that G.726 asf file, so ffmpeg can at least decode the video without segfaulting
Originally committed as revision 2706 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asf.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 04ae047830..6c811ae2c6 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -1141,23 +1141,24 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
//printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size);
if (asf->packet_replic_size > 1) {
+ assert(asf->packet_replic_size >= 8);
// it should be always at least 8 bytes - FIXME validate
asf->packet_obj_size = get_le32(pb);
asf->packet_frag_timestamp = get_le32(pb); // timestamp
if (asf->packet_replic_size > 8)
url_fskip(pb, asf->packet_replic_size - 8);
rsize += asf->packet_replic_size; // FIXME - check validity
- } else {
+ } else if (asf->packet_replic_size==1){
// multipacket - frag_offset is begining timestamp
asf->packet_time_start = asf->packet_frag_offset;
asf->packet_frag_offset = 0;
asf->packet_frag_timestamp = asf->packet_timestamp;
- if (asf->packet_replic_size == 1) {
- asf->packet_time_delta = get_byte(pb);
- rsize++;
- }
- }
+ asf->packet_time_delta = get_byte(pb);
+ rsize++;
+ }else{
+ assert(asf->packet_replic_size==0);
+ }
if (asf->packet_flags & 0x01) {
DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal
#undef DO_2BITS
@@ -1232,10 +1233,10 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
asf_st->seq = asf->packet_seq;
asf_st->pkt.pts = asf->packet_frag_timestamp - asf->hdr.preroll;
asf_st->pkt.stream_index = asf->stream_index;
- asf_st->packet_pos= asf->packet_pos;
-//printf("new packet: stream:%d key:%d packet_key:%d audio:%d\n",
+ asf_st->packet_pos= asf->packet_pos;
+//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & PKT_FLAG_KEY,
-//s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO);
+//s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO, asf->packet_obj_size);
if (s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO)
asf->packet_key_frame = 1;
if (asf->packet_key_frame)