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 "media/mojo/services/mojo_renderer_impl.h" | 5 #include "media/mojo/services/mojo_renderer_impl.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/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Bind the mojo InterfacePtr to the message pipe on the | 48 // Bind the mojo InterfacePtr to the message pipe on the |
49 // current thread so we can use it. The MojoRendererImpl object | 49 // current thread so we can use it. The MojoRendererImpl object |
50 // is constructed on another thread so we can't do it in the | 50 // is constructed on another thread so we can't do it in the |
51 // constructor and must pass a message pipe around since | 51 // constructor and must pass a message pipe around since |
52 // InterfacePtr's are tied to the message loop they were created on. | 52 // InterfacePtr's are tied to the message loop they were created on. |
53 remote_media_renderer_.Bind(remote_media_renderer_pipe_.Pass()); | 53 remote_media_renderer_.Bind(remote_media_renderer_pipe_.Pass()); |
54 DCHECK(remote_media_renderer_); | 54 DCHECK(remote_media_renderer_); |
55 remote_media_renderer_.set_client(this); | 55 remote_media_renderer_.set_client(this); |
56 | 56 |
57 demuxer_stream_provider_ = demuxer_stream_provider; | 57 demuxer_stream_provider_ = demuxer_stream_provider; |
58 // |init_cb| can be called on other thread. | |
59 init_cb_ = init_cb; | 58 init_cb_ = init_cb; |
60 ended_cb_ = ended_cb; | 59 ended_cb_ = ended_cb; |
61 error_cb_ = error_cb; | 60 error_cb_ = error_cb; |
62 buffering_state_cb_ = buffering_state_cb; | 61 buffering_state_cb_ = buffering_state_cb; |
63 | 62 |
64 // Create audio and video mojo::DemuxerStream and bind its lifetime to the | 63 // Create audio and video mojo::DemuxerStream and bind its lifetime to the |
65 // pipe. | 64 // pipe. |
66 DemuxerStream* const audio = | 65 DemuxerStream* const audio = |
67 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO); | 66 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO); |
68 DemuxerStream* const video = | 67 DemuxerStream* const video = |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 207 |
209 void MojoRendererImpl::OnInitialized() { | 208 void MojoRendererImpl::OnInitialized() { |
210 DVLOG(1) << __FUNCTION__; | 209 DVLOG(1) << __FUNCTION__; |
211 DCHECK(task_runner_->BelongsToCurrentThread()); | 210 DCHECK(task_runner_->BelongsToCurrentThread()); |
212 DCHECK(!init_cb_.is_null()); | 211 DCHECK(!init_cb_.is_null()); |
213 | 212 |
214 base::ResetAndReturn(&init_cb_).Run(); | 213 base::ResetAndReturn(&init_cb_).Run(); |
215 } | 214 } |
216 | 215 |
217 } // namespace media | 216 } // namespace media |
OLD | NEW |