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

Unified Diff: chromecast/media/cma/pipeline/av_pipeline_impl.cc

Issue 1257013003: Load CMA backend from shared library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 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: chromecast/media/cma/pipeline/av_pipeline_impl.cc
diff --git a/chromecast/media/cma/pipeline/av_pipeline_impl.cc b/chromecast/media/cma/pipeline/av_pipeline_impl.cc
index ab0a2a75d0c319bc5db3ab5a8f56666c784a361d..7046b01d44f97859c0bf7d0a1c9df9e77b9ec9fa 100644
--- a/chromecast/media/cma/pipeline/av_pipeline_impl.cc
+++ b/chromecast/media/cma/pipeline/av_pipeline_impl.cc
@@ -9,16 +9,20 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/thread_task_runner_handle.h"
-#include "chromecast/media/base/decrypt_context.h"
+#include "chromecast/media/base/decrypt_context_impl.h"
#include "chromecast/media/cdm/browser_cdm_cast.h"
-#include "chromecast/media/cma/backend/media_clock_device.h"
-#include "chromecast/media/cma/backend/media_component_device.h"
#include "chromecast/media/cma/base/buffering_frame_provider.h"
#include "chromecast/media/cma/base/buffering_state.h"
+#include "chromecast/media/cma/base/cast_decoder_buffer_impl.h"
#include "chromecast/media/cma/base/cma_logging.h"
#include "chromecast/media/cma/base/coded_frame_provider.h"
#include "chromecast/media/cma/base/decoder_buffer_base.h"
#include "chromecast/media/cma/pipeline/decrypt_util.h"
+#include "chromecast/media/cma/pipeline/frame_status_cb_impl.h"
+#include "chromecast/media/cma/pipeline/media_component_device_client_impl.h"
+#include "chromecast/public/media/cast_decrypt_config.h"
+#include "chromecast/public/media/media_clock_device.h"
+#include "chromecast/public/media/media_component_device.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/buffers.h"
@@ -33,9 +37,8 @@ const int kNoCallbackId = -1;
} // namespace
-AvPipelineImpl::AvPipelineImpl(
- MediaComponentDevice* media_component_device,
- const UpdateConfigCB& update_config_cb)
+AvPipelineImpl::AvPipelineImpl(MediaComponentDevice* media_component_device,
+ const UpdateConfigCB& update_config_cb)
: update_config_cb_(update_config_cb),
media_component_device_(media_component_device),
state_(kUninitialized),
@@ -56,7 +59,7 @@ AvPipelineImpl::AvPipelineImpl(
AvPipelineImpl::~AvPipelineImpl() {
DCHECK(thread_checker_.CalledOnValidThread());
- media_component_device_->SetClient(MediaComponentDevice::Client());
+ media_component_device_->SetClient(nullptr);
if (media_keys_ && media_keys_callback_id_ != kNoCallbackId)
media_keys_->UnregisterPlayer(media_keys_callback_id_);
@@ -93,9 +96,8 @@ bool AvPipelineImpl::Initialize() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_EQ(state_, kUninitialized);
- MediaComponentDevice::Client client;
- client.eos_cb = base::Bind(&AvPipelineImpl::OnEos, weak_this_);
- media_component_device_->SetClient(client);
+ media_component_device_->SetClient(new MediaComponentDeviceClientImpl(
+ base::Bind(&AvPipelineImpl::OnEos, weak_this_)));
if (!media_component_device_->SetState(MediaComponentDevice::kStateIdle))
return false;
@@ -110,7 +112,7 @@ bool AvPipelineImpl::StartPlayingFrom(
// Media time where rendering should start
// and switch to a state where the audio device accepts incoming buffers.
- if (!media_component_device_->SetStartPts(time) ||
+ if (!media_component_device_->SetStartPts(time.InMicroseconds()) ||
!media_component_device_->SetState(MediaComponentDevice::kStatePaused)) {
return false;
}
@@ -252,7 +254,7 @@ void AvPipelineImpl::ProcessPendingBuffer() {
enable_feeding_ = false;
}
- scoped_refptr<DecryptContext> decrypt_context;
+ scoped_ptr<DecryptContextImpl> decrypt_context;
if (!pending_buffer_->end_of_stream() &&
pending_buffer_->decrypt_config()) {
// Verify that CDM has the key ID.
@@ -277,7 +279,7 @@ void AvPipelineImpl::ProcessPendingBuffer() {
crypto::SymmetricKey* key = decrypt_context->GetKey();
if (key != NULL) {
pending_buffer_ = DecryptDecoderBuffer(pending_buffer_, key);
- decrypt_context = scoped_refptr<DecryptContext>();
+ decrypt_context.reset();
}
}
@@ -288,9 +290,9 @@ void AvPipelineImpl::ProcessPendingBuffer() {
}
MediaComponentDevice::FrameStatus status = media_component_device_->PushFrame(
- decrypt_context,
- pending_buffer_,
- base::Bind(&AvPipelineImpl::OnFramePushed, weak_this_));
+ decrypt_context.release(), new CastDecoderBufferImpl(pending_buffer_),
+ new FrameStatusCBImpl(
+ base::Bind(&AvPipelineImpl::OnFramePushed, weak_this_)));
pending_buffer_ = scoped_refptr<DecoderBufferBase>();
pending_push_ = (status == MediaComponentDevice::kFramePending);
@@ -335,9 +337,8 @@ void AvPipelineImpl::OnFrameBuffered(
if (!buffering_state_.get())
return;
- if (!buffer->end_of_stream() &&
- (buffered_time_ == ::media::kNoTimestamp() ||
- buffered_time_ < buffer->timestamp())) {
+ if (!buffer->end_of_stream() && (buffered_time_ == ::media::kNoTimestamp() ||
+ buffered_time_ < buffer->timestamp())) {
buffered_time_ = buffer->timestamp();
}
@@ -360,7 +361,7 @@ void AvPipelineImpl::UpdatePlayableFrames() {
if (non_playable_frame->end_of_stream()) {
buffering_state_->NotifyEos();
} else {
- const ::media::DecryptConfig* decrypt_config =
+ const CastDecryptConfig* decrypt_config =
non_playable_frame->decrypt_config();
if (decrypt_config &&
!(media_keys_ &&

Powered by Google App Engine
This is Rietveld 408576698