Index: content/common/gpu/media/android_video_decode_accelerator.cc |
diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc |
index 9eccdc65e0440ab49d2bdcb479e2e670382960ea..b93492e54997ffb71500398637011b982c063a3b 100644 |
--- a/content/common/gpu/media/android_video_decode_accelerator.cc |
+++ b/content/common/gpu/media/android_video_decode_accelerator.cc |
@@ -38,7 +38,6 @@ |
#include "ui/gl/gl_bindings.h" |
#if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
-#include "media/base/media_keys.h" |
#include "media/mojo/services/mojo_cdm_service.h" |
#endif |
@@ -285,11 +284,12 @@ AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() { |
g_avda_timer.Pointer()->StopTimer(this); |
#if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
- if (cdm_) { |
- DCHECK(cdm_registration_id_); |
- static_cast<media::MediaDrmBridge*>(cdm_.get()) |
- ->UnregisterPlayer(cdm_registration_id_); |
- } |
+ if (!cdm_) |
+ return; |
+ |
+ DCHECK(cdm_registration_id_); |
+ static_cast<media::MediaDrmBridgeCdmContext*>(cdm_->GetCdmContext()) |
ddorwin
2016/03/21 21:40:25
It would be nice to only cast once.
Also, we shoul
xhwang
2016/03/22 17:08:32
Done.
|
+ ->UnregisterPlayer(cdm_registration_id_); |
#endif // defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
} |
@@ -365,8 +365,6 @@ void AndroidVideoDecodeAccelerator::SetCdm(int cdm_id) { |
DVLOG(2) << __FUNCTION__ << ": " << cdm_id; |
#if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
- using media::MediaDrmBridge; |
- |
DCHECK(client_) << "SetCdm() must be called after Initialize()."; |
if (cdm_) { |
@@ -378,8 +376,9 @@ void AndroidVideoDecodeAccelerator::SetCdm(int cdm_id) { |
cdm_ = media::MojoCdmService::LegacyGetCdm(cdm_id); |
DCHECK(cdm_); |
- // On Android platform the MediaKeys will be its subclass MediaDrmBridge. |
- MediaDrmBridge* drm_bridge = static_cast<MediaDrmBridge*>(cdm_.get()); |
+ // On Android platform the CdmContext must be a MediaDrmBridgeCdmContext. |
+ media::MediaDrmBridgeCdmContext* media_drm_bridge_cdm_context = |
+ static_cast<media::MediaDrmBridgeCdmContext*>(cdm_->GetCdmContext()); |
// Register CDM callbacks. The callbacks registered will be posted back to |
// this thread via BindToCurrentLoop. |
@@ -389,13 +388,13 @@ void AndroidVideoDecodeAccelerator::SetCdm(int cdm_id) { |
// destructed as well. So the |cdm_unset_cb| will never have a chance to be |
// called. |
// TODO(xhwang): Remove |cdm_unset_cb| after it's not used on all platforms. |
- cdm_registration_id_ = |
- drm_bridge->RegisterPlayer(media::BindToCurrentLoop(base::Bind( |
- &AndroidVideoDecodeAccelerator::OnKeyAdded, |
- weak_this_factory_.GetWeakPtr())), |
- base::Bind(&base::DoNothing)); |
+ cdm_registration_id_ = media_drm_bridge_cdm_context->RegisterPlayer( |
+ media::BindToCurrentLoop( |
+ base::Bind(&AndroidVideoDecodeAccelerator::OnKeyAdded, |
+ weak_this_factory_.GetWeakPtr())), |
+ base::Bind(&base::DoNothing)); |
- drm_bridge->SetMediaCryptoReadyCB(media::BindToCurrentLoop( |
+ media_drm_bridge_cdm_context->SetMediaCryptoReadyCB(media::BindToCurrentLoop( |
base::Bind(&AndroidVideoDecodeAccelerator::OnMediaCryptoReady, |
weak_this_factory_.GetWeakPtr()))); |
@@ -1071,7 +1070,7 @@ void AndroidVideoDecodeAccelerator::PostError( |
} |
void AndroidVideoDecodeAccelerator::OnMediaCryptoReady( |
- media::MediaDrmBridge::JavaObjectPtr media_crypto, |
+ media::MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto, |
bool needs_protected_surface) { |
DVLOG(1) << __FUNCTION__; |