Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Issue 2084143002: Make AVDA fall back to software decoding if needed. (Closed)

Created:
4 years, 6 months ago by liberato (no reviews please)
Modified:
4 years, 6 months ago
Reviewers:
watk, DaleCurtis
CC:
avayvod+watch_chromium.org, chromium-reviews, feature-media-reviews_chromium.org, mlamouri+watch-media_chromium.org, piman+watch_chromium.org, posciak+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make AVDA fall back to software decoding if needed. Android MediaCodec creation will sometimes never come back. On a N7 (2013) with Lollipop, this can happens when an attempt to allocate a hardware codec fails, and falls back to a software codec. Once mediaserver gets into a bad state, future attempts to create a hardware codec will hang. As a result, no additional AVDA instances will get codecs. Further, destroying any of them will hang the gpu process when it tries to join the thread that handles construction. This CL does several things: - Don't join the construction thread if there are outstanding MediaCodec creations on it. While this may sometimes not shut down the thread if the AVDA is destroyed while the creation is pending (and would return if we just waited a bit longer), the thread will be shut down the next time an AVDA instance is destroyed. It isn't leaked permanently. - Fall back to requesting a software codec if we believe that construction of a hardware codec is hung. We don't attempt to salvage the AVDA instance(s) that have pending HW codecs, but future AVDA instances will fall back to software. If those HW codecs are eventually allocated, then we will start requesting HW codecs again. For example, if we simply time out too quickly, or if mediaserver is restarted, then we can try for hardware codecs for future AVDA instances. - Release hardware codecs on a separate thread, since that can hang too if mediaserver is in a bad state. BUG=613238 Committed: https://crrev.com/6cc255e4585bfae626a5cf00a3e4b08a428cbeb5 Cr-Commit-Position: refs/heads/master@{#401691}

Patch Set 1 #

Total comments: 1

Patch Set 2 : symbolic constants, coments. #

Total comments: 12

Patch Set 3 : removed backup thread, defer release to construction thread #

Total comments: 11

Patch Set 4 : changed _l to auto_lock #

Total comments: 19

Patch Set 5 : cl feedback. #

Patch Set 6 : cl feedback. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+205 lines, -41 lines) Patch
M media/base/android/java/src/org/chromium/media/MediaCodecBridge.java View 1 2 4 chunks +19 lines, -3 lines 0 comments Download
M media/base/android/java/src/org/chromium/media/MediaCodecUtil.java View 1 2 6 chunks +34 lines, -6 lines 0 comments Download
M media/base/android/media_codec_bridge.h View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M media/base/android/media_codec_util.cc View 1 2 3 4 2 chunks +6 lines, -3 lines 0 comments Download
M media/base/android/ndk_media_codec_bridge.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M media/base/android/ndk_media_codec_bridge.cc View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download
M media/base/android/sdk_media_codec_bridge.h View 1 2 3 4 3 chunks +7 lines, -4 lines 0 comments Download
M media/base/android/sdk_media_codec_bridge.cc View 1 2 3 4 7 chunks +23 lines, -16 lines 0 comments Download
M media/gpu/android_video_decode_accelerator.h View 1 chunk +8 lines, -0 lines 0 comments Download
M media/gpu/android_video_decode_accelerator.cc View 1 2 3 4 5 9 chunks +98 lines, -9 lines 0 comments Download

Messages

