This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM62P: Video playback issues in Android

Part Number: PROCESSOR-SDK-AM62P
Other Parts Discussed in Thread: SK-AM62P-LP

Tool/software:

Hello,

We're encountering some issues with video playback in the 10.01.01 Android SDK on the SK-AM62P-LP EVM (PROC164E1-1): we're trying to play back H.264-encoded video and are finding that interruptions to playback seem to often get something in the decode pipeline into a weird state such that playback no longer works without rebooting.

Please see below for more specific details, but are there current known limitations around HW video decode? The release notes for the last several SDK versions have listed it in the release features.


Android build: AM62Px_userdebug_10.01.01_emmc.tgz

Test video: https://download.blender.org/demo/movies/BBB/bbb_sunflower_1080p_60fps_normal.mp4.zip

Video info per mediainfo:

General
Complete name                            : bbb_sunflower_1080p_60fps_normal.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/avc1)
File size                                : 339 MiB
Duration                                 : 10 min 34 s
Overall bit rate                         : 4 487 kb/s
Movie name                               : Big Buck Bunny, Sunflower version
Performer                                : Blender Foundation 2008, Janus Bager Kristensen 2013
Composer                                 : Sacha Goedegebure
Genre                                    : Animation
Encoded date                             : UTC 2013-12-16 17:59:32
Tagged date                              : UTC 2013-12-16 17:59:32
Comment                                  : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
com                                      : Jan Morgenstern

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.2
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 10 min 34 s
Bit rate                                 : 4 000 kb/s
Maximum bit rate                         : 19.7 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 60.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.032
Stream size                              : 303 MiB (89%)
Writing library                          : x264 core 115
Encoding settings                        : cabac=1 / ref=4 / deblock=1:1:1 / analyse=0x3:0x133 / me=tesa / subme=10 / psy=1 / psy_rd=0.40:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=12 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=16 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=2pass / mbtree=1 / bitrate=4000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:0.60
Encoded date                             : UTC 2013-12-16 17:59:32
Tagged date                              : UTC 2013-12-16 17:59:37

Audio #1
ID                                       : 2
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Format settings                          : Joint stereo / MS Stereo
Codec ID                                 : mp4a-6B
Duration                                 : 10 min 34 s
Bit rate mode                            : Constant
Bit rate                                 : 160 kb/s
Maximum bit rate                         : 165 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Frame rate                               : 41.667 FPS (1152 SPF)
Compression mode                         : Lossy
Stream size                              : 12.1 MiB (4%)
Writing library                          : LAME3.99r
Encoding settings                        : -m j -V 4 -q 3 -lowpass 17.5 -b 160
Encoded date                             : UTC 2013-12-16 17:59:37
Tagged date                              : UTC 2013-12-16 17:59:37

Audio #2
ID                                       : 3
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Codec ID                                 : ac-3
Duration                                 : 10 min 34 s
Bit rate mode                            : Constant
Bit rate                                 : 320 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 24.2 MiB (7%)
Service kind                             : Complete Main
Encoded date                             : UTC 2013-12-16 17:59:37
Tagged date                              : UTC 2013-12-16 17:59:37

For these tests, the video was stored locally on the EVM's eMMC and playback was initiated from the Files app. The main symptoms we're seeing are:

  • After exiting the player with the back button, logs indicate that the player process becomes unresponsive and Android kills it. There's no indication of this in the UI, except that the player obviously doesn't show up in the app switcher.
  • When relaunching the player after exiting as described above, the playback timer in the video controls counts as if the video is playing, but there's only black where the video picture should be. This is accompanied in the logs by a start timeout and unknown error report from codec components:
    • CCodec  : [c2.v4l2.avc.decoder] previous call to start exceeded timeout
      MediaCodec: Codec reported err 0x80000000/UNKNOWN_ERROR, actionCode 0, while in state 5/STARTING
  • While successfully playing back video, if we try to scrub, the picture and playback timer both freeze and don't ever seem to return. Nothing changes in ~30 seconds, so this doesn't feel like a delay associated with loading the new location from the storage medium. (For reference when first opened, it only takes maybe 2-3 seconds for playback to start.)
  • If we let the video play to the end, we can successfully relaunch the player without rebooting.
  • When shutting down after playback has failed, Android isn't able to gracefully stop the 'android-hardware-media-c2-v4l2-hal-1-2' service.

