在 Android TV 上升级 Android WebView 后,hls 264 视频不再播放

Posted

技术标签:

【中文标题】在 Android TV 上升级 Android WebView 后,hls 264 视频不再播放【英文标题】:After upgrading Android WebView on Android TV, hls 264 videos are not being played anymore 【发布时间】:2020-05-28 14:23:39 【问题描述】:

android WebView 升级到 80.0.3987.99 版本后,Android TV 不再在基于 WebView 的应用 (ionic 4) 上播放 HLS 直播视频 (h264)。

操作系统:Android TV 9(Android TV 独有) 内核版本:4.9.113

重现步骤:

(1) 只需尝试在使用 WebView 80.0.3987.99 的 Android TV 设备上基于 WebView 的应用上打开 HLS h264 实时视频(m3u8 清单)。您可以使用随附的 APK。

预期结果:视频未播放。

将 WebView 降级为次要版本(例如,75.0.03770.143)并重新启动应用程序,视频实际上播放没有问题。

APK下载测试:

https://bugs.chromium.org/p/chromium/issues/attachment?aid=433346&signed_aid=j3jgAQISOSoCW4DBQcRFXw==


登录 logcat:

2020-02-12 15:57:40.206 24233-24336/com.eninetworks.enitvtester I/cr_MediaCodecBridge: create MediaCodec video decoder, mime video/avc

2020-02-12 15:57:40.277 24233-24349/com.eninetworks.enitvtester I/OMXClient: IOmx service obtained

2020-02-12 15:57:40.373 24233-24348/com.eninetworks.enitvtester I/MediaCodec: MediaCodec will operate in async mode
2020-02-12 15:57:40.382 24233-24348/com.eninetworks.enitvtester D/SurfaceUtils: connecting to surface 0xd1a7f008, reason connectToSurface

2020-02-12 15:57:40.383 24233-24348/com.eninetworks.enitvtester I/MediaCodec: [OMX.amlogic.avc.decoder.awesome] setting surface generation to 24814593

2020-02-12 15:57:40.383 24233-24348/com.eninetworks.enitvtester D/SurfaceUtils: disconnecting from surface 0xd1a7f008, reason connectToSurface(reconnect)

2020-02-12 15:57:40.383 24233-24348/com.eninetworks.enitvtester D/SurfaceUtils: connecting to surface 0xd1a7f008, reason connectToSurface(reconnect)

2020-02-12 15:57:40.386 24233-24349/com.eninetworks.enitvtester I/AmAVUtils: AmAVUtils::getComponentRole isEncoder :0 mime:video/avc 

2020-02-12 15:57:40.386 24233-24349/com.eninetworks.enitvtester V/AVUtils: AVUtils::getComponentRole

2020-02-12 15:57:40.393 24233-24349/com.eninetworks.enitvtester E/ACodec: [OMX.amlogic.avc.decoder.awesome] setPortMode on output to DynamicANWBuffer failed w/ err -2147483648

2020-02-12 15:57:40.403 24233-24349/com.eninetworks.enitvtester I/AmAVUtils: AmAVUtils::isAudioExtendFormat input = video/avc


2020-02-12 15:57:40.470 24233-24349/com.eninetworks.enitvtester D/SurfaceUtils: disconnecting from surface 0xd1a7f008, reason setNativeWindowSizeFormatAndUsage

2020-02-12 15:57:40.470 24233-24349/com.eninetworks.enitvtester D/SurfaceUtils: connecting to surface 0xd1a7f008, reason setNativeWindowSizeFormatAndUsage

2020-02-12 15:57:40.470 24233-24349/com.eninetworks.enitvtester D/SurfaceUtils: set up nativeWindow 0xd1a7f008 for 1920x1080, color 0x11, rotation 0, usage 0x402b00

