Commit 4a1a996e authored by xhwang's avatar xhwang Committed by Commit bot

media: Create MediaCrypto upon MediaDrmBridge creation.

- Create MediaCrypto right after MediaDrmBridge construction or after
  provisioning is successfully completed.
- Do not store mMediaCrypto in Java.

Tests:
- MediaCrypto creation on provisioned device.
- MediaCrypto creation on unprovisioned device with successful provisioning.
- MediaCrypto creation on unprovisioned device with failed provisioning (so null
  MediaCrypto was notified).

BUG=564246
TEST=See above.

Review URL: https://codereview.chromium.org/1540033002

Cr-Commit-Position: refs/heads/master@{#368438}
parent c45428fe
......@@ -292,6 +292,8 @@ scoped_refptr<MediaDrmBridge> MediaDrmBridge::CreateWithoutSessionSupport(
const std::string& key_system,
SecurityLevel security_level,
const CreateFetcherCB& create_fetcher_cb) {
DVLOG(1) << __FUNCTION__;
return MediaDrmBridge::Create(key_system, security_level, create_fetcher_cb,
SessionMessageCB(), SessionClosedCB(),
LegacySessionErrorCB(), SessionKeysChangeCB(),
......@@ -730,6 +732,7 @@ MediaDrmBridge::MediaDrmBridge(
ScopedJavaLocalRef<jstring> j_security_level =
ConvertUTF8ToJavaString(env, security_level_str);
// Note: OnMediaCryptoReady() could be called in this call.
j_media_drm_.Reset(Java_MediaDrmBridge_create(
env, j_scheme_uuid.obj(), j_security_level.obj(),
reinterpret_cast<intptr_t>(this)));
......
......@@ -244,7 +244,8 @@ class MEDIA_EXPORT MediaDrmBridge : public MediaKeys, public PlayerTracker {
// Constructs a MediaDrmBridge for |scheme_uuid| and |security_level|. The
// default security level will be used if |security_level| is
// SECURITY_LEVEL_DEFAULT.
// SECURITY_LEVEL_DEFAULT. Sessions should not be created if session callbacks
// are null.
MediaDrmBridge(const std::vector<uint8_t>& scheme_uuid,
SecurityLevel security_level,
const CreateFetcherCB& create_fetcher_cb,
......
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