Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DASH playback with WV Modular protection fails on Nexus Player #2254

Closed
akavrt opened this Issue Dec 23, 2016 · 16 comments

Comments

Projects
None yet
5 participants
@akavrt
Copy link

akavrt commented Dec 23, 2016

We are experiencing playback failure with a limited number of WV-protected DASH streams which reproduces only on Nexus Player (7.1.1) when adaptation between different bitrates happens. The same streams play just fine on Sony and Phillips TVs as well as on NVIDIA Shield and Xiaomi Mi Box set-top boxes.

I've experimented with different versions of ExoPlayer (through r1.5 to r2.1.1) and this problem affects all of them.

This is the meaningful part of the logcat output, which could give a clue:

12:14:11.533 2606-2606/? D/EventLogger: videoFormatChanged [14.44, id=1080p, mimeType=video/avc, bitrate=3948743, res=1920x1080]
12:14:11.536 188-188/? W/MDRMOemCrypto: duplicate SPS NALU (skipping)
12:14:11.536 188-188/? E/MDRMOemCrypto: ERROR: multiple PPS NALUs (not supported by video decoder)
12:14:11.536 188-188/? E/MDRMOemCrypto: Failed to process subsamples
12:14:11.536 188-188/? E/WVCdm: Decrypt error result in session sid10 during encrypted block: 178
12:14:11.546 2606-2790/? E/ExoPlayerImplInternal: Renderer error.
  com.google.android.exoplayer2.ExoPlaybackException
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:666)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:485)
      at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479)
      at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:315)
      at android.os.Handler.dispatchMessage(Handler.java:98)
      at android.os.Looper.loop(Looper.java:154)
      at android.os.HandlerThread.run(HandlerThread.java:61)
      at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
   Caused by: android.media.MediaCodec$CryptoException: Error decrypting data: unspecified error
      at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
      at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2480)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:657)
      at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:485) 
      at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479) 
      at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:315) 
      at android.os.Handler.dispatchMessage(Handler.java:98) 
      at android.os.Looper.loop(Looper.java:154) 
      at android.os.HandlerThread.run(HandlerThread.java:61) 
      at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40) 

The interesting line is

12:14:11.536 188-188/? E/MDRMOemCrypto: ERROR: multiple PPS NALUs (not supported by video decoder)

The codec being used is OMX.Intel.VideoDecoder.AVC.secure.

I've done some preliminary investigation and found that commenting out lines

https://github.com/google/ExoPlayer/blob/release-v2/library/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java#L582-L585

      // For adaptive reconfiguration OMX decoders expect all reconfiguration data to be supplied
      // at the start of the buffer that also contains the first frame in the new format.
      if (codecReconfigurationState == RECONFIGURATION_STATE_WRITE_PENDING) {
        for (int i = 0; i < format.initializationData.size(); i++) {
          byte[] data = format.initializationData.get(i);
          buffer.data.put(data);
        }
        codecReconfigurationState = RECONFIGURATION_STATE_QUEUE_PENDING;
      }

in feedInputBuffer() method of MediaCodecRenderer fixes the problem in question, but obviously causes another problems.

Any thoughts what would be a proper solution to this problem?

Here is full logcat output:

