[vlc-devel] [PATCH] DxVA2: improve the algorithm to look for the oldest buffer

Steve Lhomme robux4 at videolabs.io
Thu Apr 2 17:37:43 CEST 2015

On Thu, Apr 2, 2015 at 5:29 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 2015-04-02 17:36, Steve Lhomme a écrit :
>>> @@ -507,6 +505,7 @@ static void Release(void *opaque, uint8_t *data)
>>>      vlc_mutex_lock( &surface->sys->surface_lock );
>>>      surface->refcount--;
>>> +    surface->order = surface->sys->surface_order++;
>> This is the key part. The "age" is determined by when it was released,
>> not it was acquired.
> Eeither the decoder is broken, or there are not enough pictures. Either way,
> the video will be corrupt. I believe that returning NULL is safer than
> mismanaging reference counts, but I take note that Laurent ostensibly
> thought otherwise.

I didn not change that part of the logic. But yes, it's odd to return
"whatever" buffer when all of them are used. Or couting references by
setting 1 when acquiring and decrementing when releasing. That's not
very balanced.

More information about the vlc-devel mailing list