[mythtv] 20180705 Android Observations

David Engel david at istwok.net
Fri Jul 13 01:33:19 UTC 2018

On Thu, Jul 12, 2018 at 12:42:40PM -0700, Aman Gupta wrote:
> On Thu, Jul 12, 2018 at 12:39 PM Peter Bennett <pb.mythtv at gmail.com> wrote:
> > On 07/11/2018 03:16 PM, David Engel wrote:
> > I tried using yesterday's patch to watch the World Cup last night and
> > some other stuff.  I had to abandon that when playback got very
> > stuttery and I didn't have time to debug.  I suspect your sledge
> > hammer was getting used repeatedly.  I tried again later and it
> > happened again and then went away.  It didn't happen on my other
> > shield, but I didn't test with it much.
> >
> > Was this in normal playback, time stretch or fast forward? AFAIK the
> > IllegalStateException that the sledge hammer handles only happens in fast
> > forward or occasionally in skip/jump. (i.e. when flush is used).
> >
> > I suppose I need to dig into the FFmpeg source code and figure out the
> > IllegalStateException and find the correct FFmpeg fix.
> >
> > According to mediacodec documentation, IllegalStateException only happens
> > on dequeue output if the decoder is not executing or it is in asynchronous
> > mode.
> >
> > It is not in asynchronous mode or dequeue output would never work.
> >
> > The ways it can stop executing are if you call "stop" or "reset" or
> > "release" it. In ffmpeg there is a "stop" routine but it is never called,
> > and there is no reset routine.  It seems that there is no way to get into a
> > non-executing state. Prehaps it is in an error state. Unfortunately there
> > is no native API that will tell you the state.
> >
> > It seems that this may be a bug in mediacodec on the shield. I don't know
> > how much I should do to try and work around it. I have tried reordering
> > calls and adding a stop and start after the flush, but nothing has helped.
> >
> FWIW I am not able to reproduce this issue with mpv-android. Are you maybe
> calling ffmpeg APIs from different native threads?

I was not able to reproduce the problem using rapid skips on a 720p
sample with mpv-android.  I did see some occasional short pauses,
though.  I don't know if those were due to I/O stalls or decoder
resets like Peter now does when he sees the IllegalStateExceptions.
As noted earlier, mpv-android crashes on 1080i content like MythTV did
before Peter put in a fix for 1088 rows, so I couldn't test that

BTW, when is mediacodec being used, when HW or SW showing in the OSD?
I tried both.  I've always found those types of interfaces confusing.
Is what's shown the current state or what will be switched to if it's

Also, I didn't see any way to test fast forward/rewind with
mpv-android.  Is there a way?  What about any other apps?  I've yet to
see any other apps which try to do as good of a job with ff/rew as

David Engel
david at istwok.net

More information about the mythtv-dev mailing list