12:13:57.117 2606-2606/? I/ExoPlayerImpl: Init 2.1.1 [fugu, Nexus Player, Asus, 25]
12:13:57.119 2606-2606/? D/EventLogger: positionDiscontinuity
12:13:57.120 2606-2606/? D/EventLogger: state [0.02, true, I]
12:13:57.139 2606-2606/? D/EventLogger: state [0.04, true, B]
12:13:57.269 2606-2606/? D/EventLogger: sourceInfo [periodCount=1, windowCount=1
12:13:57.270 2606-2606/? D/EventLogger:   period [7066.70]
12:13:57.270 2606-2606/? D/EventLogger:   window [7066.70, true, false]
12:13:57.270 2606-2606/? D/EventLogger: ]
12:13:57.282 2606-2606/? D/EventLogger: loading [true]
12:13:57.365 2606-2790/? W/VideoCapabilities: Unrecognized profile/level 0/0 for video/mpeg2
12:13:57.365 2606-2790/? W/VideoCapabilities: Unrecognized profile/level 0/2 for video/mpeg2
12:13:57.365 2606-2790/? W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
12:13:57.387 2606-2790/? I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
12:13:57.405 2606-2606/? D/EventLogger: Tracks [
12:13:57.405 2606-2606/? D/EventLogger:   Renderer:0 [
12:13:57.405 2606-2606/? D/EventLogger:     Group:0, adaptive_supported=YES [
12:13:57.405 2606-2606/? D/EventLogger:       [X] Track:0, id=480p, mimeType=video/avc, bitrate=1462406, res=832x468, supported=YES
12:13:57.405 2606-2606/? D/EventLogger:       [X] Track:1, id=360p, mimeType=video/avc, bitrate=1120275, res=640x360, supported=YES
12:13:57.406 2606-2606/? D/EventLogger:       [X] Track:2, id=720p, mimeType=video/avc, bitrate=1796395, res=1280x720, supported=YES
12:13:57.406 2606-2606/? D/EventLogger:       [X] Track:3, id=240p, mimeType=video/avc, bitrate=416727, res=448x252, supported=YES
12:13:57.406 2606-2606/? D/EventLogger:       [X] Track:4, id=1080p, mimeType=video/avc, bitrate=3948743, res=1920x1080, supported=YES
12:13:57.406 2606-2606/? D/EventLogger:       [X] Track:5, id=320p, mimeType=video/avc, bitrate=814472, res=576x324, supported=YES
12:13:57.406 2606-2606/? D/EventLogger:     ]
12:13:57.406 2606-2606/? D/EventLogger:   ]
12:13:57.406 2606-2606/? D/EventLogger:   Renderer:1 [
12:13:57.406 2606-2606/? D/EventLogger:     Group:0, adaptive_supported=N/A [
12:13:57.407 2606-2606/? D/EventLogger:       [ ] Track:0, id=f/793608011, mimeType=audio/mp4a-latm, bitrate=200745, channels=2, sample_rate=44100, language=en-x-17, supported=YES
12:13:57.407 2606-2606/? D/EventLogger:     ]
12:13:57.407 2606-2606/? D/EventLogger:     Group:1, adaptive_supported=N/A [
12:13:57.407 2606-2606/? D/EventLogger:       [X] Track:0, id=f/793607981, mimeType=audio/mp4a-latm, bitrate=200852, channels=2, sample_rate=44100, language=ru-x-11, supported=YES
12:13:57.407 2606-2606/? D/EventLogger:     ]
12:13:57.407 2606-2606/? D/EventLogger:     Group:2, adaptive_supported=N/A [
12:13:57.407 2606-2606/? D/EventLogger:       [ ] Track:0, id=f/793608001, mimeType=audio/mp4a-latm, bitrate=200841, channels=2, sample_rate=44100, language=tr-x-38, supported=YES
12:13:57.407 2606-2606/? D/EventLogger:     ]
12:13:57.407 2606-2606/? D/EventLogger:     Group:3, adaptive_supported=N/A [
12:13:57.407 2606-2606/? D/EventLogger:       [ ] Track:0, id=f/793607991, mimeType=audio/mp4a-latm, bitrate=200847, channels=2, sample_rate=44100, language=uk-x-14, supported=YES
12:13:57.407 2606-2606/? D/EventLogger:     ]
12:13:57.407 2606-2606/? D/EventLogger:   ]
12:13:57.407 2606-2606/? D/EventLogger: ]
12:13:57.408 2606-2606/? D/EventLogger: videoEnabled [0.31]
12:13:57.408 2606-2606/? D/EventLogger: audioEnabled [0.31]
12:13:57.476 188-211/? I/WVCdm: CdmEngine::OpenSession
12:13:57.476 188-211/? I/WVCdm: Level3 Library 4464 Sep 10 2016 21:49:53
12:13:57.486 188-211/? D/libsep: lib_load():73: DEBUG - libsepdrm library initialized
12:13:57.492 188-211/? I/MDRMCommonUtils: read 0x1880, file_size 0x1880
12:13:57.497 188-211/? I/liboemcrypto: OEMCrypto_APIVersion called, supported v:11
12:13:57.497 188-211/? I/MDRMOemCrypto: Calling IsKeyboxValid
12:13:57.499 188-211/? I/MDRMOemCrypto: Drm_GetKeyBoxInfo returned res 0
12:13:57.499 188-211/? D/WVCdm: OEMCrypto_Initialize Level 1 success. I will use level 1.
12:13:57.500 188-211/? D/MDRMOemCrypto: Drm_GetRandom returned error code 0
12:13:57.504 188-211/? D/MDRMOemCrypto: Drm_GetRandom returned error code 0
12:13:57.504 188-211/? I/WVCdm: CdmEngine::QueryKeyControlInfo
12:13:57.517 188-1898/? E/Crypto: createCryptoFactory failed:No errors or unknown error
12:13:57.525 188-1898/? D/libsep: lib_load():86: DEBUG - libprhal library initialized
12:13:57.527 188-1898/? D/PlayReadyCryptoFactory: createCryptoFactory >>
12:13:57.528 188-1898/? E/Crypto: createCryptoFactory failed:No errors or unknown error
12:13:57.528 188-1898/? D/libsep: lib_unload():69: DEBUG - libprhal library unloading
12:13:57.528 188-1898/? D/libsep: lib_unload():74: DEBUG - libprhal library unloaded
12:13:57.531 188-188/? I/WVCdm: CdmEngine::GenerateKeyRequest
12:13:57.532 188-188/? D/MDRMOemCrypto: Calling GetDeviceID
12:13:57.533 188-188/? I/MDRMOemCrypto: extracted deviceID FUGU_T45COVQG_00013B24, res 0
12:13:57.534 188-188/? I/liboemcrypto: OEMCrypto_APIVersion called, supported v:11
12:13:57.535 188-188/? D/WVCdm: PrepareKeyRequest: nonce=636292161
12:13:57.679 188-211/? I/WVCdm: CdmEngine::QuerySessionStatus
12:13:57.705 191-631/? I/MediaPlayerService: MediaPlayerService::getOMX
12:13:57.707 2606-2798/? I/OMXClient: MuxOMX ctor
12:13:57.713 191-191/? I/OMXMaster: makeComponentInstance(OMX.Intel.VideoDecoder.AVC.secure) in mediaserver process
12:13:57.715 191-191/? E/ISVProfile: static int32_t ISVProfile::getGlobalStatus(): failed to open file /data/user/0/com.intel.vpp/shared_prefs/vpp_settings.xml
12:13:57.729 191-191/? I/cmodule: module libOMXVideoDecoderAVCSecure.so successfully loaded
12:13:57.730 191-191/? D/libsep: lib_load():73: DEBUG - libsepdrm library initialized
12:13:57.730 191-191/? I/VideoDecoder: Parser Type = 5
12:13:57.731 191-191/? I/componentbase: OMX.Intel.VideoDecoder.AVC.secure: set working role video_decoder.avc:
12:13:57.731 191-191/? I/wrs-omxil-core: get handle of component OMX.Intel.VideoDecoder.AVC.secure successfully
12:13:57.758 2606-2797/? I/MediaCodec: [OMX.Intel.VideoDecoder.AVC.secure] setting surface generation to 2668545
12:13:57.759 191-217/? I/componentbase: OMX.Intel.VideoDecoder.AVC.secure: set working role video_decoder.avc:
12:13:57.759 191-709/? I/OMXVideoDecoder: We are in meta data mode!!!
12:13:57.762 191-191/? W/portbase: Input port size has been changed!
12:13:57.763 191-710/? E/OMXNodeInstance: getConfig(bf0004:Intel.Decoder.AVC.secure, ConfigCommonOutputCrop(0x700000f)) ERROR: FormatNotDetected(0x80001020)
12:13:57.777 191-709/? W/OMXVideoDecoderAVCSecure: MemAllocDataBuffer: size of memory to allocate is 1566720, but will allocate 1560624
12:13:57.778 191-217/? W/OMXVideoDecoderAVCSecure: MemAllocDataBuffer: size of memory to allocate is 1566720, but will allocate 1560624
12:13:57.779 191-631/? W/OMXVideoDecoderAVCSecure: MemAllocDataBuffer: size of memory to allocate is 1566720, but will allocate 1560624
12:13:57.779 191-710/? W/OMXVideoDecoderAVCSecure: MemAllocDataBuffer: size of memory to allocate is 1566720, but will allocate 1560624
12:13:57.779 191-191/? W/OMXVideoDecoderAVCSecure: MemAllocDataBuffer: size of memory to allocate is 1566720, but will allocate 1560624
12:13:57.781 2606-2798/? D/SurfaceUtils: set up nativeWindow 0xce8fd808 for 448x252, color 0x7fa00e00, rotation 0, usage 0x6922
12:13:57.792 2606-2606/? D/EventLogger: videoDecoderInitialized [0.69, OMX.Intel.VideoDecoder.AVC.secure]
12:13:57.792 2606-2606/? D/EventLogger: videoFormatChanged [0.70, id=240p, mimeType=video/avc, bitrate=416727, res=448x252]
12:13:57.796 191-2799/? I/VideoDecoder: mParserType = 5
12:13:57.799 191-2799/? W/VideoDecoder: No config data to start VA.
12:13:57.800 191-2799/? D/componentbase: OMX.Intel.VideoDecoder.AVC.secure:video_decoder.avc: transition from OMX_StateLoaded to OMX_StateIdle completed
12:13:57.801 191-2799/? D/componentbase: OMX.Intel.VideoDecoder.AVC.secure:video_decoder.avc: transition from OMX_StateIdle to OMX_StateExecuting completed
12:13:57.809 191-2802/? I/OMXVideoDecoder: Buffer has OMX_BUFFERFLAG_CODECCONFIG flag.
12:13:57.809 191-2802/? I/OMXVideoDecoderAVCSecure: Received AVC codec data.
12:13:57.809 191-2802/? W/VideoDecoder: Can't start VA as either SPS or PPS is still not available.
12:13:57.812 191-2802/? I/OMXVideoDecoder: Buffer has OMX_BUFFERFLAG_CODECCONFIG flag.
12:13:57.812 191-2802/? I/OMXVideoDecoderAVCSecure: Received AVC codec data.
12:13:57.812 191-2802/? I/VideoDecoder: maxDPBSize = 17, num_ref_frame = 1
12:13:57.812 191-2802/? I/VideoDecoder: updateFormatInfo: current size: 448 x 252, new size: 448 x 252
12:13:57.812 191-2802/? I/VideoDecoder: Cropping: left = 0, top = 0, right = 0, bottom = 4
12:13:57.812 191-2802/? I/VideoDecoder: actualBufferNeeded =21
12:13:57.812 191-2802/? I/VideoDecoder: set colorMatrix: 0x0 
12:13:57.812 191-2802/? E/VideoDecoder: Failed to set colorMatrix.
12:13:57.812 191-2802/? I/VideoDecoder: set videoRange: 0 
12:13:57.812 191-2802/? E/VideoDecoder: Failed to set videoRange.
12:13:57.812 191-2802/? I/libva: VA-API version 0.34.0
12:13:57.814 191-2802/? I/libva: va_getDriverName() returns 0
12:13:57.814 191-2802/? I/libva: Trying to open /system/lib/pvr_drv_video.so
12:13:57.815 191-2802/? I/libva: Found init function __vaDriverInit_0_32
12:13:57.814 2802-2802/? W/IntelHwCodec: type=1400 audit(0.0:45): avc: denied { search } for name="graphics" dev="tmpfs" ino=12654 scontext=u:r:mediaserver:s0 tcontext=u:object_r:graphics_device:s0 tclass=dir permissive=0
12:13:57.817 191-2802/? I/libva: va_openDriver() returns 0
12:13:57.817 191-2802/? I/VideoDecoder: set colorMatrix: 0x0 
12:13:57.817 191-2802/? I/VideoDecoder: set videoRange: 0 
12:13:57.817 191-2802/? W/VideoDecoder: Surface is protected.
12:13:57.818 191-2802/? E/pvr_drv_video: CreateContext config_id:16777216, pic_w:448, pic_h:252, flag:0, num_render_targets:21, render_targets: 0x0.
12:13:57.819 191-217/? I/MediaPlayerService: MediaPlayerService::getOMX
12:13:57.820 2606-2803/? I/OMXClient: MuxOMX ctor
12:13:57.820 191-2802/? W/VideoDecoder: Surface is protected.
12:13:57.821 191-2802/? W/pvr_drv_video: int gralloc_lock(buffer_handle_t, int, int, int, int, int, void **): gralloc module has not been initialized. Should initialize it first
12:13:57.821 187-785/? I/OMXMaster: makeComponentInstance(OMX.google.aac.decoder) in mediacodec process
12:13:57.821 191-2802/? D/pvr_drv_video: hw_get_module returned
12:13:57.821 191-2802/? W/VideoDecoder: Surface is protected.
12:13:57.822 191-2802/? I/VideoDecoder: updateFormatInfo: current size: 448 x 252, new size: 448 x 252
12:13:57.822 191-2802/? I/VideoDecoder: Cropping: left = 0, top = 0, right = 0, bottom = 4
12:13:57.822 191-2802/? I/VideoDecoder: actualBufferNeeded =21
12:13:57.822 191-2802/? I/VideoDecoder: set colorMatrix: 0x0 
12:13:57.822 191-2802/? I/VideoDecoder: set videoRange: 0 
12:13:57.823 191-2802/? I/VideoDecoder: No slice available for decoding.
12:13:57.852 2606-2606/? D/EventLogger: audioDecoderInitialized [0.75, OMX.google.aac.decoder]
12:13:57.853 2606-2606/? D/EventLogger: audioFormatChanged [0.76, id=f/793607981, mimeType=audio/mp4a-latm, bitrate=200852, channels=2, sample_rate=44100, language=rus]
12:13:57.905 188-188/? I/WVCdm: CdmEngine::AddKey
12:13:58.059 2606-2606/? D/EventLogger: drmKeysLoaded [0.96]
12:13:58.064 191-191/? W/VideoDecoder: Surface is protected.
12:13:58.069 191-2801/? W/VideoDecoder: Surface is protected.
12:13:58.072 191-217/? W/VideoDecoder: Surface is protected.
12:13:58.076 191-2801/? W/VideoDecoder: Surface is protected.
12:13:58.079 191-217/? W/VideoDecoder: Surface is protected.
12:13:58.081 187-2804/? I/SoftAAC2: Reconfiguring decoder: 0->44100 Hz, 0->2 channels
12:13:58.098 2606-2798/? W/ACodec: [OMX.Intel.VideoDecoder.AVC.secure] BAD CODEC: Output format changed unexpectedly from (diff) AMessage(what = 0x00000000) = {
                                               Rect crop(0, 0, 447, 251)
                                             } to (diff) AMessage(what = 0x00000000) = {
                                               Rect crop(0, 0, 447, 247)
                                             }
