[Ffmpeg-cvslog] CVS: ffmpeg/libavformat utils.c,1.154,1.155

Michael Niedermayer CVS michael
Wed Jun 29 10:48:29 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv19056

Modified Files:
	utils.c 
Log Message:
fix assertion failure


Index: utils.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/utils.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- utils.c	28 Jun 2005 12:55:08 -0000	1.154
+++ utils.c	29 Jun 2005 08:48:26 -0000	1.155
@@ -2286,6 +2286,8 @@
 
 /**
  * interleave_packet implementation which will interleave per DTS.
+ * packets with pkt->destruct == av_destruct_packet will be freed inside this function. 
+ * so they cannot be used after it, note calling av_free_packet() on them is still safe
  */
 static int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){
     AVPacketList *pktl, **next_point, *this_pktl;
@@ -2295,11 +2297,14 @@
     if(pkt){
         AVStream *st= s->streams[ pkt->stream_index];
 
-        assert(pkt->destruct != av_destruct_packet); //FIXME
+//        assert(pkt->destruct != av_destruct_packet); //FIXME
 
         this_pktl = av_mallocz(sizeof(AVPacketList));
         this_pktl->pkt= *pkt;
-        av_dup_packet(&this_pktl->pkt);
+        if(pkt->destruct == av_destruct_packet)
+            pkt->destruct= NULL; // non shared -> must keep original from being freed
+        else
+            av_dup_packet(&this_pktl->pkt);  //shared -> must dup
 
         next_point = &s->packet_buffer;
         while(*next_point){





More information about the ffmpeg-cvslog mailing list