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

Martin Storsjö martin at martin.st
Sat Dec 14 23:58:33 CET 2013


On Sun, 15 Dec 2013, Martin Storsjö wrote:

> On Sat, 14 Dec 2013, Felix Abecassis wrote:
>
>> 2013/12/13 Martin Storsjö <martin at martin.st>:
>>> 
>>> In general this seems to work pretty well on my Galaxy S3 now - kudos for
>>> that. However, if pausing the video, waiting for a little while (a few
>>> seconds) and then pressing the back key to exit, something somewhere seems
>>> to deadlock.
>> Which sample did you use?
>
> I ran into the issue with the casino royale trailer that I think I've shared 
> with you before. I don't run into it with a few other samples, and not on my 
> Nexus 7 either.
>
> I had a quick look at what's happening, and looks like something that can 
> happen on almost any device/sample: The decoder has used up all the output 
> buffers so it's blocked in DecodeVideo waiting for a free input or output 
> buffer. Since the video gets paused, it won't try to render any more of the 
> buffered pictures yet, so the decoder thread is basically blocked there until 
> somebody frees one of the buffered pictures. Now when I press the back key to 
> exit, it doesn't free the list of already output pictures (not just yet at 
> least), probably waiting for the DecodeVideo call to return.
>
> So something from elsewhere would need to tell the video decoder thread to 
> give up/abort

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;
+            }

// Martin


More information about the vlc-devel mailing list