12:13:58.118 191-631/? W/VideoDecoder: Surface is protected.
12:13:58.121 191-191/? W/VideoDecoder: Surface is protected.
12:13:58.125 191-631/? W/VideoDecoder: Surface is protected.
12:13:58.130 191-191/? W/VideoDecoder: Surface is protected.
12:13:58.132 191-631/? W/VideoDecoder: Surface is protected.
12:13:58.138 191-709/? W/VideoDecoder: Surface is protected.
12:13:58.144 191-631/? W/VideoDecoder: Surface is protected.
12:13:58.149 191-709/? W/VideoDecoder: Surface is protected.
12:13:58.152 191-710/? W/VideoDecoder: Surface is protected.
12:13:58.155 191-709/? W/VideoDecoder: Surface is protected.
12:13:58.747 191-2801/? W/VideoDecoder: Surface is protected.
12:13:58.754 174-174/? D/hwcomposer: virtual bool android::intel::OverlayPlaneBase::assignToDevice(int): overlay 0 switched from 0 to 1
12:13:58.754 174-174/? D/hwcomposer: virtual bool android::intel::AnnOverlayPlane::flush(uint32_t): disabling overlay 0 on device 0
12:13:58.841 2606-2606/? D/EventLogger: state [1.75, true, R]
12:13:58.844 191-217/? W/VideoDecoder: Surface is protected.
12:13:59.324 2606-2790/? D/AudioTrack: Client defaulted notificationFrames to 3776 for frameCount 11328
12:13:59.325 2606-2606/? D/EventLogger: audioSessionId [113]
12:13:59.427 191-2801/? W/VideoDecoder: Surface is protected.
12:13:59.811 2606-2611/? I/art: Do full code cache collection, code=495KB, data=399KB
12:13:59.812 2606-2611/? I/art: Starting a blocking GC JitCodeCache
12:13:59.812 2606-2611/? I/art: After code cache collection, code=423KB, data=315KB
12:14:01.690 2606-2606/? D/EventLogger: loading [false]
12:14:11.533 2606-2606/? D/EventLogger: videoFormatChanged [14.44, id=1080p, mimeType=video/avc, bitrate=3948743, res=1920x1080]
12:14:11.536 188-188/? W/MDRMOemCrypto: duplicate SPS NALU (skipping)
12:14:11.536 188-188/? E/MDRMOemCrypto: ERROR: multiple PPS NALUs (not supported by video decoder)
12:14:11.536 188-188/? E/MDRMOemCrypto: Failed to process subsamples
12:14:11.536 188-188/? E/WVCdm: Decrypt error result in session sid10 during encrypted block: 178
12:14:11.546 2606-2790/? E/ExoPlayerImplInternal: Renderer error.
                                                        com.google.android.exoplayer2.ExoPlaybackException
                                                            at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:666)
                                                            at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:485)
                                                            at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479)
                                                            at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:315)
                                                            at android.os.Handler.dispatchMessage(Handler.java:98)
                                                            at android.os.Looper.loop(Looper.java:154)
                                                            at android.os.HandlerThread.run(HandlerThread.java:61)
                                                            at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
                                                         Caused by: android.media.MediaCodec$CryptoException: Error decrypting data: unspecified error
                                                            at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
                                                            at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2480)
                                                            at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:657)
                                                            at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:485) 
                                                            at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479) 
                                                            at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:315) 
                                                            at android.os.Handler.dispatchMessage(Handler.java:98) 
                                                            at android.os.Looper.loop(Looper.java:154) 
                                                            at android.os.HandlerThread.run(HandlerThread.java:61) 
                                                            at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40) 
