[MPlayer-dev-eng] [PATCH] fix return value of Directshow's AddRef and Release
voroshil at gmail.com
Sat Feb 10 17:07:28 CET 2007
2007/2/10, Roberto Togni <rxt at rtogni.it>:
> On Sun, 28 Jan 2007 12:24:11 +0600
> "Vladimir Voroshilov" <voroshil at gmail.com> wrote:
> > Hi, All.
> > Attached patch fixes return value from IUnknown::AddRef and
> > IUnknown::Release methods.
> > Before this patch return value of above methods differs in
> > outputpin.c, inputpin.c and iunk.h (one of them return 0, others -
> > reference counter).
> > Return value does not have real sense in almost cases, because MSDN
> > says that applications should use it only for debug purposes. But i
> > think consistent behaviour is better.
> What does the official documentation says? Should they return 0 or
> reference counter?
> The main problem with this kind of fixes is that you should retest the
> code with all supported codecs to be sure that you don't break
> anything, but that's quite hard to do.
I have found no checks for returned value of AddRef and Release in
mplayer source code. So the trouble can be only in dshow codecs.
> If it's needed to fix something commit it, else check it with major
> codecs and eventually read svn logs to find out if there is a reason
> for the different return values before applying it.
Hm, as i said in another mail i have no files to test dshow codecs.
> In this particular case the change should be safe, but I remember at
> least one codec (wmva) that worked only with a wrong return value from
> IsRectEmpty(), probably because of some other bug. In that case the
> problem was solved by patching the codec at load time (the
> isrectempty function was needed also by other codecs), but the lesson
> learned is that you never know if some of this code gives wrong results
> by design or because is buggy; and since it's imported code mplayer svn
> log may not answer it.
This code belongs to avifile project (avifile.sf.net). But there was
no commits in loader/* stuff in last two years. Existing avifile's CVS
log contains no changes related to this issue. I think this is just
very old copy/paste bug.
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at jabber.ru
More information about the MPlayer-dev-eng