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.
5 #include "chromecast/media/cma/pipeline/video_pipeline_device_client_impl.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "chromecast/public/graphics_types.h"
13 namespace chromecast
{
16 VideoPipelineDeviceClientImpl::VideoPipelineDeviceClientImpl(
17 const SizeChangeCB
& size_change_cb
)
18 : size_change_cb_(size_change_cb
),
19 task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
21 VideoPipelineDeviceClientImpl::~VideoPipelineDeviceClientImpl() {}
23 void VideoPipelineDeviceClientImpl::OnNaturalSizeChanged(const Size
& size
) {
24 if (task_runner_
->BelongsToCurrentThread()) {
25 if (!size_change_cb_
.is_null())
26 size_change_cb_
.Run(size
);
28 task_runner_
->PostTask(FROM_HERE
, base::Bind(size_change_cb_
, size
));
33 } // namespace chromecast