[MPlayer-dev-eng] [PATCH] 1 memcpy less in lavf demuxer

Michael Niedermayer michaelni at gmx.at
Tue Jun 29 14:46:35 CEST 2010


On Sat, Jun 26, 2010 at 08:14:27PM +0200, Reimar Döffinger wrote:
> On Tue, Jun 22, 2010 at 11:36:39PM +0200, Michael Niedermayer wrote:
> > +    if(pkt.destruct == av_destruct_packet){
> >          dp=malloc(sizeof(demux_packet_t));
> >          dp->len=pkt.size;
> >          dp->next=NULL;
> >          dp->refcount=1;
> >          dp->master=NULL;
> >          dp->buffer=pkt.data;
> 
> Um, won't MPlayer use free() instead of av_free() on this,
> thus breaking on Windows?
> I know we replaced some malloc/free with the av_ functions,
> but not the demuxer ones I think...

hmm, then what about:
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	(revision 31584)
+++ libmpdemux/demux_lavf.c	(working copy)
@@ -612,14 +612,14 @@
         return 1;
     }
 
-    if(0/*pkt.destruct == av_destruct_packet*/){
-        //ok kids, dont try this at home :)
+    if(pkt.destruct == av_destruct_packet && !CONFIG_MEMALIGN_HACK){
         dp=malloc(sizeof(demux_packet_t));
         dp->len=pkt.size;
         dp->next=NULL;
         dp->refcount=1;
         dp->master=NULL;
         dp->buffer=pkt.data;
+        dp->stream_pts = MP_NOPTS_VALUE;
         pkt.destruct= NULL;
     }else{
         dp=new_demux_packet(pkt.size);


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100629/eab42602/attachment.pgp>


More information about the MPlayer-dev-eng mailing list