| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chromecast/renderer/media/video_pipeline_proxy.h" | 5 #include "chromecast/renderer/media/video_pipeline_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "chromecast/common/media/cma_ipc_common.h" | 12 #include "chromecast/common/media/cma_ipc_common.h" |
| 13 #include "chromecast/common/media/cma_messages.h" | 13 #include "chromecast/common/media/cma_messages.h" |
| 14 #include "chromecast/common/media/shared_memory_chunk.h" | 14 #include "chromecast/common/media/shared_memory_chunk.h" |
| 15 #include "chromecast/media/cma/base/buffering_defs.h" | 15 #include "chromecast/media/cma/base/buffering_defs.h" |
| 16 #include "chromecast/media/cma/base/cma_logging.h" | 16 #include "chromecast/media/cma/base/cma_logging.h" |
| 17 #include "chromecast/media/cma/base/coded_frame_provider.h" | 17 #include "chromecast/media/cma/base/coded_frame_provider.h" |
| 18 #include "chromecast/media/cma/ipc/media_message_fifo.h" | 18 #include "chromecast/media/cma/ipc/media_message_fifo.h" |
| 19 #include "chromecast/media/cma/ipc_streamer/av_streamer_proxy.h" | 19 #include "chromecast/media/cma/ipc_streamer/av_streamer_proxy.h" |
| 20 #include "chromecast/media/cma/pipeline/video_pipeline_client.h" |
| 20 #include "chromecast/renderer/media/cma_message_filter_proxy.h" | 21 #include "chromecast/renderer/media/cma_message_filter_proxy.h" |
| 21 #include "chromecast/renderer/media/media_channel_proxy.h" | 22 #include "chromecast/renderer/media/media_channel_proxy.h" |
| 22 #include "media/base/bind_to_current_loop.h" | 23 #include "media/base/bind_to_current_loop.h" |
| 23 #include "media/base/pipeline_status.h" | 24 #include "media/base/pipeline_status.h" |
| 24 | 25 |
| 25 namespace chromecast { | 26 namespace chromecast { |
| 26 namespace media { | 27 namespace media { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 207 } |
| 207 | 208 |
| 208 VideoPipelineProxy::~VideoPipelineProxy() { | 209 VideoPipelineProxy::~VideoPipelineProxy() { |
| 209 DCHECK(thread_checker_.CalledOnValidThread()); | 210 DCHECK(thread_checker_.CalledOnValidThread()); |
| 210 // Release the underlying object on the right thread. | 211 // Release the underlying object on the right thread. |
| 211 io_task_runner_->PostTask( | 212 io_task_runner_->PostTask( |
| 212 FROM_HERE, | 213 FROM_HERE, |
| 213 base::Bind(&VideoPipelineProxyInternal::Release, base::Passed(&proxy_))); | 214 base::Bind(&VideoPipelineProxyInternal::Release, base::Passed(&proxy_))); |
| 214 } | 215 } |
| 215 | 216 |
| 216 void VideoPipelineProxy::SetClient( | 217 void VideoPipelineProxy::SetClient(const VideoPipelineClient& video_client) { |
| 217 const VideoPipelineClient& video_client) { | |
| 218 DCHECK(thread_checker_.CalledOnValidThread()); | 218 DCHECK(thread_checker_.CalledOnValidThread()); |
| 219 base::Closure pipe_read_cb = | 219 base::Closure pipe_read_cb = |
| 220 ::media::BindToCurrentLoop( | 220 ::media::BindToCurrentLoop( |
| 221 base::Bind(&VideoPipelineProxy::OnPipeRead, weak_this_)); | 221 base::Bind(&VideoPipelineProxy::OnPipeRead, weak_this_)); |
| 222 FORWARD_ON_IO_THREAD(SetClient, pipe_read_cb, video_client); | 222 FORWARD_ON_IO_THREAD(SetClient, pipe_read_cb, video_client); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void VideoPipelineProxy::Initialize( | 225 void VideoPipelineProxy::Initialize( |
| 226 const std::vector<::media::VideoDecoderConfig>& configs, | 226 const std::vector<::media::VideoDecoderConfig>& configs, |
| 227 scoped_ptr<CodedFrameProvider> frame_provider, | 227 scoped_ptr<CodedFrameProvider> frame_provider, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 FORWARD_ON_IO_THREAD(NotifyPipeWrite); | 287 FORWARD_ON_IO_THREAD(NotifyPipeWrite); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void VideoPipelineProxy::OnPipeRead() { | 290 void VideoPipelineProxy::OnPipeRead() { |
| 291 DCHECK(thread_checker_.CalledOnValidThread()); | 291 DCHECK(thread_checker_.CalledOnValidThread()); |
| 292 if (video_streamer_) | 292 if (video_streamer_) |
| 293 video_streamer_->OnFifoReadEvent(); | 293 video_streamer_->OnFifoReadEvent(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace media | 296 } // namespace media |
| 297 } // namespace chromecast | 297 } // namespace chromecast |
| OLD | NEW |