[MPlayer-dev-eng] PATCH: refcounting for demux_packet_t
Alexander Neundorf
neundorf at dellingsoft.de
Tue May 28 10:30:28 CEST 2002
On Sunday 26 May 2002 00:15, you wrote:
> Hi,
>
> > finally I have my raw dv support working, but still with a quite old (end
> > of
> >
> > february) version of mplayer, I still have to port it to a current
> > version somewhen.
> >
> > Well, here is the first part, reference counting for demux_packet_t, so
> > that the fat dv stream doesn't have to be copied twice through mplayer.
> > It introduces a new function
> >
> > demux_packet_t clone_demux_packet(demux_packet_t *p);
>
> ok, patch applied to CVS, wiht some modification and simplification.
> the main change i made is that cloning packet in ds_fill_buffer was
> unneeded, so i've removed that and also the packet freeing at the end.
Isn't this the main point where the packets are freed ?
Before my change the buffer was simply free()d, wasn't this required ?
I think the clone and free calls are really required, I inserted some output
in
inline static void free_demux_packet(demux_packet_t* dp){
if (dp->master==NULL) //dp is a master packet
{
dp->refcount--;
if (dp->refcount==0)
{
static int fc=0;
fc++;
fprintf(stderr, "FREE MASTER() %d \n",fc); // <- this one
free (dp->buffer);
free (dp);
};
return;
}
free_demux_packet(dp->master);
free(dp);
}
and without the clone_packet() and free_packet() calls the output never
appeared.
Bye
Alex
More information about the MPlayer-dev-eng
mailing list