2020-02-12 15:57:40.471 24233-24349/com.eninetworks.enitvtester W/ACodec: [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 10 failed: -1010

2020-02-12 15:57:40.472 24233-24349/com.eninetworks.enitvtester W/ACodec: [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 9 failed: -1010

2020-02-12 15:57:40.473 24233-24349/com.eninetworks.enitvtester W/ACodec: [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 8 failed: -1010

2020-02-12 15:57:40.475 24233-24349/com.eninetworks.enitvtester W/ACodec: [OMX.amlogic.avc.decoder.awesome] setting nBufferCountActual to 7 failed: -1010

2020-02-12 15:57:40.475 24233-24349/com.eninetworks.enitvtester E/ACodec: Failed to allocate buffers after transitioning to IDLE state (error 0xfffffc0e)

2020-02-12 15:57:40.475 24233-24349/com.eninetworks.enitvtester E/ACodec: signalError(omxError 0x80001001, internalError -1010)

2020-02-12 15:57:40.478 24233-24348/com.eninetworks.enitvtester E/MediaCodec: Codec reported err 0xfffffc0e, actionCode 0, while in state 5

2020-02-12 15:57:40.478 24233-24348/com.eninetworks.enitvtester E/libc: Access denied finding property "media.metrics.enabled"

2020-02-12 15:57:40.492 24233-24349/com.eninetworks.enitvtester W/AHierarchicalStateMachine: Warning message AMessage(what = 'omxI') = 
      int32_t type = 0
      int32_t event = 0
      int32_t data1 = 0
      int32_t data2 = 1
     unhandled in root state.

2020-02-12 15:57:40.506 24233-24348/com.eninetworks.enitvtester D/SurfaceUtils: disconnecting from surface 0xd1a7f008, reason disconnectFromSurface

**2020-02-12 15:57:40.518 24233-24336/com.eninetworks.enitvtester E/cr_MediaCodecBridge: Cannot start the media codec**

android.media.MediaCodec$CodecException: start failed
at android.media.MediaCodec.native_start(Native Method)
at android.media.MediaCodec.start(MediaCodec.java:2068)
at org.chromium.media.MediaCodecBridge.c(PG:8)
at org.chromium.media.MediaCodecBridgeBuilder.createVideoDecoder(PG:68)

2020-02-12 15:57:40.521 24233-24336/com.eninetworks.enitvtester W/cr_MediaCodecBridge: Releasing: OMX.amlogic.avc.decoder.awesome

2020-02-12 15:57:40.528 24233-24336/com.eninetworks.enitvtester W/cr_MediaCodecBridge: Codec released

2020-02-12 15:57:40.545 24233-24282/com.eninetworks.enitvtester D/AudioTrack: stop() called with 16940 frames delivered

2020-02-12 15:57:45.549 24233-24282/com.eninetworks.enitvtester E/libc: Access denied finding property "media.metrics.enabled"

2020-02-12 15:57:45.544 24233-24233/com.eninetworks.enitvtester W/AudioThread: type=1400 audit(0.0:48242): avc: denied  read  for name="u:object_r:media_prop:s0" dev="tmpfs" ino=2183 scontext=u:r:untrusted_app:s0:c47,c256,c512,c768 tcontext=u:object_r:media_prop:s0 tclass=file permissive=0

【问题讨论】:

您不是唯一遇到此问题的人。我也在面对。甚至 Facebook TV 应用程序也无法使用此 webview 播放视频:/。我很高兴看到解决方案 【参考方案1】:

所以,我取得了一点进展。 h.264 在 Android TV 上的最新 webview 存在问题。它甚至在前一个上有。我玩过 ffmpeg,显然 h.265 main 4.1 编码的 mp4 并没有导致这个问题。对我来说,新编解码器仍然存在three.js 纹理问题。尝试转换视频,也许它会给你带来好运和工作:)

【讨论】:

【参考方案2】:

对于那些有这种行为的人,WebKit 80 中存在一个错误,该错误已被接受,并在计划于 3 月 17 日发布的版本中得到修复。

我向 Chromium 团队报告了该错误,您可以在此处阅读更多信息:

https://bugs.chromium.org/p/chromium/issues/detail?id=1051705

【讨论】:

以上是关于在 Android TV 上升级 Android WebView 后,hls 264 视频不再播放的主要内容,如果未能解决你的问题,请参考以下文章

Android TV-电视开发知识点速览

Android TV开发焦点移动源码分析

Android TV 应用无法安装在 Android TV 设备上

Android-TV 应用显示白屏

Android TV:如何使用 Leanbak 自定义 android TV 的左侧导航面板?

Android TV开发总结焦点