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

Issue 595545 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jun 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug

Blocking:
issue 597467



Sign in to add a comment

AVDA fails to instantiate a new MediaCodec when exiting fullscreen on a Galaxy Nexus

Project Member Reported by w...@chromium.org, Mar 17 2016

Issue description

From logcat:

03-16 18:58:34.473  3177  3194 E cr_media: Cannot configure the video codec
03-16 18:58:34.473  3177  3194 E cr_media: java.lang.IllegalStateException
03-16 18:58:34.473  3177  3194 E cr_media:      at android.media.MediaCodec.native_configure(Native Method)
03-16 18:58:34.473  3177  3194 E cr_media:      at android.media.MediaCodec.configure(MediaCodec.java:257)
03-16 18:58:34.473  3177  3194 E cr_media:      at org.chromium.media.MediaCodecBridge.configureVideo(MediaCodecBridge.java:459)
03-16 18:58:34.473  3177  3194 E cr_media:      at org.chromium.content.app.ContentMain.nativeStart(Native Method)
03-16 18:58:34.473  3177  3194 E cr_media:      at org.chromium.content.app.ContentMain.start(ContentMain.java:25)
03-16 18:58:34.473  3177  3194 E cr_media:      at org.chromium.content.app.ChildProcessService$2.run(ChildProcessService.java:197)
03-16 18:58:34.473  3177  3194 E cr_media:      at java.lang.Thread.run(Thread.java:856)
03-16 18:58:34.473  3177  3194 W cr_media: calling MediaCodec.release()
03-16 18:58:34.473  3177  3194 E chromium: [ERROR:android_video_decode_accelerator.cc(890)] Failed to create MediaCodec instance.

 
Cc: qin...@chromium.org ti...@chromium.org
That's surprising. Is there a second MediaCodec active at that time? Or is only one active? I'd guess only one since on exit the other should have been released?

Comment 2 by ti...@chromium.org, Mar 17 2016

Why are we calling configure() in this situation? Are we recreating MediaCodec?
Then, do we delete the first before creating the second?

Comment 3 by w...@chromium.org, Mar 17 2016

Yeah, there should only be one active. I'll verify.

timav: fullscreen transitions result in destructing and recreating a new AVDA (and MediaCodec) to switch the output surface. And we do delete the first before creating the second.

Comment 4 by ti...@chromium.org, Mar 17 2016

Thank you. I thought with Spitzer we are using the same SurfaceTexture for both regular and fullscreen.

Comment 5 by w...@chromium.org, Mar 17 2016

Luckily, it looks like this isn't actually the problem I thought it was. It's not when we're creating the new AVDA, but while we're shutting down the first one. AVDA::Reset gets called, and on JB, it tries to create a new MediaCodec. Since the fullscreen surface is no longer valid, it fails to create it.

I think the fix is to lazily instantiate the replacement MediaCodec after a Reset.

Comment 6 by w...@chromium.org, Mar 18 2016

Owner: w...@chromium.org
Status: Started (was: Available)
if there happens to be a decode (for example) that arrives after we lose the surface, which causes us to re-init the codec, might we not hit the same problem?

once we lose the surface, perhaps we shouldn't try to get the codec back at all until a restart.  alternatively, we should forget that we ever had a surface once we lose it, but that's harder to get right since the strategy has to be involved.

Comment 8 by w...@chromium.org, Mar 18 2016

I think decodes after we lose the surface will be okay if we defer the error notification. Reset doesn't defer right now.

We still haven't plumbed the surfaceDestroyed callback though, so we don't know that the surface is lost on the VDA side. (I'll create a bug for this). 
Project Member

Comment 9 by bugdroid1@chromium.org, Mar 21 2016

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

commit 9edddb9ded49023460a204675ee4e9bb763b9da7
Author: watk <watk@chromium.org>
Date: Mon Mar 21 22:21:10 2016

media: Stop flushing the renderer for pipeline suspend

Previously when performing a pipeline suspend we would flush the
renderer before destructing it. This CL removes the flush because
it's no longer necessary and has issues:
1) it adds ~100-150ms to suspend on a Galaxy Nexus (which makes
   a difference for fullscreen transitions), and
2) on <API level 18 devices it will cause AVDA to go into an
   error state when it handles the flush by creating a new
   MediaCodec without a valid output surface.

BUG= 596641 , 595545 
TEST=media_unittests

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

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

[modify] https://crrev.com/9edddb9ded49023460a204675ee4e9bb763b9da7/media/base/pipeline_impl.cc
[modify] https://crrev.com/9edddb9ded49023460a204675ee4e9bb763b9da7/media/base/pipeline_impl_unittest.cc

Comment 10 by w...@chromium.org, Mar 21 2016

Labels: Merge-Request-50

Comment 11 by tin...@google.com, Mar 21 2016

Labels: -Merge-Request-50 Merge-Approved-50 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M50 (branch: 2661)

Comment 12 by w...@chromium.org, Mar 24 2016

Blocking: 597467

Comment 13 by amin...@google.com, Mar 28 2016

[Bulk Edit]

This bug has been approved for merge to M50, but according to our records, the merge has not been processed yet.  If this bug has been merged, please remove the Merge-Approved-50 label.  If it has not, please merge ASAP.

Comment 14 by w...@chromium.org, Mar 28 2016

Labels: -Merge-Approved-50 -Hotlist-Merge-Approved
I reverted this change and won't be trying to resubmit it for M50. We may go a different route to solve this problem though. If so, I'll request another merge.

Comment 15 by w...@chromium.org, Jun 25 2016

Status: Fixed (was: Started)

Sign in to add a comment