12:14:11.548 191-2799/? I/OMXVideoDecoder: Flushing port# 4294967295.
12:14:11.548 191-2799/? W/OMXVideoDecoder: Flushing video pipeline.
12:14:11.554 191-2799/? D/componentbase: OMX.Intel.VideoDecoder.AVC.secure:video_decoder.avc: transition from OMX_StateExecuting to OMX_StateIdle completed
12:14:11.566 2606-2798/? D/SurfaceUtils: set up nativeWindow 0xce8fd808 for 1x1, color 0x2, rotation 0, usage 0x930
12:14:11.597 174-174/? D/hwcomposer: virtual bool android::intel::OverlayPlaneBase::isDisabled(): overlay 0 status ENABLED on device 1, current device 1
12:14:11.645 191-2799/? I/OMXVideoDecoderAVCSecure: Calling Drm_DestroySession.
12:14:11.646 191-2799/? D/componentbase: OMX.Intel.VideoDecoder.AVC.secure:video_decoder.avc: transition from OMX_StateIdle to OMX_StateLoaded completed
12:14:11.657 191-2801/? I/OMXVideoDecoderAVCSecure: OMXVideoDecoderAVCSecure is destructed.
12:14:11.658 191-2801/? D/libsep: lib_unload():54: DEBUG - libsepdrm library unloading
12:14:11.658 191-2801/? D/libsep: lib_unload():61: DEBUG - libsepdrm library unloaded
12:14:11.658 191-2801/? I/VideoDecoder: Deleting decoder for video/avc-secure
12:14:11.658 191-2801/? I/cmodule: module libOMXVideoDecoderAVCSecure.so successfully unloaded
12:14:11.658 191-2801/? I/wrs-omxil-core: free handle of component OMX.Intel.VideoDecoder.AVC.secure successfully
12:14:11.669 188-211/? I/WVCdm: CdmEngine::CloseSession
12:14:11.671 188-211/? D/libsep: lib_unload():54: DEBUG - libsepdrm library unloading
12:14:11.671 188-211/? D/libsep: lib_unload():61: DEBUG - libsepdrm library unloaded
12:14:11.681 2606-2606/? E/EventLogger: playerFailed [14.58]
                                              com.google.android.exoplayer2.ExoPlaybackException
                                                  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:666)
                                                  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:485)
                                                  at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479)
                                                  at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:315)
                                                  at android.os.Handler.dispatchMessage(Handler.java:98)
                                                  at android.os.Looper.loop(Looper.java:154)
                                                  at android.os.HandlerThread.run(HandlerThread.java:61)
                                                  at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
                                               Caused by: android.media.MediaCodec$CryptoException: Error decrypting data: unspecified error
                                                  at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
                                                  at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2480)
                                                  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:657)
                                                  at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:485) 
                                                  at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:479) 
                                                  at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:315) 
                                                  at android.os.Handler.dispatchMessage(Handler.java:98) 
                                                  at android.os.Looper.loop(Looper.java:154) 
                                                  at android.os.HandlerThread.run(HandlerThread.java:61) 
                                                  at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40) 
12:14:11.682 2606-2606/? D/EventLogger: videoDisabled [14.59]
12:14:11.682 2606-2606/? D/EventLogger: audioDisabled [14.59]

bugreport-NMF26J-2016-12-23-12-54-24.zip

@andrewlewis

This comment has been minimized.

Copy link
Contributor

andrewlewis commented Dec 23, 2016

Yes, the lines

W/MDRMOemCrypto: duplicate SPS NALU (skipping)
E/MDRMOemCrypto: ERROR: multiple PPS NALUs (not supported by video decoder)

are suspicious and suggest that this decoder is not handling the adaptation SPS/PPSs correctly. Are you able to provide a link to the content (here or emailed to dev.exoplayer@gmail.com), or at least the clear subsamples with those NAL units?

@akavrt

This comment has been minimized.

Copy link
Author

akavrt commented Dec 23, 2016

@andrewlewis Thanks for the quick response. I need to talk to our CDN team to find out what would be the best and easiest way to share these samples with you, guys. I will send more information on the aforementioned e-mail next week.

@akavrt

This comment has been minimized.

Copy link
Author

akavrt commented Dec 26, 2016

@andrewlewis I've sent links to the content to dev.exoplayer@gmail.com

@linhai326

This comment has been minimized.

Copy link

linhai326 commented Jan 4, 2017

