OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chromecast/media/cma/pipeline/media_component_device_client_impl.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 11 |
| 12 namespace chromecast { |
| 13 namespace media { |
| 14 |
| 15 MediaComponentDeviceClientImpl::MediaComponentDeviceClientImpl( |
| 16 const base::Closure& eos_cb) |
| 17 : eos_cb_(eos_cb), task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
| 18 |
| 19 MediaComponentDeviceClientImpl::~MediaComponentDeviceClientImpl() {} |
| 20 |
| 21 void MediaComponentDeviceClientImpl::OnEndOfStream() { |
| 22 if (task_runner_->BelongsToCurrentThread()) { |
| 23 if (!eos_cb_.is_null()) |
| 24 eos_cb_.Run(); |
| 25 } else { |
| 26 task_runner_->PostTask(FROM_HERE, eos_cb_); |
| 27 } |
| 28 } |
| 29 |
| 30 } // namespace media |
| 31 } // namespace chromecast |
OLD | NEW |