| Index: chromecast/media/cma/pipeline/frame_status_cb_impl.cc
|
| diff --git a/chromecast/media/cma/pipeline/frame_status_cb_impl.cc b/chromecast/media/cma/pipeline/frame_status_cb_impl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..06769f7e0b6bc8c8c6bafeadfd09b5e7e6e128f8
|
| --- /dev/null
|
| +++ b/chromecast/media/cma/pipeline/frame_status_cb_impl.cc
|
| @@ -0,0 +1,30 @@
|
| +// 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/media/cma/pipeline/frame_status_cb_impl.h"
|
| +
|
| +#include "base/bind.h"
|
| +#include "base/location.h"
|
| +#include "base/single_thread_task_runner.h"
|
| +#include "base/thread_task_runner_handle.h"
|
| +
|
| +namespace chromecast {
|
| +namespace media {
|
| +
|
| +FrameStatusCBImpl::FrameStatusCBImpl(const CallbackType& cb)
|
| + : cb_(cb), task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
|
| +
|
| +FrameStatusCBImpl::~FrameStatusCBImpl() {}
|
| +
|
| +void FrameStatusCBImpl::Run(MediaComponentDevice::FrameStatus status) {
|
| + if (task_runner_->BelongsToCurrentThread()) {
|
| + if (!cb_.is_null())
|
| + cb_.Run(status);
|
| + } else {
|
| + task_runner_->PostTask(FROM_HERE, base::Bind(cb_, status));
|
| + }
|
| +}
|
| +
|
| +} // namespace media
|
| +} // namespace chromecast
|
|
|