we experienced the exactly same issue on Nexus Player. Any update?

@akavrt

This comment has been minimized.

Copy link
Author

akavrt commented Jan 19, 2017

@andrewlewis Do you have any plans to fixing this issue any time soon? I'm thinking about adding another 'workaround'-like temporary fix to MediaCodecRenderer based on decoder name which will affect only Nexus Player devices. The media samples that I sent to dev.exoplayer@gmail.com last month are still working.

@ojw28

This comment has been minimized.

Copy link
Contributor

ojw28 commented Jan 19, 2017

@akavrt Are you in control of the encoding for these streams (or do you have a contact of someone who is)? Whilst I would expect most decoders to handle this case, it does seem that the video streams are invalid in that they appear to be mixing avc1 and avc3 together. One of the following should be true:

  1. A stream should claim that it's avc1, include SPS/PPS units in the init segment and not in the media segments.
  2. A stream should claim that it's avc3, not include SPS/PPS units in the init segment, and prepend it in the media segments instead.

The problematic streams claim to be avc1, include SPS/PPS data in the init segment, but also prepend it in the media segments as well, which is why duplicate SPS/PPS units are being submitted to the decoder. I don't think this is valid.

@ojw28 ojw28 added question and removed need more info labels Jan 19, 2017

@akavrt

