[mythtv] 20180705 Android Observations

Peter Bennett pb.mythtv at gmail.com
Fri Jul 13 21:31:00 UTC 2018



On 07/12/2018 05:43 PM, Peter Bennett wrote:
>
>
> On 07/12/2018 03:42 PM, Aman Gupta wrote:
>> FWIW I am not able to reproduce this issue with mpv-android. Are you 
>> maybe calling ffmpeg APIs from different native threads?
>>
>> Aman
>>
> We have a decoder thread. All ffmpeg calls should be done from there. 
> I looked at it and it looks correct. For a next step I will add some 
> logging to make sure all the calls are coming from the same thread.
>
> Peter
I added logging of the calls and confirmed that all of the send, receive 
and flush calls are on the same thread.

This is what I see from the more detailed logging.
The IllegalStateException came from a receive_frame. The sequence is

flush
receive frame returns EAGAIN
send packet
receive frame returns EAGAIN
send packet
REPEAT receive and send until receive frame returns data.
After about 15 packets have been sent the next send packet returns 
EAGAIN and receive_frame returns EAGAIN. It tries receive_frame again 
and gets the IllegalStateException and the return code of Generic error 
in an external library. Any further operations including flush continue 
to get IllegalStateException and return Generic error in an external 
library.

This seems bogus. If the flush caused an illegal state it should be 
reported on the first send of data after the flush. But it is happy 
receiving 15 packets before suddenly deciding it is in an illegal state.

In the cases where flush works (95% of the time it works correctly), the 
above sequence also occurs, but after send and receive both return 
EAGAIN, the next receive_frame returns a frame correctly, as do 
subsequent receive_frame calls.

I also saw one case of the following error from flush:

[amediacodec @ 0x205ceea118] android.media.MediaCodec$CodecException: 
Error 0xffffffe0
[mpeg2_mediacodec @ 0x205ced1378] Failed to flush codec
This was followed by the IllegalStateException on the very next 
receive_frame.

This occurred when we did the flush and sent a bunch of packets as 
above. Before getting to the point of send and receive both returning 
EAGAIN, we started a new flush and got this error.

Peter




More information about the mythtv-dev mailing list