New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 605341 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Email to this user bounced
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

Uncaught exception in MediaCodecBridge::QueueSecureInputBuffer

Project Member Reported by xhw...@chromium.org, Apr 20 2016

Issue description

Chrome Version: M52 ToT
Device: Nexus 7 v2
OS: Android M

Steps to repro:
1. Go to youtube.com
2. Sign in
3. Request desktop site
4. Play a purchased content

04-20 16:44:15.623 19443 19460 W System.err: java.lang.IllegalArgumentException
04-20 16:44:15.623 19443 19460 W System.err:    at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
04-20 16:44:15.623 19443 19460 W System.err:    at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2292)
04-20 16:44:15.623 19443 19460 W System.err:    at org.chromium.media.MediaCodecBridge.queueSecureInputBuffer(MediaCodecBridge.java:378)
04-20 16:44:15.623 19443 19460 W System.err:    at org.chromium.content.app.ContentMain.nativeStart(Native Method)
04-20 16:44:15.623 19443 19460 W System.err:    at org.chromium.content.app.ContentMain.start(ContentMain.java:25)
04-20 16:44:15.623 19443 19460 W System.err:    at org.chromium.content.app.ChildProcessService$2.run(ChildProcessService.java:197)
04-20 16:44:15.623 19443 19460 W System.err:    at java.lang.Thread.run(Thread.java:818)

04-20 16:44:15.676 19443 19460 F chromium: [FATAL:jni_android.cc(233)] Check failed: false. Please include Java exception stack in crash report

04-20 16:44:15.811   192   192 F DEBUG   : backtrace:
04-20 16:44:15.811   192   192 F DEBUG   :     #00 pc 00041f60  /system/lib/libc.so (tgkill+12)
04-20 16:44:15.811   192   192 F DEBUG   :     #01 pc 0003faed  /system/lib/libc.so (pthread_kill+32)
04-20 16:44:15.811   192   192 F DEBUG   :     #02 pc 0001c30f  /system/lib/libc.so (raise+10)
04-20 16:44:15.811   192   192 F DEBUG   :     #03 pc 000194c1  /system/lib/libc.so (__libc_android_abort+34)
04-20 16:44:15.811   192   192 F DEBUG   :     #04 pc 000174ac  /system/lib/libc.so (abort+4)
04-20 16:44:15.811   192   192 F DEBUG   :     #05 pc 0006fd25  /data/app/org.chromium.chrome-1/lib/arm/libbase.cr.so (base::debug::BreakDebugger()+16)
04-20 16:44:15.812   192   192 F DEBUG   :     #06 pc 00080a67  /data/app/org.chromium.chrome-1/lib/arm/libbase.cr.so (logging::LogMessage::~LogMessage()+562)
04-20 16:44:15.812   192   192 F DEBUG   :     #07 pc 00065bc3  /data/app/org.chromium.chrome-1/lib/arm/libbase.cr.so (base::android::CheckException(_JNIEnv*)+114)
04-20 16:44:15.812   192   192 F DEBUG   :     #08 pc 00170d95  /data/app/org.chromium.chrome-1/lib/arm/libmedia.cr.so (media::SdkMediaCodecBridge::QueueSecureInputBuffer(int, unsigned char const*, unsigned int, std::__1::vector<char, std::__1::allocator<char> > const&, std::__1::vector<char, std::__1::allocator<char> > const&, media::SubsampleEntry const*, int, base::TimeDelta const&)+504)
04-20 16:44:15.812   192   192 F DEBUG   :     #09 pc 001579c5  /data/app/org.chromium.chrome-1/lib/arm/libmedia.cr.so (media::MediaCodecBridge::QueueSecureInputBuffer(int, unsigned char const*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<media::SubsampleEntry, std::__1::allocator<media::SubsampleEntry> > const&, base::TimeDelta const&)+124)
04-20 16:44:15.812   192   192 F DEBUG   :     #10 pc 000d8c49  /data/app/org.chromium.chrome-1/lib/arm/libmedia.cr.so (media::MediaCodecAudioDecoder::EnqueueInputBuffer(media::MediaCodecAudioDecoder::InputBufferInfo const&)+508)
04-20 16:44:15.812   192   192 F DEBUG   :     #11 pc 000d8ef9  /data/app/org.chromium.chrome-1/lib/arm/libmedia.cr.so (media::MediaCodecAudioDecoder::QueueOneInputBuffer()+120)
04-20 16:44:15.812   192   192 F DEBUG   :     #12 pc 000d901f  /data/app/org.chromium.chrome-1/lib/arm/libmedia.cr.so (media::MediaCodecAudioDecoder::QueueInput()+78)
04-20 16:44:15.812   192   192 F DEBUG   :     #13 pc 000da557  /data/app/org.chromium.chrome-1/lib/arm/libmedia.cr.so (media::MediaCodecAudioDecoder::DoIOTask()+10)
04-20 16:44:15.812   192   192 F DEBUG   :     #14 pc 000da8b3  /data/app/org.chromium.chrome-1/lib/arm/libmedia.cr.so (media::MediaCodecAudioDecoder::Decode(scoped_refptr<media::DecoderBuffer> const&, base::Callback<void (media::DecodeStatus), (base::internal::CopyMode)1> const&)+702)


 

Comment 1 by xhw...@chromium.org, Apr 21 2016

Here's the command line I use:

build/android/adb_chrome_public_command_line --disable-gesture-requirement-for-media-playback --allow-running-insecure-content --disable-fre --vmodule=*mojo_cdm*=3,*renderer_impl*=3,*pipeline*=3,*gpu_video*=3,*android_video_decode*=3,*webmediaplayer*=3,*mojo_audio*=3,*media_drm_bridge*=3,*media*player*=3,*media_permission*=3,*decoder_selector*=3,*provision*=3 --force-fieldtrials=UnifiedMediaPipelineTrial/Enabled

Comment 2 by ti...@chromium.org, Apr 21 2016

Android build version: MRA47

Comment 3 by ti...@chromium.org, Apr 21 2016

I was able to reproduce the problem on Nexus 6P with Android N (angler-userdebug N NRC84D 2714208 dev-keys)


Comment 4 by ti...@chromium.org, Apr 22 2016

I have the situation where my purchased playback starts at the middle.
To reproduce, I need to let it start playing and then scroll to the beginning.
In this case the pipeline sends the buffer which seems, indeed, invalid:

04-21 18:25:27.963 11146 11300 V timav   : [11146/11300] 18:25:27.963 MojoAudioDecoder::Decode timestamp: 0 duration: 23219 size: 378 side_data_size: 0 is_key_frame: 1 encrypted: 1 discard_padding (ms): (0, 0) decrypt:key_id:'31' iv:'' subsamples:[]

The 'decrypt' portion looks invalid, I'd expect key_id to be 16 bytes long
and in general look like other buffers, e.g.

MojoAudioDecoder::Decode timestamp: 4049978049 duration: 23219 size: 312 side_data_size: 0 is_key_frame: 1 encrypted: 1 discard_padding (ms): (0, 0) decrypt:key_id:'B9A125C2F1D35C818E0F489A97AEE97B' iv:'2DFABA86A2049AD00000000000000000' subsamples:[(clear:7, cypher:305)]

Comment 5 by xhw...@chromium.org, Apr 22 2016

Empty IV means the buffer is not encrypted:
https://code.google.com/p/chromium/codesearch#chromium/src/media/base/decrypt_config.h&l=46

This is common for Youtube where an encrypted stream has a clear start (unencrypted buffers) for a few seconds.

It seems that in MediaCodecAudioDecoder we are checking whether DecryptConfig is present, which is wrong:
https://code.google.com/p/chromium/codesearch#chromium/src/media/filters/android/media_codec_audio_decoder.cc&l=420

Instead we should check whether IV or KeyId is empty, the same as what we are doing in MediaDecoderJob:
https://code.google.com/p/chromium/codesearch#chromium/src/media/base/android/media_decoder_job.cc&l=278

That being said, I agree relying on empty IV to decide whether a buffer is encrypted isn't very intuitive. Maybe we should add a is_encrypted() method on DecoderBuffer.

Comment 6 by xhw...@chromium.org, Apr 22 2016

Labels: -Pri-2 Pri-1
Project Member

Comment 8 by bugdroid1@chromium.org, Apr 22 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/100cc77fa6654a0198561e6621f6bf10fa9adc3f

commit 100cc77fa6654a0198561e6621f6bf10fa9adc3f
Author: timav <timav@chromium.org>
Date: Fri Apr 22 20:41:20 2016

media: Properly tell whether the buffer is encrypted

We need to call MediaCodec method queueSecureInputBuffer()
instead of queueInputBuffer() only if both the key and the
initialization vector are not empty.

BUG= 605341 

Review URL: https://codereview.chromium.org/1912213002

Cr-Commit-Position: refs/heads/master@{#389229}

[modify] https://crrev.com/100cc77fa6654a0198561e6621f6bf10fa9adc3f/media/base/decrypt_config.h
[modify] https://crrev.com/100cc77fa6654a0198561e6621f6bf10fa9adc3f/media/filters/android/media_codec_audio_decoder.cc

Comment 9 by ti...@chromium.org, Apr 22 2016

Labels: Merge-Request-51

Comment 10 by tin...@google.com, Apr 22 2016

Labels: -Merge-Request-51 Merge-Approved-51 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M51 (branch: 2704)
Project Member

Comment 11 by bugdroid1@chromium.org, Apr 22 2016

Labels: -merge-approved-51 merge-merged-2704
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/90dcdd907a4050acb00d9c878dafc3402d7c347c

commit 90dcdd907a4050acb00d9c878dafc3402d7c347c
Author: Tima Vaisburd <timav@chromium.org>
Date: Fri Apr 22 21:35:49 2016

[Merged] media: Properly tell whether the buffer is encrypted

We need to call MediaCodec method queueSecureInputBuffer()
instead of queueInputBuffer() only if both the key and the
initialization vector are not empty.

BUG= 605341 
TBR=timav

> Review URL: https://codereview.chromium.org/1912213002

> Cr-Commit-Position: refs/heads/master@{#389229}

Review URL: https://codereview.chromium.org/1905423003 .

Cr-Commit-Position: refs/branch-heads/2704@{#196}
Cr-Branched-From: 6e53600def8f60d8c632fadc70d7c1939ccea347-refs/heads/master@{#386251}

[modify] https://crrev.com/90dcdd907a4050acb00d9c878dafc3402d7c347c/media/base/decrypt_config.h
[modify] https://crrev.com/90dcdd907a4050acb00d9c878dafc3402d7c347c/media/filters/android/media_codec_audio_decoder.cc

Comment 12 by ti...@chromium.org, Apr 22 2016

Status: Fixed (was: Available)

Sign in to add a comment