[vlc-devel] [PATCH 3/3] mediacodec: implementation of MediaCodec direct rendering based on the work by Martin Storsjö.

Martin Storsjö martin at martin.st
Mon Dec 23 19:35:21 CET 2013

On Sun, 22 Dec 2013, Rémi Denis-Courmont wrote:

> Le dimanche 15 décembre 2013, 00:58:33 Martin Storsjö a écrit :
>> So after a few more minutes of digging around, I see that this actually
>> already is taken care of. By adding this into the MediaCodec loop that
>> waits for a ready input/output buffer, this seem to work just fine for me:
>> +            if (!vlc_object_alive(p_dec)) {
>> +                (*myVm)->DetachCurrentThread(myVm);
>> +                return NULL;
>> +            }
> I don't think you can rely on object "liveness" in a decoder. For one thing, I 
> doubt it would work in stream output. And I strongly suspect it carries 
> intrinsic race conditions in normal output since the flag is not set from the 
> decoder thread.

Hmm, I'm not familiar enough with stream output in VLC to know how it 
would interfere here.

For the race condition, I guess you mean that when closing/finishing, it's 
undefined whether the last few frames get decoded or not.

If that's the case, I think it is an acceptable tradeoff for the direct 
rendering/opaque output buffers case - we could do this only in that case 
(not in the currently default YUV buffer output mode). In this particular 
case we need something that explicitly is set from some other thread, 
since this thread will be blocked infinitely if the vout doesn't 
consume/release buffers (e.g. while paused). And stream output probably 
isn't much of an issue either for the direct rendering/opaque buffer case.

// Martin

More information about the vlc-devel mailing list