This comment has been minimized.

Copy link
Author

akavrt commented Jan 19, 2017

@ojw28 Thanks a lot for quick response!

Are you in control of the encoding for these streams.

Yes, to some extent. As I have mentioned in the e-mail, the guy from our CDN team told me that those assets were encrypted using Bento4's mp4encrypt tool. I will forward your clarifying comments to them for further investigation.

@ojw28

This comment has been minimized.

Copy link
Contributor

ojw28 commented Jan 19, 2017

I think not in point (2) above should probably be may optionally. In which case your streams would likely be valid if they claimed to be avc3 rather than avc1. We'd still fail to play the content on Nexus Player if the streams claimed to be avc3, but I think it would become trivial for us to fix in that case. It still seems preferable to not include SPS/PPS in both places, however.

If you have a way to reliably know when you're going to be playing an asset with this issue, a quick fix for the failure is to delete this line to drop the SPS/PPS in the init segment and therefore remove the duplication. Note that this will break playback of correctly generated avc1 streams, so you should only do this for assets that you know definitely have the issue.

Please do report back any findings from the CDN team. Thanks!

@akavrt

This comment has been minimized.

Copy link
Author

akavrt commented Jan 19, 2017

@ojw28 Thanks for your hint! I will report back as soon as new information becomes available.