Total messages: 26 (7 generated)
liberato (no reviews please)
doesn't fix every crash, but i can refresh on my test page many more times ...
4 years, 6 months ago (2016-06-21 20:58:38 UTC) #3
DaleCurtis
https://codereview.chromium.org/2084143002/diff/20001/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java File media/base/android/java/src/org/chromium/media/MediaCodecUtil.java (right): https://codereview.chromium.org/2084143002/diff/20001/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java#newcode86 media/base/android/java/src/org/chromium/media/MediaCodecUtil.java:86: * @param requireSoftware Whether we require a software codec. ...
4 years, 6 months ago (2016-06-21 21:17:56 UTC) #4
liberato (no reviews please)
thanks for the comments. -fl https://codereview.chromium.org/2084143002/diff/20001/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java File media/base/android/java/src/org/chromium/media/MediaCodecUtil.java (right): https://codereview.chromium.org/2084143002/diff/20001/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java#newcode86 media/base/android/java/src/org/chromium/media/MediaCodecUtil.java:86: * @param requireSoftware Whether ...
4 years, 6 months ago (2016-06-22 17:56:13 UTC) #5
DaleCurtis
https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc File media/gpu/android_video_decode_accelerator.cc (right): https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc#newcode275 media/gpu/android_video_decode_accelerator.cc:275: base::AutoLock _l(autodetection_info_.lock_); Chose something other than _l :) https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc#newcode284 ...
4 years, 6 months ago (2016-06-22 19:13:49 UTC) #7
liberato (no reviews please)
https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc File media/gpu/android_video_decode_accelerator.cc (right): https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc#newcode275 media/gpu/android_video_decode_accelerator.cc:275: base::AutoLock _l(autodetection_info_.lock_); On 2016/06/22 19:13:49, DaleCurtis wrote: > Chose ...
4 years, 6 months ago (2016-06-22 20:44:12 UTC) #8
DaleCurtis
https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc File media/gpu/android_video_decode_accelerator.cc (right): https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc#newcode400 media/gpu/android_video_decode_accelerator.cc:400: // Data for determining if codec creation is hanging. ...
4 years, 6 months ago (2016-06-22 20:56:50 UTC) #9
liberato (no reviews please)
https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc File media/gpu/android_video_decode_accelerator.cc (right): https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc#newcode400 media/gpu/android_video_decode_accelerator.cc:400: // Data for determining if codec creation is hanging. ...
4 years, 6 months ago (2016-06-22 21:07:58 UTC) #10
DaleCurtis
https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc File media/gpu/android_video_decode_accelerator.cc (right): https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc#newcode400 media/gpu/android_video_decode_accelerator.cc:400: // Data for determining if codec creation is hanging. ...
4 years, 6 months ago (2016-06-22 21:11:50 UTC) #11
liberato (no reviews please)
https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc File media/gpu/android_video_decode_accelerator.cc (right): https://codereview.chromium.org/2084143002/diff/40001/media/gpu/android_video_decode_accelerator.cc#newcode400 media/gpu/android_video_decode_accelerator.cc:400: // Data for determining if codec creation is hanging. ...
4 years, 6 months ago (2016-06-22 21:13:28 UTC) #12
DaleCurtis
lgtm, i defer to you on whether you want to go back to the backup-thread. ...
4 years, 6 months ago (2016-06-22 21:20:11 UTC) #13
liberato (no reviews please)
two threads: for now, let's just use the main thread as you suggest. i doubt ...
4 years, 6 months ago (2016-06-22 21:43:55 UTC) #14
watk
https://codereview.chromium.org/2084143002/diff/60001/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java File media/base/android/java/src/org/chromium/media/MediaCodecUtil.java (right): https://codereview.chromium.org/2084143002/diff/60001/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java#newcode156 media/base/android/java/src/org/chromium/media/MediaCodecUtil.java:156: // TODO(liberato): Should we insist on software here? Hmm, ...
4 years, 6 months ago (2016-06-22 22:39:46 UTC) #15
watk
Nice CL btw! I'm happy we can work around this.
4 years, 6 months ago (2016-06-22 22:45:23 UTC) #16
watk
Nice CL btw! I'm happy we can work around this.
4 years, 6 months ago (2016-06-22 22:45:25 UTC) #17
liberato (no reviews please)
thanks for the comments. 'Configuration' and 'Autodetection' are the same lenght, so i just stuck ...
4 years, 6 months ago (2016-06-23 15:18:20 UTC) #18
watk
lgtm
4 years, 6 months ago (2016-06-23 18:36:00 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2084143002/100001
4 years, 6 months ago (2016-06-23 18:41:42 UTC) #22
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 6 months ago (2016-06-23 19:51:33 UTC) #24
commit-bot: I haz the power
4 years, 6 months ago (2016-06-23 19:53:51 UTC) #26
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/6cc255e4585bfae626a5cf00a3e4b08a428cbeb5
Cr-Commit-Position: refs/heads/master@{#401691}

Powered by Google App Engine
This is Rietveld 408576698