| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/android/media_drm_bridge.h" | 5 #include "media/base/android/media_drm_bridge.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "base/sys_info.h" | 25 #include "base/sys_info.h" |
| 26 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
| 27 #include "jni/MediaDrmBridge_jni.h" | 27 #include "jni/MediaDrmBridge_jni.h" |
| 28 #include "media/base/android/android_util.h" | 28 #include "media/base/android/android_util.h" |
| 29 #include "media/base/android/media_codec_util.h" | 29 #include "media/base/android/media_codec_util.h" |
| 30 #include "media/base/android/media_drm_bridge_client.h" | 30 #include "media/base/android/media_drm_bridge_client.h" |
| 31 #include "media/base/android/media_drm_bridge_delegate.h" | 31 #include "media/base/android/media_drm_bridge_delegate.h" |
| 32 #include "media/base/cdm_key_information.h" | 32 #include "media/base/cdm_key_information.h" |
| 33 #include "media/base/media_switches.h" | 33 #include "media/base/media_switches.h" |
| 34 #include "media/base/provision_fetcher.h" | 34 #include "media/base/provision_fetcher.h" |
| 35 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 35 |
| 36 // In SHARED_INTERMEDIATE_DIR |
| 37 #include "widevine_cdm_version.h" // NOLINT(build/include) |
| 36 | 38 |
| 37 using base::android::AttachCurrentThread; | 39 using base::android::AttachCurrentThread; |
| 38 using base::android::ConvertUTF8ToJavaString; | 40 using base::android::ConvertUTF8ToJavaString; |
| 39 using base::android::ConvertJavaStringToUTF8; | 41 using base::android::ConvertJavaStringToUTF8; |
| 40 using base::android::JavaByteArrayToByteVector; | 42 using base::android::JavaByteArrayToByteVector; |
| 41 using base::android::JavaParamRef; | 43 using base::android::JavaParamRef; |
| 42 using base::android::ScopedJavaGlobalRef; | 44 using base::android::ScopedJavaGlobalRef; |
| 43 using base::android::ScopedJavaLocalRef; | 45 using base::android::ScopedJavaLocalRef; |
| 44 | 46 |
| 45 namespace media { | 47 namespace media { |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 const std::vector<uint8_t>& scheme_uuid, | 796 const std::vector<uint8_t>& scheme_uuid, |
| 795 const GURL& security_origin, | 797 const GURL& security_origin, |
| 796 SecurityLevel security_level, | 798 SecurityLevel security_level, |
| 797 const CreateFetcherCB& create_fetcher_cb, | 799 const CreateFetcherCB& create_fetcher_cb, |
| 798 const CreateStorageCB& create_storage_cb, | 800 const CreateStorageCB& create_storage_cb, |
| 799 const SessionMessageCB& session_message_cb, | 801 const SessionMessageCB& session_message_cb, |
| 800 const SessionClosedCB& session_closed_cb, | 802 const SessionClosedCB& session_closed_cb, |
| 801 const SessionKeysChangeCB& session_keys_change_cb, | 803 const SessionKeysChangeCB& session_keys_change_cb, |
| 802 const SessionExpirationUpdateCB& session_expiration_update_cb) | 804 const SessionExpirationUpdateCB& session_expiration_update_cb) |
| 803 : scheme_uuid_(scheme_uuid), | 805 : scheme_uuid_(scheme_uuid), |
| 806 storage_(url::Origin(security_origin), create_storage_cb), |
| 804 create_fetcher_cb_(create_fetcher_cb), | 807 create_fetcher_cb_(create_fetcher_cb), |
| 805 create_storage_cb_(create_storage_cb), | |
| 806 session_message_cb_(session_message_cb), | 808 session_message_cb_(session_message_cb), |
| 807 session_closed_cb_(session_closed_cb), | 809 session_closed_cb_(session_closed_cb), |
| 808 session_keys_change_cb_(session_keys_change_cb), | 810 session_keys_change_cb_(session_keys_change_cb), |
| 809 session_expiration_update_cb_(session_expiration_update_cb), | 811 session_expiration_update_cb_(session_expiration_update_cb), |
| 810 task_runner_(base::ThreadTaskRunnerHandle::Get()), | 812 task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 811 media_drm_bridge_cdm_context_(this), | 813 media_drm_bridge_cdm_context_(this), |
| 812 weak_factory_(this) { | 814 weak_factory_(this) { |
| 813 DVLOG(1) << __func__; | 815 DVLOG(1) << __func__; |
| 814 | 816 |
| 815 DCHECK(!create_fetcher_cb_.is_null()); | 817 DCHECK(!create_fetcher_cb_.is_null()); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 DCHECK(task_runner_->BelongsToCurrentThread()); | 891 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 890 DCHECK(j_media_crypto); | 892 DCHECK(j_media_crypto); |
| 891 DCHECK(!j_media_crypto_); | 893 DCHECK(!j_media_crypto_); |
| 892 | 894 |
| 893 j_media_crypto_ = std::move(j_media_crypto); | 895 j_media_crypto_ = std::move(j_media_crypto); |
| 894 | 896 |
| 895 if (media_crypto_ready_cb_.is_null()) | 897 if (media_crypto_ready_cb_.is_null()) |
| 896 return; | 898 return; |
| 897 | 899 |
| 898 // We have to use scoped_ptr to pass ScopedJavaGlobalRef with a callback. | 900 // We have to use scoped_ptr to pass ScopedJavaGlobalRef with a callback. |
| 899 // TODO(yucliu): Check whether we can simply pass j_media_crypto_->obj() in th
e | 901 // TODO(yucliu): Check whether we can simply pass j_media_crypto_->obj() in |
| 900 // callback. | 902 // the callback. |
| 901 base::ResetAndReturn(&media_crypto_ready_cb_) | 903 base::ResetAndReturn(&media_crypto_ready_cb_) |
| 902 .Run(CreateJavaObjectPtr(j_media_crypto_->obj()), | 904 .Run(CreateJavaObjectPtr(j_media_crypto_->obj()), |
| 903 IsProtectedSurfaceRequired()); | 905 IsProtectedSurfaceRequired()); |
| 904 } | 906 } |
| 905 | 907 |
| 906 void MediaDrmBridge::SendProvisioningRequest(const std::string& default_url, | 908 void MediaDrmBridge::SendProvisioningRequest(const std::string& default_url, |
| 907 const std::string& request_data) { | 909 const std::string& request_data) { |
| 908 DCHECK(task_runner_->BelongsToCurrentThread()); | 910 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 909 DVLOG(1) << __func__; | 911 DVLOG(1) << __func__; |
| 910 | 912 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 937 } | 939 } |
| 938 | 940 |
| 939 void MediaDrmBridge::OnHasAdditionalUsableKey() { | 941 void MediaDrmBridge::OnHasAdditionalUsableKey() { |
| 940 DCHECK(task_runner_->BelongsToCurrentThread()); | 942 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 941 DVLOG(1) << __func__; | 943 DVLOG(1) << __func__; |
| 942 | 944 |
| 943 player_tracker_.NotifyNewKey(); | 945 player_tracker_.NotifyNewKey(); |
| 944 } | 946 } |
| 945 | 947 |
| 946 } // namespace media | 948 } // namespace media |
| OLD | NEW |