[mythtv] Android mediacodec woes

Torbjorn Jansson torbjorn.jansson at mbox200.swipnet.se
Tue Jun 26 21:33:19 UTC 2018


On 2018-06-26 22:11, Peter Bennett wrote:
> The double framerate that I am getting from mediacodec is proving to be a 
> rather complicated problem to solve. With the situation the way it is now, the 
> display of elapsed time is wrong and jumps are very wrong. For example after 
> watching for 5 minutes, the OSD shows 10 minutes, and doing a forward jump of 1 
> minute jumps to the real 11 minutes, i.e. jumps forward 6 minutes instead of 
> jumping forward 1 minute. Jumping back a minute  actually jumps forward 4 minutes.
> 
what you describe is not a new problem, i have seen the exact same behavior on 
some recordings and i'm not even using the latest mythtv version (still on 0.28 
fixes) and i'm using the regular version, not android.

yes the problem was much less than what you describe but still there.


> Detecting the condition is easy enough. Fixing it, not so easy.
> 
> I first thought that I could simply double the fps value stored in 
> AVFormatDecoder and MythPlayer. That does not work. I found that the 
> MpegPreProcess is resetting it back to 29.97 on the next frame. Why do we parse 
> the Mpeg input? Maybe that should be eliminated. We could get framerate from 
> the decoded timestamps.
> 
> I then realized that the whole approach of changing the fps is flawed because 
> the code uses framecount all over the place for calculating positions in the 
> file. If the frame count from the demultiplexer (avformat) is half the frame 
> count from the decoder, all sorts of calculations go wrong.
> 
> There is a feature in MythPlayer for m_double_framerate for double framerate 
> deinterlacers. I am now thinking I should extend that to support this new 
> situation of double framerate interlacer that is built into the decoder. It 
> will need a number of changes, currently m_double_framerate is disabled as soon 
> as it sees a non-deinterlaced frame. Currently m_double_framerate indicator 
> causes the same frame to be passed to the video output twice, now it will need 
> two consecutive frames passed to the video output.
> 
> Another option is just drop every second frame. This would be easiest but that 
> will surely reduce the quality, which is not what we want.
> 
> Peter
> 

i suspect without knowing the code too much that fixing the problem isn't going 
to be easy.
especially if mythtv relies on a fixed frame rate or frame counting.
changing to taking timestamps into account properly and presenting them at the 
appropriate time is likely not easy.




More information about the mythtv-dev mailing list