Commit e636cd89 authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: Handle GetCdm() failure in AndroidVideoDecodeAccelerator

In normal cases in the render process WebMediaPlayerImpl holds a
reference to the CDM such that the CDM should never be destructed before
the media pipeline. Howeven, when both the decoder and CDM are hosted
remotely (e.g. in the GPU process on Android), the destruction order
could be reversed due to IPC. In this case, we should just fail instead
of crash.

Note that this case is already handled in MojoAudioDecoderService,
MojoVideoDecoderService and MojoRendererService.

Bug: 833641
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I7f07c07dea86033ebe57700e0ce8834ea94b06f3
Reviewed-on: https://chromium-review.googlesource.com/1013690Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551211}
parent 4cd5d7e5
...@@ -1456,7 +1456,12 @@ void AndroidVideoDecodeAccelerator::InitializeCdm() { ...@@ -1456,7 +1456,12 @@ void AndroidVideoDecodeAccelerator::InitializeCdm() {
// Store the CDM to hold a reference to it. // Store the CDM to hold a reference to it.
cdm_for_reference_holding_only_ = cdm_for_reference_holding_only_ =
CdmManager::GetInstance()->GetCdm(config_.cdm_id); CdmManager::GetInstance()->GetCdm(config_.cdm_id);
DCHECK(cdm_for_reference_holding_only_); if (!cdm_for_reference_holding_only_) {
// This could happen during the destruction of the media element and the CDM
// and due to IPC CDM could be destroyed before the decoder.
NOTIFY_ERROR(PLATFORM_FAILURE, "CDM not available.");
return;
}
auto* cdm_context = cdm_for_reference_holding_only_->GetCdmContext(); auto* cdm_context = cdm_for_reference_holding_only_->GetCdmContext();
media_crypto_context_ = media_crypto_context_ =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment