[MPlayer-dev-eng] [PATCH] fix return value of Directshow's AddRef and Release

Roberto Togni rxt at rtogni.it
Sat Feb 10 16:15:49 CET 2007


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.

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.

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.

Ciao,
 Roberto



More information about the MPlayer-dev-eng mailing list