Opened 6 years ago
Closed 6 years ago
#13233 closed Developer Task (Fixed)
Android Hardware accelerated decode
Reported by: | Peter Bennett | Owned by: | Peter Bennett |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | Ports - Android | Version: | Master Head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
Android devices support mediacodec. Add support to MythTV for accelerated decoding.
This may be a lot of work and a long term project.
Attachments (13)
Change History (43)
comment:1 Changed 6 years ago by
Owner: | changed from Peter Bennett to Peter Bennett |
---|---|
Status: | new → assigned |
Changed 6 years ago by
Attachment: | 20180614_1724_mediacodec_and_ffmpeg.patch added |
---|
comment:2 Changed 6 years ago by
Attached is preliminary in-progress code for MediaCodec. It still needs to be cleaned up. Not ready for commit.
Select MediaCodec Normal playback profile. MediaCodec hardware assistance is working. Leave deinterlace as None since the Shield already deinterlaces.
Not working:
- ATSC subtitles not working.
- Video resolution change during playback not working.
To be done: Aman suggested a change to help with interlaced content. Not yet done, although deinterlacing seems to be perfect anyway.
To Be Decided: For MediaCodec and software decoding (standard) it is now bypassing existing convoluted timing code and relying of ffmpeg to do timing calculations. I am not sure whether that change should apply to all decoders, MediaCodec only, decoders that create multiple frames from 1 packet, standard decoders, private decoders, or some combination. If it applies to all, the convoluted code can be deleted.
Changed 6 years ago by
Attachment: | 20180617_mediacodec_fix_reschange.patch added |
---|
Added fix for resolution changes and Aman's deinterlace improvement
comment:3 Changed 6 years ago by
A new preliminary in-progress patch. (20180617_mediacodec_fix_reschange.patch). It includes the previous patch and adds to it.
Fixes:
- Video resolution change during playback
- Change suggested by Aman for interlaced video
- Added limit counter to prevent endless loop.
Changed 6 years ago by
Attachment: | 20180617_1712_medaicodec_fixed_openmax.patch added |
---|
New version of patch. Cleaned up unnecessary changes and fixed raspberry pi openmax
comment:4 Changed 6 years ago by
Latest patch cleans up some unneeded changes. Also the previous patches had broken private decoders including raspberry pi. This fixes that as well. I have removed the ffmpeg change that I got from Aman, waiting for it to be in the official FFmpeg release. It did not seem to make any difference anyway.
Changed 6 years ago by
Attachment: | 20180614_1707_ffmpeg_aman_revert.patch added |
---|
Aman's not yet released ffmpeg fix. Apply separately from other patch.
comment:5 Changed 6 years ago by
Apply this patch with git apply -v --dir mythtv/external/FFmpeg filename.patch
Changed 6 years ago by
Attachment: | 20180620_1715_mediacodec_pause_fixed.patch added |
---|
Playback Pause fixed. Still need to fix jump, FF, REW
comment:6 Changed 6 years ago by
Latest patch
Fix the PAUSE deadlock by allowing decoder pause during processing of a packet. Packet processing is successfully resumed at end of pause.
This does not yet address FF, REW or jump.
Changed 6 years ago by
Attachment: | 20180623_1115_mediacodec_fixed_jump_but_time_bug.patch added |
---|
Updated patch fixes mediacodec jump and skip
comment:7 Changed 6 years ago by
20180623_1115_mediacodec_fixed_jump_but_time_bug.patch fixes jump and skip.
There is a bug where the elapsed time progresses at double speed with interlaced content on Nvidia shield, because of the type of deinterlace the shield performs.
Does not yet address FF and REW.
Changed 6 years ago by
Attachment: | 20180628_1445_timing_fixed.patch added |
---|
Fixed playback elapsed time and associated things
comment:8 Changed 6 years ago by
Patch 20180628_1445_timing_fixed.patch fixes the displayed elapsed time, and along with that, the forward and back skip will use correct positioning.
What the code now does is
- Detect double frame rate from the pts timings coming out of the decoder.
- If there is double frame rate, then increment the frame number only on every second frame.
Changed 6 years ago by
Attachment: | 20180629_ff_rew_fixed.patch added |
---|
Fixes Fast Forward and Rewind with Mediacodec
comment:9 Changed 6 years ago by
This patch, 20180629_ff_rew_fixed.patch , includes a fix for fast forward and rewind.
Note that all patches are cumulative, i.e. contain all prior patches and are applied to a clean copy of master source.
Changed 6 years ago by
Attachment: | 20180705_1535_segfault_fix.patch added |
---|
Fixes segfault, FF and REW and reduces buffers to help with 4K playback
comment:10 Changed 6 years ago by
A patch to ffmpeg fixes the segfault in Oreo with 1080 playback. It is likely that this patch causes a segfault in Nougat, it seems the interface may have changed.
Also fixes FF and REW by treating the illegalstate exception as it is was a EAGAIN return.
Reduces frame buffers from 31 to 4, thus reducing the memory required to play 4K content by 320MB. This may cause jerky playback, we may need to check and tune this further.
Changed 6 years ago by
Attachment: | 20180710_1734_jump_speed.patch added |
---|
A couple of fixes to jump and speed
comment:11 Changed 6 years ago by
Details of patch 20180710_1734_jump_speed.patch :
- Fix the corrupt frame during jump by dropping 4 frames after the avcodec_flush_buffers, if there is an fps doubling in effect (i.e. deinterlacing via mediacodec)
- I found that if you disable the audio the interlaced video played at half speed. Fixed that by fixing the frame interval calculation.
- I found that the "Generic error in an external library" still happens during FF. Changed so that the video codec is re-initialized when that happens. This causes a pause in the FF operation of a few seconds, but is better than the long wait and failure message that happens otherwise.
comment:12 Changed 6 years ago by
Patch 20180716_1139_smoooooth.patch:
Smooth playback with speedup by changing the calculation of frame_interval to take into account fps doubling.
Setting of vbuffers when using mediacodec to 8 buffers.
comment:13 Changed 6 years ago by
Patch: 20180717_1042_partial_livetv_fix.patch
Fixes LiveTV crash. LiveTV still has a problem: it is basically a slide show until you press pause for a few seconds and play again.
comment:14 Changed 6 years ago by
Patch 20180717_1551_livetv.patch
Fixes LiveTV glitching at start of play
comment:16 Changed 6 years ago by
A remaining problem is that Fast Forward and Rewind experience frequent failures (IllegalStateException? from the mediacodec system), which show as pauses during the operation. These seem to get worse with time. A possible solution is to use software decoding for fast forward and rewind. A better solution would be a fix for the IllegalStateException? that is thrown.
comment:30 Changed 6 years ago by
Resolution: | → Fixed |
---|---|
Status: | assigned → closed |
Preliminary code with mediacodec support