@mchelnokov

This comment has been minimized.

Copy link

mchelnokov commented Jan 23, 2017

@ojw28 Thanks for your replies.

Please do report back any findings from the CDN team.

We confirm that our streams are AVC1 and they don't contain SPS/PPS duplicates. The problem appears during adaptive reconfiguration only, no problems with any stream played alone. Obviously, the duplicates are generated by MediaCodecRenderer.feedInputBuffer:

https://github.com/google/ExoPlayer/blob/release-v2/library/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java#L582-L585

May be that copying of initialization data should be omitted for AVC1 streams?

@ojw28

This comment has been minimized.

Copy link
Contributor

ojw28 commented Jan 23, 2017

As per my response above, an avc1 stream should include SPS/PPS units in the init segment and not in the media segments. Your streams contain SPS/PPS in both the init segment and in the media segments, which is not correct.

The player prefixes the SPS/PPS from the init segment onto the media segment when an adaptive switch because that's the correct thing to do for avc1, because SPS/PPS is not expected to already be prefixed in the media segment itself. This is why the duplication occurs.

If your streams are avc1, the correct fix is to remove SPS/PPS from the start of the media segments.

@ojw28 ojw28 added the wont fix label Jan 23, 2017

@mchelnokov

This comment has been minimized.

Copy link

mchelnokov commented Jan 23, 2017

Well, looks like right now we don't have a tool to dump NAL units from protected stream, so lets assume that the media segments have unexpected SPS/PPS info. The same unprotected streams don't cause the problem. There is some probability that encryption utility adds this excess info.
Just to curious, how the avc1 decoder receives SPS/PPS info when no adaptation switch occurs?
I just checked, the code
https://github.com/google/ExoPlayer/blob/release-v2/library/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java#L582-L585
isn't called then, so SPS/PPS info is provided for the decoder somewhere else.

@ojw28

This comment has been minimized.

Copy link
Contributor

ojw28 commented Jan 23, 2017

It's possible the encryption tool is adding them, yes. Unless you know otherwise, it's also possible that the original streams are avc3 and that the encryption tool is incorrectly transforming the avc3 box into an encv->avc1 box rather than an encv->avc3 box.

The initial SPS/PPS is passed in the MediaFormat that gets passed to codec.configure in MediaCodecVideoRenderer.configureCodec (and if no adaptation switch occurs it's not necessary to send it again).

@mchelnokov

This comment has been minimized.

Copy link

mchelnokov commented Jan 23, 2017

Sure, our fragmentation/encryption process needs further examination.
As per providing SPS/PPS info from init segment in MediaCodecVideoRenderer.configureCodec, why then our excess SPS/PPS info from media segments doesn't cause the problem?

@ojw28

This comment has been minimized.

Copy link
Contributor

ojw28 commented Jan 23, 2017

The excess SPS/PPS in the media segments are precisely what is causing the problem?

@ojw28

This comment has been minimized.

Copy link
Contributor

ojw28 commented Jan 23, 2017

If you mean why doesn't failure occur right at the start of playback, when the decoder receives SPS/PPS via configureCodec and also at the start of the first media segment, then my guess would be that the SPS/PPS that's pushed in via configureCodec is submitted in a separate initialization buffer.

@ojw28 ojw28 closed this Mar 13, 2017

@google google locked and limited conversation to collaborators Jul 12, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.