Fix sync codec teardown in AVDA due to loss of surface |
|||
Issue descriptionThere are a few subtasks. 1) Fix the race. It was broken when we started posting destruction to another thread because it's racy. This should be fixed by trying to destruct synchronously on the GpuMain thread, and adding a timeout to the browser side call so we don't ANR if the release hangs. 2) Enable it on all api levels because it looks like it's causing crashes on KK too (http://crbug.com/600454). 3) Follow up: remove the delayed error posting code.
,
Nov 5 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/908f0cebd618d41880fdd5f7e7e83e19c39a45c7 commit 908f0cebd618d41880fdd5f7e7e83e19c39a45c7 Author: watk <watk@chromium.org> Date: Sat Nov 05 01:04:17 2016 Send the video surface destruction message on all Android versions We previously only sent this on JB to avoid crashes we saw there. It looks like we're seeing crashes on KK as well, so we have to enable it there too. It will be enabled for M+ soon to implement #setSurface support, so that leaves L as the odd one out. For simplicity we'll just enable it everywhere. BUG= 662599 Review-Url: https://codereview.chromium.org/2481583003 Cr-Commit-Position: refs/heads/master@{#430108} [modify] https://crrev.com/908f0cebd618d41880fdd5f7e7e83e19c39a45c7/content/browser/media/android/browser_surface_view_manager.cc [modify] https://crrev.com/908f0cebd618d41880fdd5f7e7e83e19c39a45c7/content/browser/media/android/browser_surface_view_manager.h
,
Nov 8 2016
I think I'm going to leave 1) as-is for now. I don't know of a nice solution that works generally so we just have to choose the least bad solution. Which means we might as well see how what we have works in practice and keep an eye on crash reports.
,
Nov 8 2016
Aren't we already seeing crash reports for this? It seems like we need to at least wait for the MediaCodec destruction to complete on the GpuMain thread?
,
Nov 8 2016
Those crash reports were KK because we weren't sending the message at all on KK. Now we're sending the message on KK. JB currently has the racy teardown, and it's the one that most reliably crashed if we didn't do the sync teardown. So I'll try to find crash reports that indicate we're losing the race.
,
Nov 8 2016
But yeah, I think waiting on the GPU main thread will be the best solution. Because that will solve the case where the destruction message comes in while an async release is already in progress, and we need to wait for it.
,
Nov 9 2016
do you mean to post the codec release off the main thread from surfaceDestroyed, then wait (with timeout) on the main thread for it to complete? which cases doesn't that cover?
,
Nov 9 2016
Yeah, that should cover all cases minus where we timeout. But that should be rare. I can try that.
,
Nov 11 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f1243d90b59f3361db000970862413cc12ddb6fa commit f1243d90b59f3361db000970862413cc12ddb6fa Author: watk <watk@chromium.org> Date: Fri Nov 11 23:12:14 2016 Remove delayed error posting from AndroidVideoDecodeAccelerator Now that we're always notifying AVDA when it loses its output surface there's no need to delay errors. Errors are always "real" errors now. BUG= 662599 TEST=entering and exiting fullscreen still works 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/2487813002 Cr-Commit-Position: refs/heads/master@{#431678} [modify] https://crrev.com/f1243d90b59f3361db000970862413cc12ddb6fa/media/gpu/android_video_decode_accelerator.cc [modify] https://crrev.com/f1243d90b59f3361db000970862413cc12ddb6fa/media/gpu/android_video_decode_accelerator.h [modify] https://crrev.com/f1243d90b59f3361db000970862413cc12ddb6fa/media/gpu/avda_picture_buffer_manager.cc [modify] https://crrev.com/f1243d90b59f3361db000970862413cc12ddb6fa/media/gpu/avda_state_provider.h
,
Nov 23 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8b00de4de08282a2a667fb6a04c753f0964cc67e commit 8b00de4de08282a2a667fb6a04c753f0964cc67e Author: watk <watk@chromium.org> Date: Wed Nov 23 00:45:41 2016 media: Do a TimedWait() for video surface teardown in AVDA In OnSurfaceDestroyed() we have to release the MediaCodec synchronously to avoid crashing or hanging. Previously we did the release asynchronously because we post MediaCodec release to another thread. Now that SurfaceDestroyed messages are enabled on all Android API levels, and we don't have deferred error reporting this change makes the teardown more robust by waiting for MediaCodecs to be released before returning from OnSurfaceDestroyed(). * AVDACodecAllocator now tracks the allocation of surfaces to AVDAs. * AVDACodecAllocator now allocates and releases codecs. When a codec with an attached surface is released, it tracks the completion of the async release task so that it can wait on it. * AVDASurfaceTracker is gone. Now OnSurfaceDestroyed messages are routed through AVDACodecAllocator. BUG= 662599 TEST=new tests, manual fullscreen transitions 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/2508053002 Cr-Commit-Position: refs/heads/master@{#434038} [modify] https://crrev.com/8b00de4de08282a2a667fb6a04c753f0964cc67e/content/gpu/gpu_child_thread.cc [modify] https://crrev.com/8b00de4de08282a2a667fb6a04c753f0964cc67e/media/gpu/BUILD.gn [modify] https://crrev.com/8b00de4de08282a2a667fb6a04c753f0964cc67e/media/gpu/android_video_decode_accelerator.cc [modify] https://crrev.com/8b00de4de08282a2a667fb6a04c753f0964cc67e/media/gpu/android_video_decode_accelerator.h [modify] https://crrev.com/8b00de4de08282a2a667fb6a04c753f0964cc67e/media/gpu/avda_codec_allocator.cc [modify] https://crrev.com/8b00de4de08282a2a667fb6a04c753f0964cc67e/media/gpu/avda_codec_allocator.h [modify] https://crrev.com/8b00de4de08282a2a667fb6a04c753f0964cc67e/media/gpu/avda_codec_allocator_unittest.cc [delete] https://crrev.com/50f2386d5fc8b1f32aa4e1a2340e73525a1088d0/media/gpu/avda_surface_tracker.cc [delete] https://crrev.com/50f2386d5fc8b1f32aa4e1a2340e73525a1088d0/media/gpu/avda_surface_tracker.h
,
Jan 25 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by w...@chromium.org
, Nov 5 2016