summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_asf.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-06-29 10:06:19 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-06-29 10:06:19 +0000
commit100554a37f479e1c1a9ab7a89d84f5424d6f491b (patch)
treed1ffbdc73e792419dbeb67604c9eb25d7a4a4c02 /libmpdemux/demux_asf.c
parentc2af943b84b9ef2b32d66a3207c1055fdb7b6d4e (diff)
downloadmpv-100554a37f479e1c1a9ab7a89d84f5424d6f491b.tar.bz2
mpv-100554a37f479e1c1a9ab7a89d84f5424d6f491b.tar.xz
Replace asserts by proper conditions to allow playback of some broken but
still playable files. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27154 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_asf.c')
-rw-r--r--libmpdemux/demux_asf.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libmpdemux/demux_asf.c b/libmpdemux/demux_asf.c
index 7d5a164886..65741d3ab7 100644
--- a/libmpdemux/demux_asf.c
+++ b/libmpdemux/demux_asf.c
@@ -3,7 +3,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <assert.h>
#include "config.h"
#include "mp_msg.h"
@@ -501,8 +500,9 @@ static int demux_asf_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
int len2=p[0];
p++;
//printf(" group part: %d bytes\n",len2);
- if(len2 > len - 1) break; // Not enough data
- assert(len2 > 0 && len2 <= asf->packetsize);
+ if(len2 > len - 1 || len2 < 0) break; // Not enough data
+ if(len2 == 0) continue;
+ len2 = FFMIN(len2, asf->packetsize);
demux_asf_read_packet(demux,p,len2,streamno,seq,x,duration,-1,keyframe);
p+=len2;
len-=len2+1;
@@ -515,8 +515,9 @@ static int demux_asf_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
default:
// NO GROUPING:
//printf("fragment offset: %d \n",sh->x);
+ if (len <= 0) break;
if (!asf->asf_is_dvr_ms || asf->found_first_key_frame) {
- assert(len > 0 && len <= asf->packetsize);
+ len = FFMIN(len, asf->packetsize);
demux_asf_read_packet(demux,p,len,streamno,seq,time2,duration,x,keyframe);
}
p+=len;