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

Issue 2629223003: media: Ensure MediaCodecs are released before attached SurfaceTextures (Closed)

Created:
3 years, 11 months ago by watk
Modified:
3 years, 11 months ago
CC:
chromium-reviews, feature-media-reviews_chromium.org, piman+watch_chromium.org, posciak+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

media: Ensure MediaCodecs are released before attached SurfaceTextures Previously AVDA would call SurfaceTexture#release() before calling MediaCodec#release(), but we are seeing crashes that indicate that MediaCodec doesn't handle this well. As a workaround, we now ensure the MediaCodec is released first. We don't always want to release both the surface and codec together. For example, for a Reset() AVDA might release its codec without releasing the surface. And then a Destroy() will want to release the surface without the MediaCodec. To make sure they can't race, we record the thread we last used to release a MediaCodec, so that when we release the SurfaceTexture we can hop it through the same thread. This change includes adding a new surface_texture member to CodecConfig. When we create a ST the field is populated and when tearing down AVDA it is released. UpdateSurface() ensures that either the surface transition works, in which case we can drop the ST ref and delete it safely, or if it fails the surface_texture field is left unmodified. BUG=679472 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Review-Url: https://codereview.chromium.org/2629223003 Cr-Commit-Position: refs/heads/master@{#444120} Committed: https://chromium.googlesource.com/chromium/src/+/4eece651a995828d5677e6231fe7af235084dd88

Patch Set 1 #

Total comments: 6

Patch Set 2 : dale's suggestion #

Patch Set 3 : more comments #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+59 lines, -37 lines) Patch
M media/gpu/android_video_decode_accelerator.h View 1 2 3 chunks +9 lines, -0 lines 0 comments Download
M media/gpu/android_video_decode_accelerator.cc View 1 2 7 chunks +36 lines, -23 lines 1 comment Download
M media/gpu/avda_codec_allocator.h View 1 3 chunks +7 lines, -3 lines 2 comments Download
M media/gpu/avda_picture_buffer_manager.h View 1 chunk +4 lines, -0 lines 0 comments Download
M media/gpu/avda_picture_buffer_manager.cc View 1 2 chunks +3 lines, -11 lines 0 comments Download

Messages

Total messages: 31 (14 generated)
watk
PTAL I hate this API.. but I don't want to devote effort to rethinking and ...
3 years, 11 months ago (2017-01-13 02:31:27 UTC) #3
liberato (no reviews please)
lgtm % nits. i'm going to have to revisit AVDASurfaceOwner, since i'm pretty sure it ...
3 years, 11 months ago (2017-01-13 17:22:04 UTC) #4
DaleCurtis
Can you elaborate on why it's insufficient to just always post the SurfaceTexture release during ...
3 years, 11 months ago (2017-01-13 20:37:14 UTC) #6
watk
On 2017/01/13 20:37:14, DaleCurtis wrote: > Can you elaborate on why it's insufficient to just ...
3 years, 11 months ago (2017-01-13 21:01:58 UTC) #7
liberato (no reviews please)
On 2017/01/13 21:01:58, watk wrote: > On 2017/01/13 20:37:14, DaleCurtis wrote: > > Can you ...
3 years, 11 months ago (2017-01-13 21:04:01 UTC) #8
DaleCurtis
If you expose AVDACodecAllocator::TaskRunnerFor() you don't need to trampoline both. It'll just trampoline through whatever ...
3 years, 11 months ago (2017-01-13 21:05:34 UTC) #9
DaleCurtis
On 2017/01/13 at 21:05:34, DaleCurtis wrote: > If you expose AVDACodecAllocator::TaskRunnerFor() you don't need to ...
3 years, 11 months ago (2017-01-13 21:06:04 UTC) #10
watk
On 2017/01/13 21:06:04, DaleCurtis wrote: > On 2017/01/13 at 21:05:34, DaleCurtis wrote: > > If ...
3 years, 11 months ago (2017-01-13 21:11:06 UTC) #11
watk
On 2017/01/13 21:11:06, watk wrote: > On 2017/01/13 21:06:04, DaleCurtis wrote: > > On 2017/01/13 ...
3 years, 11 months ago (2017-01-13 22:27:15 UTC) #12
watk
On 2017/01/13 22:27:15, watk wrote: > On 2017/01/13 21:11:06, watk wrote: > > On 2017/01/13 ...
3 years, 11 months ago (2017-01-13 22:44:55 UTC) #13
watk
Ok, talked to Dale offline and I get the suggestion now. We save the task_type ...
3 years, 11 months ago (2017-01-13 22:54:16 UTC) #14
watk
alrighty! PTAL https://codereview.chromium.org/2629223003/diff/1/media/gpu/android_video_decode_accelerator.cc File media/gpu/android_video_decode_accelerator.cc (right): https://codereview.chromium.org/2629223003/diff/1/media/gpu/android_video_decode_accelerator.cc#newcode1149 media/gpu/android_video_decode_accelerator.cc:1149: picture_buffer_manager_.surface_texture().get()); On 2017/01/13 17:22:04, liberato wrote: > ...
3 years, 11 months ago (2017-01-14 01:01:04 UTC) #19
DaleCurtis
lgtm, thanks! we could limit to KK if you want it looks like, but I'm ...
3 years, 11 months ago (2017-01-14 01:12:25 UTC) #20
liberato (no reviews please)
lgtm % question. https://codereview.chromium.org/2629223003/diff/80001/media/gpu/avda_codec_allocator.h File media/gpu/avda_codec_allocator.h (right): https://codereview.chromium.org/2629223003/diff/80001/media/gpu/avda_codec_allocator.h#newcode59 media/gpu/avda_codec_allocator.h:59: scoped_refptr<gl::SurfaceTexture> surface_texture; is this used?
3 years, 11 months ago (2017-01-17 18:58:24 UTC) #25
watk
Thanks! https://codereview.chromium.org/2629223003/diff/80001/media/gpu/android_video_decode_accelerator.cc File media/gpu/android_video_decode_accelerator.cc (right): https://codereview.chromium.org/2629223003/diff/80001/media/gpu/android_video_decode_accelerator.cc#newcode1154 media/gpu/android_video_decode_accelerator.cc:1154: if (codec_config_->surface_texture) { This is where surface_texture is ...
3 years, 11 months ago (2017-01-17 19:02:48 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2629223003/80001
3 years, 11 months ago (2017-01-17 19:03:20 UTC) #28
commit-bot: I haz the power
3 years, 11 months ago (2017-01-17 20:08:22 UTC) #31
Message was sent while issue was closed.
Committed patchset #3 (id:80001) as
https://chromium.googlesource.com/chromium/src/+/4eece651a995828d5677e6231fe7...

Powered by Google App Engine
This is Rietveld 408576698