Chromium Code Reviews| 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 |