google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

Some Smooth Streaming assets don't play (CodecException) #2770

Closed MizzleDK closed 7 years ago

MizzleDK commented 7 years ago

Issue description

I'm using the demo application with a set of custom HSS samples added to the media.exolist.json file. All samples are PlayReady protected, although the server currently doesn't authenticate and allows playback even if you only have the manifest URL and nothing else.

The "Live" and "LLCU" samples work, but the "Movie" and "Catchup" ones don't. They both fail with a ExoPlaybackException / CodecException.

Using the demo player, I've found a way to get it working most of the time. Once it fails, I can disable both video and audio, press "Retry", wait for playbackState to be "ready" and then re-enable video and audio again one at a time. Not sure why it works (and not sure why it only works some of the time), but maybe it's useful information.

Reproduction steps

Add the custom samples and try them out. Hopefully they won't expire before you get a chance to test them.

Link to test content

Sent to dev.exoplayer@gmail.com with issue number in the subject line.

Version of ExoPlayer being used

r2.4.0

Device(s) and version(s) of Android being used

Nvidia Shield TV 2017 with Android TV 7.0 (Shield TV SW version 5.1)

A full bug report captured from the device

For the sake of people searching Google for a similar issue, I'm posting some of the adb logcat here:

05-04 08:12:19.926 19153-19153/com.google.android.exoplayer2.demo I/ExoPlayerImpl: Init ExoPlayerLib/2.4.0 [darcy, SHIELD Android TV, NVIDIA, 24]
05-04 08:12:19.927 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: state [0.00, true, I]
05-04 08:12:19.937 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: state [0.01, true, B]
05-04 08:12:20.018 19153-19180/com.google.android.exoplayer2.demo D/OpenGLRenderer: endAllActiveAnimators on 0x2042042c00 (ExpandableListView) with handle 0x20427fffe0
05-04 08:12:20.215 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: sourceInfo [periodCount=1, windowCount=1
05-04 08:12:20.215 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:   period [6007.08]
05-04 08:12:20.215 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:   window [6007.08, true, false]
05-04 08:12:20.215 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: ]
05-04 08:12:20.232 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: loading [true]
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: Tracks [
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:   Renderer:0 [
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:     Group:0, adaptive_supported=YES [
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:0, id=0, mimeType=video/avc, bitrate=264000, res=480x270, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:1, id=1, mimeType=video/avc, bitrate=464000, res=480x270, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:2, id=2, mimeType=video/avc, bitrate=864000, res=640x360, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:3, id=3, mimeType=video/avc, bitrate=1200000, res=640x360, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:4, id=4, mimeType=video/avc, bitrate=1800000, res=1024x576, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:5, id=5, mimeType=video/avc, bitrate=2500000, res=1024x576, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:6, id=6, mimeType=video/avc, bitrate=4500000, res=1280x720, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:     ]
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:   ]
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:   Renderer:1 [
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:     Group:0, adaptive_supported=YES_NOT_SEAMLESS [
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [X] Track:0, id=0, mimeType=audio/mp4a-latm, bitrate=96000, channels=2, sample_rate=48000, language=und, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:       [ ] Track:1, id=1, mimeType=audio/mp4a-latm, bitrate=192000, channels=2, sample_rate=48000, language=und, supported=YES
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:     ]
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger:   ]
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: ]
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: videoEnabled [0.31]
05-04 08:12:20.234 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: audioEnabled [0.31]
05-04 08:12:20.337 19153-12799/com.google.android.exoplayer2.demo I/OMXClient: MuxOMX ctor
05-04 08:12:20.346 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: audioDecoderInitialized [0.42, OMX.google.aac.decoder]
05-04 08:12:20.346 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: audioFormatChanged [0.42, id=0, mimeType=audio/mp4a-latm, bitrate=96000, channels=2, sample_rate=48000, language=und]
05-04 08:12:20.351 19153-12803/com.google.android.exoplayer2.demo I/OMXClient: MuxOMX ctor
05-04 08:12:20.361 19153-12802/com.google.android.exoplayer2.demo I/MediaCodec: [OMX.Nvidia.h264.decode.secure] setting surface generation to 19612683
05-04 08:12:20.363 19153-12803/com.google.android.exoplayer2.demo W/ACodec: [OMX.Nvidia.h264.decode.secure] setting color aspects failed even though codec advertises support
05-04 08:12:20.363 19153-12803/com.google.android.exoplayer2.demo W/ACodec: [OMX.Nvidia.h264.decode.secure] setting HDRStaticInfo failed even though codec advertises support
05-04 08:12:20.363 19153-12803/com.google.android.exoplayer2.demo I/ACodec: Enable timestamp filtering for Video Decoder
05-04 08:12:20.366 19153-12803/com.google.android.exoplayer2.demo I/ACodec: Get OMX_IndexConfigScale: 0x10000/0x10000
05-04 08:12:20.366 19153-12803/com.google.android.exoplayer2.demo I/ACodec: Scaled Width is 1280, height is 720
05-04 08:12:20.366 19153-12803/com.google.android.exoplayer2.demo W/ACodec: [OMX.Nvidia.h264.decode.secure] setting color aspects failed even though codec advertises support
05-04 08:12:20.366 19153-12803/com.google.android.exoplayer2.demo W/ACodec: [OMX.Nvidia.h264.decode.secure] getting HDRStaticInfo failed even though codec advertises support
05-04 08:12:20.369 19153-12803/com.google.android.exoplayer2.demo D/SurfaceUtils: set up nativeWindow 0x202f58ee10 for 1280x720, color 0x106, rotation 0, usage 0x6b00
05-04 08:12:20.372 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: videoDecoderInitialized [0.44, OMX.Nvidia.h264.decode.secure]
05-04 08:12:20.372 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: videoFormatChanged [0.44, id=6, mimeType=video/avc, bitrate=4500000, res=1280x720]
05-04 07:53:02.919 19153-24866/com.google.android.exoplayer2.demo E/ExoPlayerImplInternal: Internal runtime error.
                                                                                           android.media.MediaCodec$CodecException: Error 0xffffffff
                                                                                               at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
                                                                                               at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2711)
                                                                                               at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:699)
                                                                                               at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:511)
                                                                                               at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479)
                                                                                               at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:308)
                                                                                               at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                                               at android.os.Looper.loop(Looper.java:154)
                                                                                               at android.os.HandlerThread.run(HandlerThread.java:61)
