summaryrefslogtreecommitdiff
path: root/chromium/media/cdm
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-07-14 17:41:05 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-04 12:37:36 +0000
commit399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch)
tree6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/media/cdm
parent7366110654eec46f21b6824f302356426f48cd74 (diff)
downloadqtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/media/cdm')
-rw-r--r--chromium/media/cdm/aes_decryptor.cc25
-rw-r--r--chromium/media/cdm/aes_decryptor.h18
-rw-r--r--chromium/media/cdm/aes_decryptor_unittest.cc48
-rw-r--r--chromium/media/cdm/api/content_decryption_module.h59
-rw-r--r--chromium/media/cdm/cdm_adapter.cc53
-rw-r--r--chromium/media/cdm/cdm_adapter.h49
-rw-r--r--chromium/media/cdm/cdm_adapter_unittest.cc24
-rw-r--r--chromium/media/cdm/cdm_allocator.h5
-rw-r--r--chromium/media/cdm/cdm_file_io.cc13
-rw-r--r--chromium/media/cdm/cdm_file_io.h30
-rw-r--r--chromium/media/cdm/cdm_helpers.cc2
-rw-r--r--chromium/media/cdm/cdm_wrapper.h2
-rw-r--r--chromium/media/cdm/cenc_utils.cc6
-rw-r--r--chromium/media/cdm/default_cdm_factory.cc2
-rw-r--r--chromium/media/cdm/json_web_key.cc27
-rw-r--r--chromium/media/cdm/key_system_names.cc27
-rw-r--r--chromium/media/cdm/key_system_names.h34
-rw-r--r--chromium/media/cdm/ppapi/BUILD.gn8
-rw-r--r--chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc8
-rw-r--r--chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h8
-rw-r--r--chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc61
-rw-r--r--chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.h8
-rw-r--r--chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h8
-rw-r--r--chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h7
-rw-r--r--chromium/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.cc1
-rw-r--r--chromium/media/cdm/ppapi/ppapi_cdm_adapter.gni21
-rw-r--r--chromium/media/cdm/simple_cdm_allocator.cc5
-rw-r--r--chromium/media/cdm/simple_cdm_allocator.h3
-rw-r--r--chromium/media/cdm/simple_cdm_allocator_unittest.cc7
29 files changed, 312 insertions, 257 deletions
diff --git a/chromium/media/cdm/aes_decryptor.cc b/chromium/media/cdm/aes_decryptor.cc
index 87d3ebf94aa..bb5baa48c93 100644
--- a/chromium/media/cdm/aes_decryptor.cc
+++ b/chromium/media/cdm/aes_decryptor.cc
@@ -47,7 +47,7 @@ class AesDecryptor::SessionIdDecryptionKeyMap {
// This |decryption_key| becomes the latest until another insertion or
// |session_id| is erased.
void Insert(const std::string& session_id,
- scoped_ptr<DecryptionKey> decryption_key);
+ std::unique_ptr<DecryptionKey> decryption_key);
// Deletes the entry for |session_id| if present.
void Erase(const std::string& session_id);
@@ -79,7 +79,7 @@ class AesDecryptor::SessionIdDecryptionKeyMap {
void AesDecryptor::SessionIdDecryptionKeyMap::Insert(
const std::string& session_id,
- scoped_ptr<DecryptionKey> decryption_key) {
+ std::unique_ptr<DecryptionKey> decryption_key) {
KeyList::iterator it = Find(session_id);
if (it != key_list_.end())
Erase(it);
@@ -208,7 +208,7 @@ static scoped_refptr<DecoderBuffer> DecryptData(const DecoderBuffer& input,
// copy all encrypted subsamples to a contiguous buffer, decrypt them, then
// copy the decrypted bytes over the encrypted bytes in the output.
// TODO(strobe): attempt to reduce number of memory copies
- scoped_ptr<uint8_t[]> encrypted_bytes(new uint8_t[total_encrypted_size]);
+ std::unique_ptr<uint8_t[]> encrypted_bytes(new uint8_t[total_encrypted_size]);
CopySubsamples(subsamples, kSrcContainsClearBytes,
reinterpret_cast<const uint8_t*>(sample),
encrypted_bytes.get());
@@ -249,8 +249,9 @@ AesDecryptor::~AesDecryptor() {
key_map_.clear();
}
-void AesDecryptor::SetServerCertificate(const std::vector<uint8_t>& certificate,
- scoped_ptr<SimpleCdmPromise> promise) {
+void AesDecryptor::SetServerCertificate(
+ const std::vector<uint8_t>& certificate,
+ std::unique_ptr<SimpleCdmPromise> promise) {
promise->reject(
NOT_SUPPORTED_ERROR, 0, "SetServerCertificate() is not supported.");
}
@@ -259,7 +260,7 @@ void AesDecryptor::CreateSessionAndGenerateRequest(
SessionType session_type,
EmeInitDataType init_data_type,
const std::vector<uint8_t>& init_data,
- scoped_ptr<NewSessionCdmPromise> promise) {
+ std::unique_ptr<NewSessionCdmPromise> promise) {
std::string session_id(base::UintToString(next_session_id_++));
valid_sessions_.insert(session_id);
@@ -318,7 +319,7 @@ void AesDecryptor::CreateSessionAndGenerateRequest(
void AesDecryptor::LoadSession(SessionType session_type,
const std::string& session_id,
- scoped_ptr<NewSessionCdmPromise> promise) {
+ std::unique_ptr<NewSessionCdmPromise> promise) {
// TODO(xhwang): Change this to NOTREACHED() when blink checks for key systems
// that do not support loadSession. See http://crbug.com/342481
promise->reject(NOT_SUPPORTED_ERROR, 0, "LoadSession() is not supported.");
@@ -326,7 +327,7 @@ void AesDecryptor::LoadSession(SessionType session_type,
void AesDecryptor::UpdateSession(const std::string& session_id,
const std::vector<uint8_t>& response,
- scoped_ptr<SimpleCdmPromise> promise) {
+ std::unique_ptr<SimpleCdmPromise> promise) {
CHECK(!response.empty());
// TODO(jrummell): Convert back to a DCHECK once prefixed EME is removed.
@@ -400,7 +401,7 @@ void AesDecryptor::UpdateSession(const std::string& session_id,
}
void AesDecryptor::CloseSession(const std::string& session_id,
- scoped_ptr<SimpleCdmPromise> promise) {
+ std::unique_ptr<SimpleCdmPromise> promise) {
// Validate that this is a reference to an active session and then forget it.
std::set<std::string>::iterator it = valid_sessions_.find(session_id);
DCHECK(it != valid_sessions_.end());
@@ -414,7 +415,7 @@ void AesDecryptor::CloseSession(const std::string& session_id,
}
void AesDecryptor::RemoveSession(const std::string& session_id,
- scoped_ptr<SimpleCdmPromise> promise) {
+ std::unique_ptr<SimpleCdmPromise> promise) {
// AesDecryptor doesn't keep any persistent data, so this should be
// NOT_REACHED().
// TODO(jrummell): Make sure persistent session types are rejected.
@@ -535,7 +536,7 @@ void AesDecryptor::DeinitializeDecoder(StreamType stream_type) {
bool AesDecryptor::AddDecryptionKey(const std::string& session_id,
const std::string& key_id,
const std::string& key_string) {
- scoped_ptr<DecryptionKey> decryption_key(new DecryptionKey(key_string));
+ std::unique_ptr<DecryptionKey> decryption_key(new DecryptionKey(key_string));
if (!decryption_key->Init()) {
DVLOG(1) << "Could not initialize decryption key.";
return false;
@@ -549,7 +550,7 @@ bool AesDecryptor::AddDecryptionKey(const std::string& session_id,
}
// |key_id| not found, so need to create new entry.
- scoped_ptr<SessionIdDecryptionKeyMap> inner_map(
+ std::unique_ptr<SessionIdDecryptionKeyMap> inner_map(
new SessionIdDecryptionKeyMap());
inner_map->Insert(session_id, std::move(decryption_key));
key_map_.add(key_id, std::move(inner_map));
diff --git a/chromium/media/cdm/aes_decryptor.h b/chromium/media/cdm/aes_decryptor.h
index 1748ce494f6..20ded07737b 100644
--- a/chromium/media/cdm/aes_decryptor.h
+++ b/chromium/media/cdm/aes_decryptor.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "media/base/cdm_context.h"
#include "media/base/decryptor.h"
@@ -42,22 +42,22 @@ class MEDIA_EXPORT AesDecryptor : public MediaKeys,
// MediaKeys implementation.
void SetServerCertificate(const std::vector<uint8_t>& certificate,
- scoped_ptr<SimpleCdmPromise> promise) override;
+ std::unique_ptr<SimpleCdmPromise> promise) override;
void CreateSessionAndGenerateRequest(
SessionType session_type,
EmeInitDataType init_data_type,
const std::vector<uint8_t>& init_data,
- scoped_ptr<NewSessionCdmPromise> promise) override;
+ std::unique_ptr<NewSessionCdmPromise> promise) override;
void LoadSession(SessionType session_type,
const std::string& session_id,
- scoped_ptr<NewSessionCdmPromise> promise) override;
+ std::unique_ptr<NewSessionCdmPromise> promise) override;
void UpdateSession(const std::string& session_id,
const std::vector<uint8_t>& response,
- scoped_ptr<SimpleCdmPromise> promise) override;
+ std::unique_ptr<SimpleCdmPromise> promise) override;
void CloseSession(const std::string& session_id,
- scoped_ptr<SimpleCdmPromise> promise) override;
+ std::unique_ptr<SimpleCdmPromise> promise) override;
void RemoveSession(const std::string& session_id,
- scoped_ptr<SimpleCdmPromise> promise) override;
+ std::unique_ptr<SimpleCdmPromise> promise) override;
CdmContext* GetCdmContext() override;
// CdmContext implementation.
@@ -101,7 +101,7 @@ class MEDIA_EXPORT AesDecryptor : public MediaKeys,
const std::string secret_;
// The key used to decrypt the data.
- scoped_ptr<crypto::SymmetricKey> decryption_key_;
+ std::unique_ptr<crypto::SymmetricKey> decryption_key_;
DISALLOW_COPY_AND_ASSIGN(DecryptionKey);
};
@@ -114,7 +114,7 @@ class MEDIA_EXPORT AesDecryptor : public MediaKeys,
// Key ID <-> SessionIdDecryptionKeyMap map.
typedef base::ScopedPtrHashMap<std::string,
- scoped_ptr<SessionIdDecryptionKeyMap>>
+ std::unique_ptr<SessionIdDecryptionKeyMap>>
KeyIdToSessionKeysMap;
~AesDecryptor() override;
diff --git a/chromium/media/cdm/aes_decryptor_unittest.cc b/chromium/media/cdm/aes_decryptor_unittest.cc
index 47ed0ab57cd..7462010793f 100644
--- a/chromium/media/cdm/aes_decryptor_unittest.cc
+++ b/chromium/media/cdm/aes_decryptor_unittest.cc
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdint.h>
+#include "media/cdm/aes_decryptor.h"
+#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
@@ -19,9 +21,9 @@
#include "media/base/decrypt_config.h"
#include "media/base/decryptor.h"
#include "media/base/mock_filters.h"
-#include "media/cdm/aes_decryptor.h"
#include "media/cdm/api/content_decryption_module.h"
#include "media/cdm/cdm_adapter.h"
+#include "media/cdm/cdm_file_io.h"
#include "media/cdm/external_clear_key_test_helper.h"
#include "media/cdm/simple_cdm_allocator.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -41,7 +43,7 @@ MATCHER(IsEmpty, "") { return arg.empty(); }
MATCHER(IsNotEmpty, "") { return !arg.empty(); }
MATCHER(IsJSONDictionary, "") {
std::string result(arg.begin(), arg.end());
- scoped_ptr<base::Value> root(base::JSONReader().ReadToValue(result));
+ std::unique_ptr<base::Value> root(base::JSONReader().ReadToValue(result));
return (root.get() && root->GetType() == base::Value::TYPE_DICTIONARY);
}
@@ -201,7 +203,7 @@ static scoped_refptr<DecoderBuffer> CreateEncryptedBuffer(
key_id.size());
std::string iv_string(
reinterpret_cast<const char*>(iv.empty() ? NULL : &iv[0]), iv.size());
- encrypted_buffer->set_decrypt_config(scoped_ptr<DecryptConfig>(
+ encrypted_buffer->set_decrypt_config(std::unique_ptr<DecryptConfig>(
new DecryptConfig(key_id_string, iv_string, subsample_entries)));
return encrypted_buffer;
}
@@ -245,11 +247,13 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> {
CdmConfig cdm_config; // default settings of false are sufficient.
helper_.reset(new ExternalClearKeyTestHelper());
- scoped_ptr<CdmAllocator> allocator(new SimpleCdmAllocator());
+ std::unique_ptr<CdmAllocator> allocator(new SimpleCdmAllocator());
CdmAdapter::Create(
helper_->KeySystemName(), helper_->LibraryPath(), cdm_config,
- std::move(allocator), base::Bind(&AesDecryptorTest::OnSessionMessage,
+ std::move(allocator), base::Bind(&AesDecryptorTest::CreateCdmFileIO,
base::Unretained(this)),
+ base::Bind(&AesDecryptorTest::OnSessionMessage,
+ base::Unretained(this)),
base::Bind(&AesDecryptorTest::OnSessionClosed,
base::Unretained(this)),
base::Bind(&AesDecryptorTest::OnLegacySessionError,
@@ -295,26 +299,23 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> {
<< "Unexpectedly rejected with message: " << error_message;
}
- scoped_ptr<SimpleCdmPromise> CreatePromise(ExpectedResult expected_result) {
- scoped_ptr<SimpleCdmPromise> promise(
- new CdmCallbackPromise<>(base::Bind(&AesDecryptorTest::OnResolve,
- base::Unretained(this),
- expected_result),
- base::Bind(&AesDecryptorTest::OnReject,
- base::Unretained(this),
- expected_result)));
+ std::unique_ptr<SimpleCdmPromise> CreatePromise(
+ ExpectedResult expected_result) {
+ std::unique_ptr<SimpleCdmPromise> promise(new CdmCallbackPromise<>(
+ base::Bind(&AesDecryptorTest::OnResolve, base::Unretained(this),
+ expected_result),
+ base::Bind(&AesDecryptorTest::OnReject, base::Unretained(this),
+ expected_result)));
return promise;
}
- scoped_ptr<NewSessionCdmPromise> CreateSessionPromise(
+ std::unique_ptr<NewSessionCdmPromise> CreateSessionPromise(
ExpectedResult expected_result) {
- scoped_ptr<NewSessionCdmPromise> promise(
+ std::unique_ptr<NewSessionCdmPromise> promise(
new CdmCallbackPromise<std::string>(
base::Bind(&AesDecryptorTest::OnResolveWithSession,
- base::Unretained(this),
- expected_result),
- base::Bind(&AesDecryptorTest::OnReject,
- base::Unretained(this),
+ base::Unretained(this), expected_result),
+ base::Bind(&AesDecryptorTest::OnReject, base::Unretained(this),
expected_result)));
return promise;
}
@@ -455,6 +456,11 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> {
}
}
+ std::unique_ptr<CdmFileIO> CreateCdmFileIO(cdm::FileIOClient* client) {
+ ADD_FAILURE() << "Should never be called";
+ return nullptr;
+ }
+
MOCK_METHOD4(OnSessionMessage,
void(const std::string& session_id,
MediaKeys::MessageType message_type,
@@ -477,7 +483,7 @@ class AesDecryptorTest : public testing::TestWithParam<std::string> {
CdmKeysInfo keys_info_;
// Helper class to load/unload External Clear Key Library, if necessary.
- scoped_ptr<ExternalClearKeyTestHelper> helper_;
+ std::unique_ptr<ExternalClearKeyTestHelper> helper_;
base::MessageLoop message_loop_;
diff --git a/chromium/media/cdm/api/content_decryption_module.h b/chromium/media/cdm/api/content_decryption_module.h
index 28be27b8881..8cd6f92e2c0 100644
--- a/chromium/media/cdm/api/content_decryption_module.h
+++ b/chromium/media/cdm/api/content_decryption_module.h
@@ -14,24 +14,33 @@ typedef __int64 int64_t;
#include <stdint.h>
#endif
-// Define CDM_EXPORT so that functionality implemented by the CDM module
-// can be exported to consumers.
+// Define CDM_API so that functionality implemented by the CDM module
+// can be exported to consumers. Note: the implementation lives in
+// a dynamic library even in a non-component build.
+// Also define CDM_CLASS_API to export class types. We have to add
+// visibility attributes to make sure virtual tables in CDM consumer
+// and CDM implementation are the same. Generally, it was always a
+// good idea, as there're no guarantees about that for the internal
+// symbols, but it has only become a practical issue after
+// introduction of LTO devirtualization. See more details on
+// https://crbug.com/609564#c35
#if defined(WIN32)
-#if defined(CDM_IMPLEMENTATION)
-#define CDM_EXPORT __declspec(dllexport)
+#if defined(__clang__)
+#define CDM_CLASS_API [[clang::lto_visibility_public]]
#else
-#define CDM_EXPORT __declspec(dllimport)
-#endif // defined(CDM_IMPLEMENTATION)
-
-#else // defined(WIN32)
+#define CDM_CLASS_API
+#endif
#if defined(CDM_IMPLEMENTATION)
-#define CDM_EXPORT __attribute__((visibility("default")))
+#define CDM_API __declspec(dllexport)
#else
-#define CDM_EXPORT
-#endif
+#define CDM_API __declspec(dllimport)
+#endif // defined(CDM_IMPLEMENTATION)
+#else // defined(WIN32)
+#define CDM_API __attribute__((visibility("default")))
+#define CDM_CLASS_API __attribute__((visibility("default")))
#endif // defined(WIN32)
// The version number must be rolled when the exported functions are updated!
@@ -48,9 +57,9 @@ typedef __int64 int64_t;
#define BUILD_ENTRYPOINT_NO_EXPANSION(name, version) name##_##version
extern "C" {
-CDM_EXPORT void INITIALIZE_CDM_MODULE();
+CDM_API void INITIALIZE_CDM_MODULE();
-CDM_EXPORT void DeinitializeCdmModule();
+CDM_API void DeinitializeCdmModule();
// Returns a pointer to the requested CDM Host interface upon success.
// Returns NULL if the requested CDM Host interface is not supported.
@@ -65,12 +74,12 @@ typedef void* (*GetCdmHostFunc)(int host_interface_version, void* user_data);
// |cdm_interface_version|.
// Caller retains ownership of arguments and must call Destroy() on the returned
// object.
-CDM_EXPORT void* CreateCdmInstance(
+CDM_API void* CreateCdmInstance(
int cdm_interface_version,
const char* key_system, uint32_t key_system_size,
GetCdmHostFunc get_cdm_host_func, void* user_data);
-CDM_EXPORT const char* GetCdmVersion();
+CDM_API const char* GetCdmVersion();
}
namespace cdm {
@@ -384,7 +393,7 @@ enum MessageType {
// Note to implementors of this interface:
// Per-origin storage and the ability for users to clear it are important.
// See http://www.w3.org/TR/encrypted-media/#privacy-storedinfo.
-class FileIO {
+class CDM_CLASS_API FileIO {
public:
// Opens the file with |file_name| for read and write.
// FileIOClient::OnOpenComplete() will be called after the opening
@@ -424,7 +433,7 @@ class FileIO {
// When kError is returned, the FileIO object could be in an error state. All
// following calls (other than Close()) could return kError. The CDM should
// still call Close() to destroy the FileIO object.
-class FileIOClient {
+class CDM_CLASS_API FileIOClient {
public:
enum Status {
kSuccess = 0,
@@ -465,7 +474,7 @@ class FileIOClient {
// provided in CreateCdmInstance() to allocate any Buffer that needs to
// be passed back to the caller. Implementations must call Buffer::Destroy()
// when a Buffer is created that will never be returned to the caller.
-class ContentDecryptionModule_7 {
+class CDM_CLASS_API ContentDecryptionModule_7 {
public:
static const int kVersion = 7;
typedef Host_7 Host;
@@ -644,7 +653,7 @@ class ContentDecryptionModule_7 {
// provided in CreateCdmInstance() to allocate any Buffer that needs to
// be passed back to the caller. Implementations must call Buffer::Destroy()
// when a Buffer is created that will never be returned to the caller.
-class ContentDecryptionModule_8 {
+class CDM_CLASS_API ContentDecryptionModule_8 {
public:
static const int kVersion = 8;
typedef Host_8 Host;
@@ -829,7 +838,7 @@ class ContentDecryptionModule_8 {
typedef ContentDecryptionModule_8 ContentDecryptionModule;
// Represents a buffer created by Allocator implementations.
-class Buffer {
+class CDM_CLASS_API Buffer {
public:
// Destroys the buffer in the same context as it was created.
virtual void Destroy() = 0;
@@ -848,7 +857,7 @@ class Buffer {
void operator=(const Buffer&);
};
-class Host_7 {
+class CDM_CLASS_API Host_7 {
public:
static const int kVersion = 7;
@@ -985,7 +994,7 @@ class Host_7 {
virtual ~Host_7() {}
};
-class Host_8 {
+class CDM_CLASS_API Host_8 {
public:
static const int kVersion = 8;
@@ -1123,7 +1132,7 @@ class Host_8 {
};
// Represents a decrypted block that has not been decoded.
-class DecryptedBlock {
+class CDM_CLASS_API DecryptedBlock {
public:
virtual void SetDecryptedBuffer(Buffer* buffer) = 0;
virtual Buffer* DecryptedBuffer() = 0;
@@ -1138,7 +1147,7 @@ class DecryptedBlock {
virtual ~DecryptedBlock() {}
};
-class VideoFrame {
+class CDM_CLASS_API VideoFrame {
public:
enum VideoPlane {
kYPlane = 0,
@@ -1181,7 +1190,7 @@ class VideoFrame {
//
// |<----------------- AudioFrames ------------------>|
// | audio buffer 0 | audio buffer 1 | audio buffer 2 |
-class AudioFrames {
+class CDM_CLASS_API AudioFrames {
public:
virtual void SetFrameBuffer(Buffer* buffer) = 0;
virtual Buffer* FrameBuffer() = 0;
diff --git a/chromium/media/cdm/cdm_adapter.cc b/chromium/media/cdm/cdm_adapter.cc
index 91e598c113e..bc553ec20a0 100644
--- a/chromium/media/cdm/cdm_adapter.cc
+++ b/chromium/media/cdm/cdm_adapter.cc
@@ -11,7 +11,7 @@
#include "base/callback_helpers.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/cdm_initialized_promise.h"
@@ -26,6 +26,7 @@
#include "media/base/video_frame.h"
#include "media/base/video_types.h"
#include "media/cdm/cdm_allocator.h"
+#include "media/cdm/cdm_file_io.h"
#include "media/cdm/cdm_helpers.h"
#include "media/cdm/cdm_wrapper.h"
#include "ui/gfx/geometry/rect.h"
@@ -332,7 +333,8 @@ void CdmAdapter::Create(
const std::string& key_system,
const base::FilePath& cdm_path,
const CdmConfig& cdm_config,
- scoped_ptr<CdmAllocator> allocator,
+ std::unique_ptr<CdmAllocator> allocator,
+ const CreateCdmFileIOCB& create_cdm_file_io_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const LegacySessionErrorCB& legacy_session_error_cb,
@@ -347,12 +349,12 @@ void CdmAdapter::Create(
DCHECK(!session_expiration_update_cb.is_null());
scoped_refptr<CdmAdapter> cdm = new CdmAdapter(
- key_system, cdm_config, std::move(allocator), session_message_cb,
- session_closed_cb, legacy_session_error_cb, session_keys_change_cb,
- session_expiration_update_cb);
+ key_system, cdm_config, std::move(allocator), create_cdm_file_io_cb,
+ session_message_cb, session_closed_cb, legacy_session_error_cb,
+ session_keys_change_cb, session_expiration_update_cb);
// |cdm| ownership passed to the promise.
- scoped_ptr<CdmInitializedPromise> cdm_created_promise(
+ std::unique_ptr<CdmInitializedPromise> cdm_created_promise(
new CdmInitializedPromise(cdm_created_cb, cdm));
cdm->Initialize(cdm_path, std::move(cdm_created_promise));
@@ -361,7 +363,8 @@ void CdmAdapter::Create(
CdmAdapter::CdmAdapter(
const std::string& key_system,
const CdmConfig& cdm_config,
- scoped_ptr<CdmAllocator> allocator,
+ std::unique_ptr<CdmAllocator> allocator,
+ const CreateCdmFileIOCB& create_cdm_file_io_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const LegacySessionErrorCB& legacy_session_error_cb,
@@ -377,6 +380,7 @@ CdmAdapter::CdmAdapter(
audio_samples_per_second_(0),
audio_channel_layout_(CHANNEL_LAYOUT_NONE),
allocator_(std::move(allocator)),
+ create_cdm_file_io_cb_(create_cdm_file_io_cb),
task_runner_(base::ThreadTaskRunnerHandle::Get()),
weak_factory_(this) {
DCHECK(!key_system_.empty());
@@ -421,7 +425,7 @@ CdmWrapper* CdmAdapter::CreateCdmInstance(const std::string& key_system,
}
void CdmAdapter::Initialize(const base::FilePath& cdm_path,
- scoped_ptr<media::SimpleCdmPromise> promise) {
+ std::unique_ptr<media::SimpleCdmPromise> promise) {
cdm_.reset(CreateCdmInstance(key_system_, cdm_path));
if (!cdm_) {
promise->reject(MediaKeys::INVALID_ACCESS_ERROR, 0,
@@ -434,8 +438,9 @@ void CdmAdapter::Initialize(const base::FilePath& cdm_path,
promise->resolve();
}
-void CdmAdapter::SetServerCertificate(const std::vector<uint8_t>& certificate,
- scoped_ptr<SimpleCdmPromise> promise) {
+void CdmAdapter::SetServerCertificate(
+ const std::vector<uint8_t>& certificate,
+ std::unique_ptr<SimpleCdmPromise> promise) {
DCHECK(task_runner_->BelongsToCurrentThread());
if (certificate.size() < limits::kMinCertificateLength ||
@@ -454,7 +459,7 @@ void CdmAdapter::CreateSessionAndGenerateRequest(
SessionType session_type,
EmeInitDataType init_data_type,
const std::vector<uint8_t>& init_data,
- scoped_ptr<NewSessionCdmPromise> promise) {
+ std::unique_ptr<NewSessionCdmPromise> promise) {
DCHECK(task_runner_->BelongsToCurrentThread());
uint32_t promise_id = cdm_promise_adapter_.SavePromise(std::move(promise));
@@ -465,7 +470,7 @@ void CdmAdapter::CreateSessionAndGenerateRequest(
void CdmAdapter::LoadSession(SessionType session_type,
const std::string& session_id,
- scoped_ptr<NewSessionCdmPromise> promise) {
+ std::unique_ptr<NewSessionCdmPromise> promise) {
DCHECK(task_runner_->BelongsToCurrentThread());
uint32_t promise_id = cdm_promise_adapter_.SavePromise(std::move(promise));
@@ -475,7 +480,7 @@ void CdmAdapter::LoadSession(SessionType session_type,
void CdmAdapter::UpdateSession(const std::string& session_id,
const std::vector<uint8_t>& response,
- scoped_ptr<SimpleCdmPromise> promise) {
+ std::unique_ptr<SimpleCdmPromise> promise) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(!session_id.empty());
DCHECK(!response.empty());
@@ -486,7 +491,7 @@ void CdmAdapter::UpdateSession(const std::string& session_id,
}
void CdmAdapter::CloseSession(const std::string& session_id,
- scoped_ptr<SimpleCdmPromise> promise) {
+ std::unique_ptr<SimpleCdmPromise> promise) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(!session_id.empty());
@@ -495,7 +500,7 @@ void CdmAdapter::CloseSession(const std::string& session_id,
}
void CdmAdapter::RemoveSession(const std::string& session_id,
- scoped_ptr<SimpleCdmPromise> promise) {
+ std::unique_ptr<SimpleCdmPromise> promise) {
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(!session_id.empty());
@@ -540,7 +545,7 @@ void CdmAdapter::Decrypt(StreamType stream_type,
cdm::InputBuffer input_buffer;
std::vector<cdm::SubsampleEntry> subsamples;
- scoped_ptr<DecryptedBlockImpl> decrypted_block(new DecryptedBlockImpl());
+ std::unique_ptr<DecryptedBlockImpl> decrypted_block(new DecryptedBlockImpl());
ToCdmInputBuffer(encrypted, &subsamples, &input_buffer);
cdm::Status status = cdm_->Decrypt(input_buffer, decrypted_block.get());
@@ -640,7 +645,7 @@ void CdmAdapter::DecryptAndDecodeAudio(
cdm::InputBuffer input_buffer;
std::vector<cdm::SubsampleEntry> subsamples;
- scoped_ptr<AudioFramesImpl> audio_frames(new AudioFramesImpl());
+ std::unique_ptr<AudioFramesImpl> audio_frames(new AudioFramesImpl());
ToCdmInputBuffer(encrypted, &subsamples, &input_buffer);
cdm::Status status =
@@ -674,7 +679,8 @@ void CdmAdapter::DecryptAndDecodeVideo(
cdm::InputBuffer input_buffer;
std::vector<cdm::SubsampleEntry> subsamples;
- scoped_ptr<VideoFrameImpl> video_frame = allocator_->CreateCdmVideoFrame();
+ std::unique_ptr<VideoFrameImpl> video_frame =
+ allocator_->CreateCdmVideoFrame();
ToCdmInputBuffer(encrypted, &subsamples, &input_buffer);
cdm::Status status =
@@ -891,17 +897,18 @@ void CdmAdapter::OnDeferredInitializationDone(cdm::StreamType stream_type,
NOTREACHED() << "Unexpected cdm::StreamType " << stream_type;
}
-// The CDM owns the returned object and must call FileIO::Close() to release it.
cdm::FileIO* CdmAdapter::CreateFileIO(cdm::FileIOClient* client) {
DCHECK(task_runner_->BelongsToCurrentThread());
- // TODO(jrummell): This should use the mojo FileIO client.
- NOTIMPLEMENTED();
- return nullptr;
+ std::unique_ptr<CdmFileIO> file_io = create_cdm_file_io_cb_.Run(client);
+
+ // The CDM owns the returned object and must call FileIO::Close()
+ // to release it.
+ return file_io.release();
}
bool CdmAdapter::AudioFramesDataToAudioFrames(
- scoped_ptr<AudioFramesImpl> audio_frames,
+ std::unique_ptr<AudioFramesImpl> audio_frames,
Decryptor::AudioFrames* result_frames) {
const uint8_t* data = audio_frames->FrameBuffer()->Data();
const size_t data_size = audio_frames->FrameBuffer()->Size();
diff --git a/chromium/media/cdm/cdm_adapter.h b/chromium/media/cdm/cdm_adapter.h
index cb08f4a155d..269fc8f51f6 100644
--- a/chromium/media/cdm/cdm_adapter.h
+++ b/chromium/media/cdm/cdm_adapter.h
@@ -7,14 +7,15 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_native_library.h"
#include "base/threading/thread.h"
@@ -32,8 +33,17 @@ namespace media {
class AudioFramesImpl;
class CdmAllocator;
+class CdmFileIO;
class CdmWrapper;
+// Called when the CDM needs a FileIO object from the host to do file IO
+// operations. Returns NULL if a FileIO object cannot be obtained. Once a
+// valid FileIO object is returned, |client| must be valid until
+// FileIO::Close() is called. The CDM can call this method multiple times
+// to operate on different files.
+using CreateCdmFileIOCB =
+ base::Callback<std::unique_ptr<CdmFileIO>(cdm::FileIOClient* client)>;
+
class MEDIA_EXPORT CdmAdapter : public MediaKeys,
public CdmContext,
public Decryptor,
@@ -42,14 +52,16 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
public:
// Create the CDM using |cdm_path| and initialize it using |key_system| and
// |cdm_config|. |allocator| is to be used whenever the CDM needs memory
- // and to create VideoFrames. Callbacks will be used for events generated
- // by the CDM. |cdm_created_cb| will be called when the CDM is loaded and
- // initialized.
+ // and to create VideoFrames. |file_io_provider| is to be used whenever the
+ // CDM needs access to the file system. Callbacks will be used for events
+ // generated by the CDM. |cdm_created_cb| will be called when the CDM is
+ // loaded and initialized.
static void Create(
const std::string& key_system,
const base::FilePath& cdm_path,
const CdmConfig& cdm_config,
- scoped_ptr<CdmAllocator> allocator,
+ std::unique_ptr<CdmAllocator> allocator,
+ const CreateCdmFileIOCB& create_cdm_file_io_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const LegacySessionErrorCB& legacy_session_error_cb,
@@ -59,22 +71,22 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
// MediaKeys implementation.
void SetServerCertificate(const std::vector<uint8_t>& certificate,
- scoped_ptr<SimpleCdmPromise> promise) final;
+ std::unique_ptr<SimpleCdmPromise> promise) final;
void CreateSessionAndGenerateRequest(
SessionType session_type,
EmeInitDataType init_data_type,
const std::vector<uint8_t>& init_data,
- scoped_ptr<NewSessionCdmPromise> promise) final;
+ std::unique_ptr<NewSessionCdmPromise> promise) final;
void LoadSession(SessionType session_type,
const std::string& session_id,
- scoped_ptr<NewSessionCdmPromise> promise) final;
+ std::unique_ptr<NewSessionCdmPromise> promise) final;
void UpdateSession(const std::string& session_id,
const std::vector<uint8_t>& response,
- scoped_ptr<SimpleCdmPromise> promise) final;
+ std::unique_ptr<SimpleCdmPromise> promise) final;
void CloseSession(const std::string& session_id,
- scoped_ptr<SimpleCdmPromise> promise) final;
+ std::unique_ptr<SimpleCdmPromise> promise) final;
void RemoveSession(const std::string& session_id,
- scoped_ptr<SimpleCdmPromise> promise) final;
+ std::unique_ptr<SimpleCdmPromise> promise) final;
CdmContext* GetCdmContext() final;
// CdmContext implementation.
@@ -148,7 +160,8 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
private:
CdmAdapter(const std::string& key_system,
const CdmConfig& cdm_config,
- scoped_ptr<CdmAllocator> allocator,
+ std::unique_ptr<CdmAllocator> allocator,
+ const CreateCdmFileIOCB& create_cdm_file_io_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const LegacySessionErrorCB& legacy_session_error_cb,
@@ -159,7 +172,7 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
// Load the CDM using |cdm_path| and initialize it. |promise| is resolved if
// the CDM is successfully loaded and initialized, rejected otherwise.
void Initialize(const base::FilePath& cdm_path,
- scoped_ptr<media::SimpleCdmPromise> promise);
+ std::unique_ptr<media::SimpleCdmPromise> promise);
// Create an instance of the |key_system| CDM contained in |cdm_path|.
// Caller owns the returned pointer. On error (unable to load, does not
@@ -173,8 +186,9 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
// Converts audio data stored in |audio_frames| into individual audio
// buffers in |result_frames|. Returns true upon success.
- bool AudioFramesDataToAudioFrames(scoped_ptr<AudioFramesImpl> audio_frames,
- Decryptor::AudioFrames* result_frames);
+ bool AudioFramesDataToAudioFrames(
+ std::unique_ptr<AudioFramesImpl> audio_frames,
+ Decryptor::AudioFrames* result_frames);
// Keep a reference to the CDM.
base::ScopedNativeLibrary library_;
@@ -182,7 +196,7 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
// Used to keep track of promises while the CDM is processing the request.
CdmPromiseAdapter cdm_promise_adapter_;
- scoped_ptr<CdmWrapper> cdm_;
+ std::unique_ptr<CdmWrapper> cdm_;
std::string key_system_;
CdmConfig cdm_config_;
@@ -209,7 +223,8 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
int audio_samples_per_second_;
ChannelLayout audio_channel_layout_;
- scoped_ptr<CdmAllocator> allocator_;
+ std::unique_ptr<CdmAllocator> allocator_;
+ CreateCdmFileIOCB create_cdm_file_io_cb_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
diff --git a/chromium/media/cdm/cdm_adapter_unittest.cc b/chromium/media/cdm/cdm_adapter_unittest.cc
index ae743852835..48a6dfbfb3b 100644
--- a/chromium/media/cdm/cdm_adapter_unittest.cc
+++ b/chromium/media/cdm/cdm_adapter_unittest.cc
@@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "media/cdm/cdm_adapter.h"
+
#include <stdint.h>
+#include <memory>
#include "base/bind.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "media/base/cdm_callback_promise.h"
#include "media/base/cdm_key_information.h"
#include "media/base/media_keys.h"
-#include "media/cdm/cdm_adapter.h"
+#include "media/cdm/cdm_file_io.h"
#include "media/cdm/external_clear_key_test_helper.h"
#include "media/cdm/simple_cdm_allocator.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -81,10 +83,10 @@ class CdmAdapterTest : public testing::Test {
void InitializeAndExpect(base::FilePath library_path,
ExpectedResult expected_result) {
CdmConfig cdm_config; // default settings of false are sufficient.
- scoped_ptr<CdmAllocator> allocator(new SimpleCdmAllocator());
-
+ std::unique_ptr<CdmAllocator> allocator(new SimpleCdmAllocator());
CdmAdapter::Create(
helper_.KeySystemName(), library_path, cdm_config, std::move(allocator),
+ base::Bind(&CdmAdapterTest::CreateCdmFileIO, base::Unretained(this)),
base::Bind(&CdmAdapterTest::OnSessionMessage, base::Unretained(this)),
base::Bind(&CdmAdapterTest::OnSessionClosed, base::Unretained(this)),
base::Bind(&CdmAdapterTest::OnLegacySessionError,
@@ -169,14 +171,15 @@ class CdmAdapterTest : public testing::Test {
// Create a promise. |expected_result| is used to indicate how the promise
// should be fulfilled.
- scoped_ptr<SimpleCdmPromise> CreatePromise(ExpectedResult expected_result) {
+ std::unique_ptr<SimpleCdmPromise> CreatePromise(
+ ExpectedResult expected_result) {
if (expected_result == SUCCESS) {
EXPECT_CALL(*this, OnResolve());
} else {
EXPECT_CALL(*this, OnReject(_, _, IsNotEmpty()));
}
- scoped_ptr<SimpleCdmPromise> promise(new CdmCallbackPromise<>(
+ std::unique_ptr<SimpleCdmPromise> promise(new CdmCallbackPromise<>(
base::Bind(&CdmAdapterTest::OnResolve, base::Unretained(this)),
base::Bind(&CdmAdapterTest::OnReject, base::Unretained(this))));
return promise;
@@ -184,7 +187,7 @@ class CdmAdapterTest : public testing::Test {
// Create a promise to be used when a new session is created.
// |expected_result| is used to indicate how the promise should be fulfilled.
- scoped_ptr<NewSessionCdmPromise> CreateSessionPromise(
+ std::unique_ptr<NewSessionCdmPromise> CreateSessionPromise(
ExpectedResult expected_result) {
if (expected_result == SUCCESS) {
EXPECT_CALL(*this, OnResolveWithSession(_))
@@ -193,7 +196,7 @@ class CdmAdapterTest : public testing::Test {
EXPECT_CALL(*this, OnReject(_, _, IsNotEmpty()));
}
- scoped_ptr<NewSessionCdmPromise> promise(
+ std::unique_ptr<NewSessionCdmPromise> promise(
new CdmCallbackPromise<std::string>(
base::Bind(&CdmAdapterTest::OnResolveWithSession,
base::Unretained(this)),
@@ -203,6 +206,11 @@ class CdmAdapterTest : public testing::Test {
void RunUntilIdle() { message_loop_.RunUntilIdle(); }
+ std::unique_ptr<CdmFileIO> CreateCdmFileIO(cdm::FileIOClient* client) {
+ ADD_FAILURE() << "Should never be called";
+ return nullptr;
+ }
+
// Methods used for promise resolved/rejected.
MOCK_METHOD0(OnResolve, void());
MOCK_METHOD1(OnResolveWithSession, void(const std::string& session_id));
diff --git a/chromium/media/cdm/cdm_allocator.h b/chromium/media/cdm/cdm_allocator.h
index 84e7f3057e2..b06baac14ca 100644
--- a/chromium/media/cdm/cdm_allocator.h
+++ b/chromium/media/cdm/cdm_allocator.h
@@ -8,8 +8,9 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "media/base/media_export.h"
namespace cdm {
@@ -29,7 +30,7 @@ class MEDIA_EXPORT CdmAllocator {
virtual cdm::Buffer* CreateCdmBuffer(size_t capacity) = 0;
// Returns a new VideoFrameImpl.
- virtual scoped_ptr<VideoFrameImpl> CreateCdmVideoFrame() = 0;
+ virtual std::unique_ptr<VideoFrameImpl> CreateCdmVideoFrame() = 0;
protected:
CdmAllocator();
diff --git a/chromium/media/cdm/cdm_file_io.cc b/chromium/media/cdm/cdm_file_io.cc
new file mode 100644
index 00000000000..6a61084df30
--- /dev/null
+++ b/chromium/media/cdm/cdm_file_io.cc
@@ -0,0 +1,13 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/cdm/cdm_file_io.h"
+
+namespace media {
+
+CdmFileIO::CdmFileIO() {}
+
+CdmFileIO::~CdmFileIO() {}
+
+} // namespace media
diff --git a/chromium/media/cdm/cdm_file_io.h b/chromium/media/cdm/cdm_file_io.h
new file mode 100644
index 00000000000..812bf5fa0ac
--- /dev/null
+++ b/chromium/media/cdm/cdm_file_io.h
@@ -0,0 +1,30 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_CDM_CDM_FILE_IO_H_
+#define MEDIA_CDM_CDM_FILE_IO_H_
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "media/base/media_export.h"
+#include "media/cdm/api/content_decryption_module.h"
+
+namespace media {
+
+// Implements a version of cdm::FileIO with a public destructor so it can be
+// used with std::unique_ptr.
+class MEDIA_EXPORT CdmFileIO : NON_EXPORTED_BASE(public cdm::FileIO) {
+ public:
+ ~CdmFileIO() override;
+
+ protected:
+ CdmFileIO();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CdmFileIO);
+};
+
+} // namespace media
+
+#endif // MEDIA_CDM_CDM_FILE_IO_H_
diff --git a/chromium/media/cdm/cdm_helpers.cc b/chromium/media/cdm/cdm_helpers.cc
index f413dfaa8d7..491bff9e2f0 100644
--- a/chromium/media/cdm/cdm_helpers.cc
+++ b/chromium/media/cdm/cdm_helpers.cc
@@ -6,7 +6,7 @@
#if defined(USE_PPAPI_CDM_ADAPTER)
// When building the ppapi adapter do not include any non-trivial base/ headers.
-#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/logging.h" // nogncheck
#define PLATFORM_DCHECK PP_DCHECK
#else
#include "base/logging.h"
diff --git a/chromium/media/cdm/cdm_wrapper.h b/chromium/media/cdm/cdm_wrapper.h
index f0ed673aa72..20cdaad6134 100644
--- a/chromium/media/cdm/cdm_wrapper.h
+++ b/chromium/media/cdm/cdm_wrapper.h
@@ -15,7 +15,7 @@
#if defined(USE_PPAPI_CDM_ADAPTER)
// When building the ppapi adapter do not include any non-trivial base/ headers.
-#include "ppapi/cpp/logging.h"
+#include "ppapi/cpp/logging.h" // nogncheck
#define PLATFORM_DCHECK PP_DCHECK
#else
#include "base/logging.h"
diff --git a/chromium/media/cdm/cenc_utils.cc b/chromium/media/cdm/cenc_utils.cc
index dbb86231da9..20267c94ff0 100644
--- a/chromium/media/cdm/cenc_utils.cc
+++ b/chromium/media/cdm/cenc_utils.cc
@@ -4,6 +4,8 @@
#include "media/cdm/cenc_utils.h"
+#include <memory>
+
#include "base/macros.h"
#include "media/formats/mp4/box_definitions.h"
#include "media/formats/mp4/box_reader.h"
@@ -37,7 +39,7 @@ static bool ReadAllPsshBoxes(
// mp4::ProtectionSystemSpecificHeader doesn't validate the 'pssh' contents,
// so this simply verifies that |input| only contains 'pssh' boxes and
// nothing else.
- scoped_ptr<mp4::BoxReader> input_reader(
+ std::unique_ptr<mp4::BoxReader> input_reader(
mp4::BoxReader::ReadConcatentatedBoxes(input.data(), input.size()));
std::vector<mp4::ProtectionSystemSpecificHeader> raw_pssh_boxes;
if (!input_reader->ReadAllChildrenAndCheckFourCC(&raw_pssh_boxes))
@@ -49,7 +51,7 @@ static bool ReadAllPsshBoxes(
// (due to unsupported version, for example), this is done one by one,
// ignoring any boxes that can't be parsed.
for (const auto& raw_pssh_box : raw_pssh_boxes) {
- scoped_ptr<mp4::BoxReader> raw_pssh_reader(
+ std::unique_ptr<mp4::BoxReader> raw_pssh_reader(
mp4::BoxReader::ReadConcatentatedBoxes(raw_pssh_box.raw_box.data(),
raw_pssh_box.raw_box.size()));
// ReadAllChildren() appends any successfully parsed box onto it's
diff --git a/chromium/media/cdm/default_cdm_factory.cc b/chromium/media/cdm/default_cdm_factory.cc
index 675cb055864..d8ee8d91a20 100644
--- a/chromium/media/cdm/default_cdm_factory.cc
+++ b/chromium/media/cdm/default_cdm_factory.cc
@@ -8,7 +8,7 @@
#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "media/base/key_systems.h"
#include "media/cdm/aes_decryptor.h"
#include "url/gurl.h"
diff --git a/chromium/media/cdm/json_web_key.cc b/chromium/media/cdm/json_web_key.cc
index 850c44c8bc6..aec7273a1d8 100644
--- a/chromium/media/cdm/json_web_key.cc
+++ b/chromium/media/cdm/json_web_key.cc
@@ -6,13 +6,14 @@
#include <stddef.h>
+#include <memory>
+
#include "base/base64url.h"
#include "base/json/json_reader.h"
#include "base/json/json_string_value_serializer.h"
#include "base/json/string_escape.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -46,7 +47,7 @@ static std::string ShortenTo64Characters(const std::string& input) {
return escaped_str.substr(0, 61).append("...");
}
-static scoped_ptr<base::DictionaryValue> CreateJSONDictionary(
+static std::unique_ptr<base::DictionaryValue> CreateJSONDictionary(
const uint8_t* key,
int key_length,
const uint8_t* key_id,
@@ -59,7 +60,7 @@ static scoped_ptr<base::DictionaryValue> CreateJSONDictionary(
base::StringPiece(reinterpret_cast<const char*>(key_id), key_id_length),
base::Base64UrlEncodePolicy::OMIT_PADDING, &key_id_string);
- scoped_ptr<base::DictionaryValue> jwk(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> jwk(new base::DictionaryValue());
jwk->SetString(kKeyTypeTag, kKeyTypeOct);
jwk->SetString(kKeyTag, key_string);
jwk->SetString(kKeyIdTag, key_id_string);
@@ -71,7 +72,7 @@ std::string GenerateJWKSet(const uint8_t* key,
const uint8_t* key_id,
int key_id_length) {
// Create the JWK, and wrap it into a JWK Set.
- scoped_ptr<base::ListValue> list(new base::ListValue());
+ std::unique_ptr<base::ListValue> list(new base::ListValue());
list->Append(
CreateJSONDictionary(key, key_length, key_id, key_id_length).release());
base::DictionaryValue jwk_set;
@@ -86,7 +87,7 @@ std::string GenerateJWKSet(const uint8_t* key,
std::string GenerateJWKSet(const KeyIdAndKeyPairs& keys,
MediaKeys::SessionType session_type) {
- scoped_ptr<base::ListValue> list(new base::ListValue());
+ std::unique_ptr<base::ListValue> list(new base::ListValue());
for (const auto& key_pair : keys) {
list->Append(CreateJSONDictionary(
reinterpret_cast<const uint8_t*>(key_pair.second.data()),
@@ -171,7 +172,7 @@ bool ExtractKeysFromJWKSet(const std::string& jwk_set,
return false;
}
- scoped_ptr<base::Value> root(base::JSONReader().ReadToValue(jwk_set));
+ std::unique_ptr<base::Value> root(base::JSONReader().ReadToValue(jwk_set));
if (!root.get() || root->GetType() != base::Value::TYPE_DICTIONARY) {
DVLOG(1) << "Not valid JSON: " << jwk_set << ", root: " << root.get();
return false;
@@ -240,7 +241,7 @@ bool ExtractKeyIdsFromKeyIdsInitData(const std::string& input,
return false;
}
- scoped_ptr<base::Value> root(base::JSONReader().ReadToValue(input));
+ std::unique_ptr<base::Value> root(base::JSONReader().ReadToValue(input));
if (!root.get() || root->GetType() != base::Value::TYPE_DICTIONARY) {
error_message->assign("Not valid JSON: ");
error_message->append(ShortenTo64Characters(input));
@@ -302,8 +303,8 @@ void CreateLicenseRequest(const KeyIdList& key_ids,
MediaKeys::SessionType session_type,
std::vector<uint8_t>* license) {
// Create the license request.
- scoped_ptr<base::DictionaryValue> request(new base::DictionaryValue());
- scoped_ptr<base::ListValue> list(new base::ListValue());
+ std::unique_ptr<base::DictionaryValue> request(new base::DictionaryValue());
+ std::unique_ptr<base::ListValue> list(new base::ListValue());
for (const auto& key_id : key_ids) {
std::string key_id_string;
base::Base64UrlEncode(
@@ -340,8 +341,9 @@ void CreateLicenseRequest(const KeyIdList& key_ids,
void CreateKeyIdsInitData(const KeyIdList& key_ids,
std::vector<uint8_t>* init_data) {
// Create the init_data.
- scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue());
- scoped_ptr<base::ListValue> list(new base::ListValue());
+ std::unique_ptr<base::DictionaryValue> dictionary(
+ new base::DictionaryValue());
+ std::unique_ptr<base::ListValue> list(new base::ListValue());
for (const auto& key_id : key_ids) {
std::string key_id_string;
base::Base64UrlEncode(
@@ -373,7 +375,8 @@ bool ExtractFirstKeyIdFromLicenseRequest(const std::vector<uint8_t>& license,
return false;
}
- scoped_ptr<base::Value> root(base::JSONReader().ReadToValue(license_as_str));
+ std::unique_ptr<base::Value> root(
+ base::JSONReader().ReadToValue(license_as_str));
if (!root.get() || root->GetType() != base::Value::TYPE_DICTIONARY) {
DVLOG(1) << "Not valid JSON: " << license_as_str;
return false;
diff --git a/chromium/media/cdm/key_system_names.cc b/chromium/media/cdm/key_system_names.cc
deleted file mode 100644
index bcddaea2043..00000000000
--- a/chromium/media/cdm/key_system_names.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/cdm/key_system_names.h"
-
-namespace media {
-
-const char kClearKey[] = "org.w3.clearkey";
-const char kExternalClearKey[] = "org.chromium.externalclearkey";
-
-bool IsClearKey(const std::string& key_system) {
- return key_system == kClearKey;
-}
-
-bool IsChildKeySystemOf(const std::string& key_system,
- const std::string& base) {
- std::string prefix = base + '.';
- return key_system.substr(0, prefix.size()) == prefix;
-}
-
-bool IsExternalClearKey(const std::string& key_system) {
- return key_system == kExternalClearKey ||
- IsChildKeySystemOf(key_system, kExternalClearKey);
-}
-
-} // namespace media
diff --git a/chromium/media/cdm/key_system_names.h b/chromium/media/cdm/key_system_names.h
deleted file mode 100644
index 8b231718fff..00000000000
--- a/chromium/media/cdm/key_system_names.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MEDIA_CDM_KEY_SYSTEM_NAMES_H_
-#define MEDIA_CDM_KEY_SYSTEM_NAMES_H_
-
-#include <string>
-
-#include "media/base/media_export.h"
-
-namespace media {
-
-// TODO(jrummell): Change other uses of Clear Key to use this common value.
-
-// The key system name for Clear Key.
-MEDIA_EXPORT extern const char kClearKey[];
-
-// The key system name for External Clear Key.
-MEDIA_EXPORT extern const char kExternalClearKey[];
-
-// Returns true if |key_system| is Clear Key, false otherwise.
-MEDIA_EXPORT bool IsClearKey(const std::string& key_system);
-
-// Returns true if |key_system| is (reverse) sub-domain of |base|.
-MEDIA_EXPORT bool IsChildKeySystemOf(const std::string& key_system,
- const std::string& base);
-
-// Returns true if |key_system| is External Clear Key, false otherwise.
-MEDIA_EXPORT bool IsExternalClearKey(const std::string& key_system);
-
-} // namespace media
-
-#endif // MEDIA_CDM_KEY_SYSTEM_NAMES_H_
diff --git a/chromium/media/cdm/ppapi/BUILD.gn b/chromium/media/cdm/ppapi/BUILD.gn
index b0622e125f6..4869c620445 100644
--- a/chromium/media/cdm/ppapi/BUILD.gn
+++ b/chromium/media/cdm/ppapi/BUILD.gn
@@ -30,6 +30,7 @@ shared_library("clearkeycdm") {
"//base",
"//build/config/sanitizers:deps",
"//media", # For media::AudioTimestampHelper
+ "//media:cdm_api", # For content_decryption_module.h
"//media:shared_memory_support", # For media::AudioBus.
"//url",
]
@@ -45,7 +46,9 @@ shared_library("clearkeycdm") {
deps += [ "//third_party/ffmpeg" ]
}
- # TODO(GYP) on Mac: 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
+ if (is_mac) {
+ ldflags = [ "-Wl,-install_name,@loader_path/libclearkeycdm.dylib" ]
+ }
}
process_version("clearkeycdmadapter_resources") {
@@ -65,6 +68,7 @@ ppapi_cdm_adapter("clearkeycdmadapter") {
":clearkeycdm",
":clearkeycdmadapter_resources",
"//base", # Required for the allocator implementation.
- "//ppapi/cpp",
+ "//media:shared_memory_support",
+ "//ui/gfx/geometry",
]
}
diff --git a/chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc b/chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc
index 8535b14da63..ade64566620 100644
--- a/chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc
+++ b/chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
#include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h"
#if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER)
@@ -19,9 +18,10 @@
namespace media {
-scoped_ptr<CdmVideoDecoder> CreateVideoDecoder(
- ClearKeyCdmHost* host, const cdm::VideoDecoderConfig& config) {
- scoped_ptr<CdmVideoDecoder> video_decoder;
+std::unique_ptr<CdmVideoDecoder> CreateVideoDecoder(
+ ClearKeyCdmHost* host,
+ const cdm::VideoDecoderConfig& config) {
+ std::unique_ptr<CdmVideoDecoder> video_decoder;
#if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER)
video_decoder.reset(new FakeCdmVideoDecoder(host));
diff --git a/chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h b/chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h
index 696a2903e40..7ca88724aac 100644
--- a/chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h
+++ b/chromium/media/cdm/ppapi/external_clear_key/cdm_video_decoder.h
@@ -7,7 +7,8 @@
#include <stdint.h>
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "media/cdm/api/content_decryption_module.h"
#include "media/cdm/ppapi/external_clear_key/clear_key_cdm_common.h"
@@ -37,8 +38,9 @@ class CdmVideoDecoder {
// Initializes appropriate video decoder based on GYP flags and the value of
// |config.codec|. Returns a scoped_ptr containing a non-null initialized
// CdmVideoDecoder* upon success.
-scoped_ptr<CdmVideoDecoder> CreateVideoDecoder(
- ClearKeyCdmHost* host, const cdm::VideoDecoderConfig& config);
+std::unique_ptr<CdmVideoDecoder> CreateVideoDecoder(
+ ClearKeyCdmHost* host,
+ const cdm::VideoDecoderConfig& config);
} // namespace media
diff --git a/chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc b/chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc
index 3fa0157725c..e57bc6f6bea 100644
--- a/chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc
+++ b/chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc
@@ -105,7 +105,7 @@ static scoped_refptr<media::DecoderBuffer> CopyDecoderBufferFrom(
input_buffer.subsamples[i].cipher_bytes));
}
- scoped_ptr<media::DecryptConfig> decrypt_config(new media::DecryptConfig(
+ std::unique_ptr<media::DecryptConfig> decrypt_config(new media::DecryptConfig(
std::string(reinterpret_cast<const char*>(input_buffer.key_id),
input_buffer.key_id_size),
std::string(reinterpret_cast<const char*>(input_buffer.iv),
@@ -295,13 +295,11 @@ void ClearKeyCdm::CreateSessionAndGenerateRequest(
uint32_t init_data_size) {
DVLOG(1) << __FUNCTION__;
- scoped_ptr<media::NewSessionCdmPromise> promise(
+ std::unique_ptr<media::NewSessionCdmPromise> promise(
new media::CdmCallbackPromise<std::string>(
- base::Bind(&ClearKeyCdm::OnSessionCreated,
- base::Unretained(this),
+ base::Bind(&ClearKeyCdm::OnSessionCreated, base::Unretained(this),
promise_id),
- base::Bind(&ClearKeyCdm::OnPromiseFailed,
- base::Unretained(this),
+ base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
promise_id)));
decryptor_->CreateSessionAndGenerateRequest(
ConvertSessionType(session_type), ConvertInitDataType(init_data_type),
@@ -331,13 +329,11 @@ void ClearKeyCdm::LoadSession(uint32_t promise_id,
// Only allowed to successfully load this session once.
DCHECK(session_id_for_emulated_loadsession_.empty());
- scoped_ptr<media::NewSessionCdmPromise> promise(
+ std::unique_ptr<media::NewSessionCdmPromise> promise(
new media::CdmCallbackPromise<std::string>(
- base::Bind(&ClearKeyCdm::OnSessionLoaded,
- base::Unretained(this),
+ base::Bind(&ClearKeyCdm::OnSessionLoaded, base::Unretained(this),
promise_id),
- base::Bind(&ClearKeyCdm::OnPromiseFailed,
- base::Unretained(this),
+ base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
promise_id)));
decryptor_->CreateSessionAndGenerateRequest(
MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM,
@@ -356,11 +352,12 @@ void ClearKeyCdm::UpdateSession(uint32_t promise_id,
if (web_session_str == std::string(kLoadableSessionId))
web_session_str = session_id_for_emulated_loadsession_;
- scoped_ptr<media::SimpleCdmPromise> promise(new media::CdmCallbackPromise<>(
- base::Bind(&ClearKeyCdm::OnPromiseResolved, base::Unretained(this),
- promise_id),
- base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
- promise_id)));
+ std::unique_ptr<media::SimpleCdmPromise> promise(
+ new media::CdmCallbackPromise<>(
+ base::Bind(&ClearKeyCdm::OnPromiseResolved, base::Unretained(this),
+ promise_id),
+ base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
+ promise_id)));
decryptor_->UpdateSession(
web_session_str, std::vector<uint8_t>(response, response + response_size),
std::move(promise));
@@ -381,11 +378,12 @@ void ClearKeyCdm::CloseSession(uint32_t promise_id,
if (web_session_str == std::string(kLoadableSessionId))
web_session_str = session_id_for_emulated_loadsession_;
- scoped_ptr<media::SimpleCdmPromise> promise(new media::CdmCallbackPromise<>(
- base::Bind(
- &ClearKeyCdm::OnPromiseResolved, base::Unretained(this), promise_id),
- base::Bind(
- &ClearKeyCdm::OnPromiseFailed, base::Unretained(this), promise_id)));
+ std::unique_ptr<media::SimpleCdmPromise> promise(
+ new media::CdmCallbackPromise<>(
+ base::Bind(&ClearKeyCdm::OnPromiseResolved, base::Unretained(this),
+ promise_id),
+ base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
+ promise_id)));
decryptor_->CloseSession(web_session_str, std::move(promise));
}
@@ -410,11 +408,12 @@ void ClearKeyCdm::RemoveSession(uint32_t promise_id,
return;
}
- scoped_ptr<media::SimpleCdmPromise> promise(new media::CdmCallbackPromise<>(
- base::Bind(&ClearKeyCdm::OnPromiseResolved, base::Unretained(this),
- promise_id),
- base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
- promise_id)));
+ std::unique_ptr<media::SimpleCdmPromise> promise(
+ new media::CdmCallbackPromise<>(
+ base::Bind(&ClearKeyCdm::OnPromiseResolved, base::Unretained(this),
+ promise_id),
+ base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
+ promise_id)));
decryptor_->RemoveSession(web_session_str, std::move(promise));
}
@@ -694,10 +693,12 @@ void ClearKeyCdm::LoadLoadableSession() {
sizeof(kLoadableSessionKey),
kLoadableSessionKeyId,
sizeof(kLoadableSessionKeyId) - 1);
- scoped_ptr<media::SimpleCdmPromise> promise(new media::CdmCallbackPromise<>(
- base::Bind(&ClearKeyCdm::OnLoadSessionUpdated, base::Unretained(this)),
- base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
- promise_id_for_emulated_loadsession_)));
+ std::unique_ptr<media::SimpleCdmPromise> promise(
+ new media::CdmCallbackPromise<>(
+ base::Bind(&ClearKeyCdm::OnLoadSessionUpdated,
+ base::Unretained(this)),
+ base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
+ promise_id_for_emulated_loadsession_)));
decryptor_->UpdateSession(
session_id_for_emulated_loadsession_,
std::vector<uint8_t>(jwk_set.begin(), jwk_set.end()), std::move(promise));
diff --git a/chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.h b/chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.h
index 706f4a033cf..559e4db27b7 100644
--- a/chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.h
+++ b/chromium/media/cdm/ppapi/external_clear_key/clear_key_cdm.h
@@ -7,13 +7,13 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "media/base/cdm_key_information.h"
#include "media/cdm/aes_decryptor.h"
@@ -202,12 +202,12 @@ class ClearKeyCdm : public ClearKeyCdmInterface {
#endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
#if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER)
- scoped_ptr<FFmpegCdmAudioDecoder> audio_decoder_;
+ std::unique_ptr<FFmpegCdmAudioDecoder> audio_decoder_;
#endif // CLEAR_KEY_CDM_USE_FFMPEG_DECODER
- scoped_ptr<CdmVideoDecoder> video_decoder_;
+ std::unique_ptr<CdmVideoDecoder> video_decoder_;
- scoped_ptr<FileIOTestRunner> file_io_test_runner_;
+ std::unique_ptr<FileIOTestRunner> file_io_test_runner_;
DISALLOW_COPY_AND_ASSIGN(ClearKeyCdm);
};
diff --git a/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h b/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h
index d29a1a7a327..f27387beb2d 100644
--- a/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h
+++ b/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.h
@@ -7,11 +7,11 @@
#include <stdint.h>
+#include <memory>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "media/cdm/ppapi/external_clear_key/clear_key_cdm_common.h"
#include "media/ffmpeg/ffmpeg_deleters.h"
@@ -65,8 +65,8 @@ class FFmpegCdmAudioDecoder {
ClearKeyCdmHost* const host_;
// FFmpeg structures owned by this object.
- scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
- scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
+ std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
+ std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
// Audio format.
int samples_per_second_;
@@ -76,7 +76,7 @@ class FFmpegCdmAudioDecoder {
int av_sample_format_;
// Used for computing output timestamps.
- scoped_ptr<AudioTimestampHelper> output_timestamp_helper_;
+ std::unique_ptr<AudioTimestampHelper> output_timestamp_helper_;
int bytes_per_frame_;
base::TimeDelta last_input_timestamp_;
diff --git a/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h b/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h
index 761a225ff55..96a61ba588a 100644
--- a/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h
+++ b/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h
@@ -7,9 +7,10 @@
#include <stdint.h>
+#include <memory>
+
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h"
#include "media/cdm/ppapi/external_clear_key/clear_key_cdm_common.h"
#include "media/ffmpeg/ffmpeg_deleters.h"
@@ -47,8 +48,8 @@ class FFmpegCdmVideoDecoder : public CdmVideoDecoder {
void ReleaseFFmpegResources();
// FFmpeg structures owned by this object.
- scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
- scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
+ std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
+ std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
bool is_initialized_;
diff --git a/chromium/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.cc b/chromium/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.cc
index b45e622d66e..2ff6bc4ab4a 100644
--- a/chromium/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.cc
+++ b/chromium/media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.cc
@@ -5,7 +5,6 @@
#include "media/cdm/ppapi/external_clear_key/libvpx_cdm_video_decoder.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "media/base/limits.h"
// Include libvpx header files.
diff --git a/chromium/media/cdm/ppapi/ppapi_cdm_adapter.gni b/chromium/media/cdm/ppapi/ppapi_cdm_adapter.gni
index 120941314ee..c4c7f878e4c 100644
--- a/chromium/media/cdm/ppapi/ppapi_cdm_adapter.gni
+++ b/chromium/media/cdm/ppapi/ppapi_cdm_adapter.gni
@@ -7,8 +7,13 @@
# depend on media/media_cdm_adapter.gyp:cdmadapter which would in turn modify
# your target with direct_dependent_settings.
template("ppapi_cdm_adapter") {
- # TODO(GYP) On Mac/Linux this should be a loadable_module.
- shared_library(target_name) {
+ if (is_mac || is_linux) {
+ _target_type = "loadable_module"
+ } else {
+ _target_type = "shared_library"
+ }
+
+ target(_target_type, target_name) {
# Don't filter sources list again.
set_sources_assignment_filter([])
cflags = []
@@ -18,8 +23,11 @@ template("ppapi_cdm_adapter") {
forward_variables_from(invoker, "*")
defines += [ "USE_PPAPI_CDM_ADAPTER" ]
+ deps += [
+ "//media:cdm_api",
+ "//ppapi/cpp",
+ ]
sources += [
- "//media/cdm/api/content_decryption_module.h",
"//media/cdm/cdm_helpers.cc",
"//media/cdm/cdm_helpers.h",
"//media/cdm/cdm_wrapper.h",
@@ -42,7 +50,8 @@ template("ppapi_cdm_adapter") {
"-Wl,-exported_symbol,_PPP_InitializeModule",
"-Wl,-exported_symbol,_PPP_ShutdownModule",
]
- #TODO(GYP) Mac: 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
+
+ output_extension = "plugin"
} else if (is_posix) {
cflags += [ "-fvisibility=hidden" ]
@@ -50,8 +59,8 @@ template("ppapi_cdm_adapter") {
libs += [ "rt" ]
}
- if (is_linux && !is_component_build) {
- # CDM adapter depends on a CDM even in non-component builds.
+ if (is_linux) {
+ # CDM adapter depends on a CDM in component and non-component builds.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
diff --git a/chromium/media/cdm/simple_cdm_allocator.cc b/chromium/media/cdm/simple_cdm_allocator.cc
index 2ae4dd890a1..45a5a38f83d 100644
--- a/chromium/media/cdm/simple_cdm_allocator.cc
+++ b/chromium/media/cdm/simple_cdm_allocator.cc
@@ -4,6 +4,7 @@
#include "media/cdm/simple_cdm_allocator.h"
+#include "base/memory/ptr_util.h"
#include "media/base/video_frame.h"
#include "media/cdm/cdm_helpers.h"
#include "media/cdm/simple_cdm_buffer.h"
@@ -66,8 +67,8 @@ cdm::Buffer* SimpleCdmAllocator::CreateCdmBuffer(size_t capacity) {
}
// Creates a new SimpleCdmVideoFrame on every request.
-scoped_ptr<VideoFrameImpl> SimpleCdmAllocator::CreateCdmVideoFrame() {
- return make_scoped_ptr(new SimpleCdmVideoFrame());
+std::unique_ptr<VideoFrameImpl> SimpleCdmAllocator::CreateCdmVideoFrame() {
+ return base::WrapUnique(new SimpleCdmVideoFrame());
}
} // namespace media
diff --git a/chromium/media/cdm/simple_cdm_allocator.h b/chromium/media/cdm/simple_cdm_allocator.h
index 1d6a69e45f2..cfb614f7eb6 100644
--- a/chromium/media/cdm/simple_cdm_allocator.h
+++ b/chromium/media/cdm/simple_cdm_allocator.h
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
#include "base/macros.h"
#include "media/cdm/cdm_allocator.h"
@@ -21,7 +22,7 @@ class SimpleCdmAllocator : public CdmAllocator {
// CdmAllocator implementation.
cdm::Buffer* CreateCdmBuffer(size_t capacity) final;
- scoped_ptr<VideoFrameImpl> CreateCdmVideoFrame() final;
+ std::unique_ptr<VideoFrameImpl> CreateCdmVideoFrame() final;
private:
DISALLOW_COPY_AND_ASSIGN(SimpleCdmAllocator);
diff --git a/chromium/media/cdm/simple_cdm_allocator_unittest.cc b/chromium/media/cdm/simple_cdm_allocator_unittest.cc
index e602d9e50f7..6e95c5368f7 100644
--- a/chromium/media/cdm/simple_cdm_allocator_unittest.cc
+++ b/chromium/media/cdm/simple_cdm_allocator_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <stdint.h>
+#include <memory>
#include "base/macros.h"
#include "media/base/video_frame.h"
@@ -64,7 +65,8 @@ TEST_F(SimpleCdmAllocatorTest, CreateCdmBuffer) {
}
TEST_F(SimpleCdmAllocatorTest, CreateCdmVideoFrame) {
- scoped_ptr<VideoFrameImpl> video_frame = allocator_.CreateCdmVideoFrame();
+ std::unique_ptr<VideoFrameImpl> video_frame =
+ allocator_.CreateCdmVideoFrame();
EXPECT_EQ(video_frame->FrameBuffer(), nullptr);
video_frame->SetFrameBuffer(TestCdmBuffer::Create(100));
EXPECT_NE(video_frame->FrameBuffer(), nullptr);
@@ -81,7 +83,8 @@ TEST_F(SimpleCdmAllocatorTest, TransformToVideoFrame) {
size_t memory_needed = VideoFrame::AllocationSize(PIXEL_FORMAT_YV12, size);
// Now create a VideoFrameImpl.
- scoped_ptr<VideoFrameImpl> video_frame = allocator_.CreateCdmVideoFrame();
+ std::unique_ptr<VideoFrameImpl> video_frame =
+ allocator_.CreateCdmVideoFrame();
EXPECT_EQ(video_frame->FrameBuffer(), nullptr);
// Fill VideoFrameImpl as if it was a small video frame.