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

Unified Diff: chromecast/browser/media/cma_media_pipeline_client.cc

Issue 1306843003: CmaMediaPipelineClient to watch media pipeline status (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move CastResource to chromecast/cast 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/browser/media/cma_media_pipeline_client.cc
diff --git a/chromecast/browser/media/cma_media_pipeline_client.cc b/chromecast/browser/media/cma_media_pipeline_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..615de403fae7be704cfa3179a288c09b2867c657
--- /dev/null
+++ b/chromecast/browser/media/cma_media_pipeline_client.cc
@@ -0,0 +1,46 @@
+// Copyright 2015 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 "chromecast/browser/media/cma_media_pipeline_client.h"
+#include "chromecast/public/cast_media_shlib.h"
+
+namespace chromecast {
+namespace media {
+
+CmaMediaPipelineClient::CmaMediaPipelineClient() : client_(nullptr) {}
+
+CmaMediaPipelineClient::~CmaMediaPipelineClient() {}
+
+scoped_ptr<MediaPipelineBackend>
+CmaMediaPipelineClient::CreateMediaPipelineBackend(
+ const media::MediaPipelineDeviceParams& params) {
+ return make_scoped_ptr(CastMediaShlib::CreateMediaPipelineBackend(params));
+}
+
+void CmaMediaPipelineClient::OnMediaPipelineBackendCreated() {
+ if (client_)
+ client_->OnResourceAcquired(this);
+}
+
+void CmaMediaPipelineClient::OnMediaPipelineBackendDestroyed() {
+ if (client_)
+ client_->OnResourceReleased(this, cast::CastResource::kResourceNone);
+}
+
+void CmaMediaPipelineClient::ReleaseResource(
+ cast::CastResource::Resource resource) {
+ if (!(resource & cast::CastResource::kResourceScreenPrimary)) {
gunsch 2015/09/01 22:56:08 What threads are these called on? Should OnResour
yucliu1 2015/09/01 23:42:13 Yes, OnResourceReleased can be called from any thr
+ if (client_)
+ client_->OnResourceReleased(this,
+ cast::CastResource::kResourceScreenPrimary);
halliwell 2015/09/01 19:42:23 I actually think this is incorrect and we need to
+ }
+}
+
+void CmaMediaPipelineClient::SetCastResourceClient(
+ cast::CastResource::Client* client) {
+ client_ = client;
+}
+
+} // namespace media
+} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698