05-04 07:53:02.921 19153-19153/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [0.63]
                                                                                 com.google.android.exoplayer2.ExoPlaybackException
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:362)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                                     at android.os.Looper.loop(Looper.java:154)
                                                                                     at android.os.HandlerThread.run(HandlerThread.java:61)
                                                                                  Caused by: android.media.MediaCodec$CodecException: Error 0xffffffff
                                                                                     at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
                                                                                     at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2711)
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:699)
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:511)
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479)
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:308)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:98) 
                                                                                     at android.os.Looper.loop(Looper.java:154) 
                                                                                     at android.os.HandlerThread.run(HandlerThread.java:61) 
05-04 08:12:30.428 19153-12803/com.google.android.exoplayer2.demo D/SurfaceUtils: set up nativeWindow 0x202f58ee10 for 1x1, color 0x2, rotation 0, usage 0x930
05-04 08:12:30.478 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: videoDisabled [10.55]
05-04 08:12:30.482 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: audioDisabled [10.56]
05-04 08:12:30.482 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: loading [false]
05-04 08:12:30.484 19153-19153/com.google.android.exoplayer2.demo D/EventLogger: state [10.56, true, I]

Full bug report sent to dev.exoplayer@gmail.com with issue number in the subject line.

MizzleDK commented 7 years ago

Is there anything I can do to further help in the debugging process?

ojw28 commented 7 years ago

@MizzleDK - Thanks for the high quality report! Unfortunately this feels like something that will be quite hard to figure out, unless you're able to determine what's special about the samples that don't work vs the ones that do. Are you able to play the content successfully on (a) other AndroidTV devices, and (b) non-Android devices? If the content works on other AndroidTV devices that might imply a device specific issue.