Attached are several logcat dumps collected via adb that capture the above behaviors. Some rough timestamps from the logs:

  • logcat-1.txt
    • Launch player for the first time (succeeds): ~8:48:30
    • Exit player: ~8:49:00
    • Launch player (black screen): ~8:49:55
    • Exit player: ~8:50:25
    • Launch player (black screen): ~8:52:37
    • Exit player: ~8:53:15
    • Here I tried starting/stopping and otherwise playing with playback a bit to try to induce a v4l2 driver CPU hang we've seen on our own hardware (discussed more below), but I was unable to reproduce it on the EVM.
    • Ends with poweroff showing the 'android-hardware-media-c2-v4l2-hal-1-2' service misbehaving.
  • logcat-2.txt
    • Launch player for the first time (succeeds): ~8:47:37
    • Scrub video (freezes): ~8:48:15
    • Exit player: ~8:48:48
    • Launch player (black screen): ~8:49:12
    • Exit player: ~8:49:37
    • Ends with poweroff showing the 'android-hardware-media-c2-v4l2-hal-1-2' service misbehaving.
  • logcat-3.txt
    • android.hardware.composer.hwc3-service.drm segfault: 0:00:19
      • This doesn't always happen, and we're not sure whether it correlates with any of the  playback issues we're seeing.
    • Launch player for the first time (succeeds): ~8:47:37
    • Video finishes and player exits: ~8:58:12
    • Launch player (succeeds): ~8:58:47
    • Exit player: ~8:59:17
      • This time, instead of the player process being reported as unresponsive, there's a kernel warning and call trace from wave5_vpu_dec_device_run.
    • Launch player (succeeds): ~9:01:12
      • This is the only time in these tests that relaunching the player worked after previously exiting it.
    • Exit player: ~9:01:40
    • Launch player (black screen): ~9:02:25
    • Exit player: ~9:02:42
    • Ends with poweroff showing the 'android-hardware-media-c2-v4l2-hal-1-2' service misbehaving.

The v4l2 driver CPU hang mentioned above seems to be in an ioctl (call trace below). We haven't dug too deeply into this yet, so we're not sure if that correlates specifically with something we're doing in the UI. Again, in the testing above, this didn't occur on the EVM, though I can't confidently say we've never seen it on the EVM. I mainly bring it up since it seems at least potentially related. Call trace:

[ 2889.064867][   T43] INFO: task DecodeComponent:2243 blocked for more than 1441 seconds.
[ 2889.073439][   T43]       Tainted: G           O       6.6.66-android15-8-maybe-dirty-4k #1
[ 2889.082075][   T43] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 2889.090843][   T43] task:DecodeComponent state:D stack:0     pid:2243  ppid:1      flags:0x04000800
[ 2889.100318][   T43] Call trace:
[ 2889.103495][   T43]  __switch_to+0x15c/0x2cc
[ 2889.107897][   T43]  __schedule+0x638/0x9d4
[ 2889.112136][   T43]  schedule+0x7c/0xe8
[ 2889.116138][   T43]  v4l2_m2m_cancel_job+0xe4/0x1d8
[ 2889.122436][   T43]  v4l2_m2m_streamoff+0x2c/0x14c
[ 2889.127402][   T43]  v4l2_m2m_ioctl_streamoff+0x18/0x28
[ 2889.132758][   T43]  v4l_streamoff+0x3c/0x4c
[ 2889.137564][   T43]  __video_do_ioctl+0x360/0x4b8
[ 2889.142522][   T43]  video_usercopy+0x3b8/0x6c0
[ 2889.147921][   T43]  video_ioctl2+0x18/0x28
[ 2889.153502][   T43]  v4l2_ioctl+0x6c/0x84
[ 2889.159591][   T43]  __arm64_sys_ioctl+0xa8/0xe4
[ 2889.164492][   T43]  invoke_syscall+0x58/0x114
[ 2889.170027][   T43]  el0_svc_common+0x80/0xe0
[ 2889.178044][   T43]  do_el0_svc+0x1c/0x28
[ 2889.184454][   T43]  el0_svc+0x38/0x68
[ 2889.188826][   T43]  el0t_64_sync_handler+0x68/0xbc
[ 2889.194607][   T43]  el0t_64_sync+0x1a8/0x1ac

For context, our actual goal is playing back YouTube videos; but that fails with the same black picture and MediaCodec UNKNOWN_ERROR log, so the local playback symptoms described above seemed like possibly a related issue and one that would be easier to isolate/debug.

Any help you can give would be greatly appreciated,
Zach

logcat-1.txt logcat-2.txt logcat-3.txt