[MPlayer-dev-eng] Re: Recent regression in FreeMediaType

Vladimir Voroshilov voroshil at gmail.com
Thu Mar 15 11:27:49 CET 2007


2007/3/15, Alan Nisota <alannisota at gmail.com>:
>
> Vladimir Voroshilov wrote:
> > 2007/3/15, Alan Nisota <alannisota at gmail.com>:
> >>
> >> Vladimir Voroshilov wrote:
> >> > Perhaps, trouble is in win32.c's
> expMoCopyMediaType,expMoFreeMediaType
> >> and
> >> > others. They are neither clears pUnk in Free nor copyes it in Copy.
> >> > Try to add "dest->pUnk=0" into expMoFreeMediaType and check if this
> >> will
> >> > help.
> >> >
> >>
> >> Nope.  I tried that (had to add pUnk in the right place in the
> >> definition of MY_MEDIA_TYPE of course), but to no avail.  Neither of
> >> those functions are called at all during shutdown (or any other time)
> by
> >> CoreAVC.
> >> The only places where CopyMediaType get called are in the Input and
> >> Output pin creation, as well as SetDestFmt (CreateMedia type never gets
> >> called)
> >> FreeMediaType gets called 4 times, in the 1st 2 cases, I'm not sure
> what
> >> allocated the memory (didn't come from a CreateMediaType or
> >> CopyMediaType), the second 2 cases were allocated by CopyMediaType.Only
> >> the second call to CloseMediaType (one where I haven't been able to
> >> track down the allocation yet) contains a 'pUnk' and at the point at
> >> which it is called, pUnk appears to be invalid.
> >
> >
> > i'm not sure that we are talking about the same thing.
> > We have two implementation of CopyMediaType now.
> > one in mediasample.c and one in win32.c
> >
> We are talking cross purposes.  the expMo*MediaType functions are not
> used at all by CoreAVC as far as I can tell.  The only functions in use
> are those used to create the input and output pins in the VideoDecoder
> dshow stuff.  So the only interesting bit is the stuff in mediasample.c,
> as the others aren't being used.

You are right (and i'm not). expMo*MediaType are used only when
codec imports msdmo.dll.

I've rechecked code once again and think that non-zero pUnk member can
appear only in binary codec  (mplayer code always creates structures with
pUnk=0, CopyMediaType always calls pUnk->vt->AddRef if punk is non-zero,
FreeMediaType sets pUnk to zero after pUnk->vt->Release).

So, i 'm afraid, the only solution is to allow memory leak in AM_MEDIA_TYPE
(by removing pUnk->vt->Release). I hope, i did miss nothing.

-- 
Regards,
Vladimir Voroshilov     mailto:voroshil at gmail.com
JID: voroshil at jabber.ru
ICQ: 95587719



More information about the MPlayer-dev-eng mailing list