@sureshcnvidia (from nVidia): Are you aware of any related issues, and/or would it be worthwhile someone at nVidia taking a look and seeing what's going on internally? Thanks!

MizzleDK commented 7 years ago

Unfortunately, I haven't yet been able to find out what's special about the samples that work vs the ones that don't. I'm still working on it, though, hopefully I'll find something.

As far as I know, the non-working samples don't work on any Android TV devices. I've tested with both Nvidia Shield TV devices, Mi Box and various Sony TVs. What's curious, however, is that all samples work on Chromecast. It also works on our older Microsoft-based TV set top box and our web client, which - I believe - uses a player from castLabs.

Also, like I mentioned in the first post, I am actually able to get it to play using the trick where I disable / enable the tracks. It just doesn't work without that trick / hack.

MizzleDK commented 7 years ago

I still haven't made any progress on finding out if the samples differ. I'm really baffled by this.

Does it make any sense to the ExoPlayer developers that I can make it work by disabling the audio and video tracks and then re-enable them one at a time?

Please let me know if you need updated video stream URL samples or if you need more.

sureshcnvidia commented 7 years ago

Hi,

I have been off work and would be till this week.

Request to wait till Monday for me check the issue on SHIELD TV. BR, Suresh

Sent from my iPhone, Please excuse any typos.

On 16-May-2017, at 4:57 PM, Michell Bak notifications@github.com<mailto:notifications@github.com> wrote:

I still haven't made any progress on finding out if the samples differ. I'm really baffled by this.

Does it make any sense to the ExoPlayer developers that I can make it work by disabling the audio and video tracks and then re-enable them one at a time?

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/google/ExoPlayer/issues/2770#issuecomment-301753248, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AO4yBktGWLihJWOEWIz-o9njUH5qNJv9ks5r6YgagaJpZM4NQQsP.


This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

MizzleDK commented 7 years ago

That's perfectly fine, thank you!

sureshcnvidia commented 7 years ago

Hi @MizzleDK would it be possible to share the link to test contents on my email id?

MizzleDK commented 7 years ago

@sureshcnvidia Yes, I'll do that ASAP.

MizzleDK commented 7 years ago

Actually, I've just tried again on a 2015 Android TV from Sony and all content works. Could this be a device specific issue on the Nvidia Shield @sureshcnvidia ?

sureshcnvidia commented 7 years ago

Sounds like it indeed is a Nvidia Shield specific issue @MizzleDK Let me also validate on Nexus Player and get back on this.

MizzleDK commented 7 years ago

I just tried on the Nexus Player as well (Android TV 7.1), and it works. Also tried on another Sony TV (with Android TV 5.1, whereas the other was running 6.0) and it also worked. Odd... I'd been getting reports of it not working on those devices, but it does.

sureshcnvidia commented 7 years ago

Great, will debug and post more info on this shortly. Definitely Nvidia Shield specific then.

MizzleDK commented 7 years ago

Thank you!

sureshcnvidia commented 7 years ago

@MizzleDK @ojw28

Looking into the uniqueness of the samples, the reason why it was not working on Nvidia Shield is because the encrypted samples had all IV's zeroed out. Our PlayReady reference implementation had this restricted to avoid "replay" attacks (https://crypto.stackexchange.com/questions/8600/why-should-i-use-an-initialization-vector-iv-when-i-have-unique-keys ), and always liked salted IV's.

However, it was later realized that, if the keys are always different and do not repeat in CTR mode, having all zero IV is still secure enough. (https://crypto.stackexchange.com/questions/8151/counter-mode-static-iv-but-different-keys ). This issue has been fixed and the next OTA of Nvidia Shield would have this fixed.

MizzleDK commented 7 years ago

That's awesome! Thanks for all your help. Looking forward to the OTA 👍

ojw28 commented 7 years ago

Thanks for the analysis @sureshcnvidia! I'll go ahead and close this, since it's not an ExoPlayer issue.