changeset 27122:f8df4c3e2ac2

Replace asserts by proper conditions to allow playback of some broken but still playable files.
author reimar
date Sun, 29 Jun 2008 10:06:19 +0000
parents 237e683b7480
children 390bd72e865c
files libmpdemux/demux_asf.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_asf.c	Sun Jun 29 09:14:26 2008 +0000
+++ b/libmpdemux/demux_asf.c	Sun Jun 29 10:06:19 2008 +0000
@@ -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 @@
 		  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 @@
               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;