Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: media/cdm/cdm_adapter.cc

Issue 1888603002: Add CdmFileIOProvider interface for use by cdm_adapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: callback Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cdm/cdm_adapter.cc
diff --git a/media/cdm/cdm_adapter.cc b/media/cdm/cdm_adapter.cc
index 91e598c113e2294884cc2f5afc3ddc4477484a1f..fe7a2683e2eb71c5448643e2b8c095ad9ac85531 100644
--- a/media/cdm/cdm_adapter.cc
+++ b/media/cdm/cdm_adapter.cc
@@ -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"
@@ -333,6 +334,7 @@ void CdmAdapter::Create(
const base::FilePath& cdm_path,
const CdmConfig& cdm_config,
scoped_ptr<CdmAllocator> allocator,
+ const CdmFileIOProviderCB& file_io_provider_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const LegacySessionErrorCB& legacy_session_error_cb,
@@ -347,9 +349,9 @@ 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), file_io_provider_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(
@@ -362,6 +364,7 @@ CdmAdapter::CdmAdapter(
const std::string& key_system,
const CdmConfig& cdm_config,
scoped_ptr<CdmAllocator> allocator,
+ const CdmFileIOProviderCB& file_io_provider_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)),
+ file_io_provider_cb_(file_io_provider_cb),
task_runner_(base::ThreadTaskRunnerHandle::Get()),
weak_factory_(this) {
DCHECK(!key_system_.empty());
@@ -891,13 +895,13 @@ 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;
+ // The CDM owns the returned object and must call FileIO::Close()
+ // to release it.
xhwang 2016/04/18 21:09:22 nit: Move this comment to right above the "return"
jrummell 2016/04/19 23:59:28 Done.
+ std::unique_ptr<CdmFileIO> file_io = file_io_provider_cb_.Run(client);
+ return file_io.release();
}
bool CdmAdapter::AudioFramesDataToAudioFrames(

Powered by Google App Engine
This is Rietveld 408576698