| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 buffering_state_cb_ = buffering_state_cb; | 54 buffering_state_cb_ = buffering_state_cb; |
| 55 | 55 |
| 56 // Create audio and video mojo::DemuxerStream and bind its lifetime to the | 56 // Create audio and video mojo::DemuxerStream and bind its lifetime to the |
| 57 // pipe. | 57 // pipe. |
| 58 DemuxerStream* const audio = | 58 DemuxerStream* const audio = |
| 59 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO); | 59 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO); |
| 60 DemuxerStream* const video = | 60 DemuxerStream* const video = |
| 61 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO); | 61 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO); |
| 62 | 62 |
| 63 mojo::DemuxerStreamPtr audio_stream; | 63 mojo::DemuxerStreamPtr audio_stream; |
| 64 if (audio) { | 64 if (audio) |
| 65 mojo::BindToProxy(new MojoDemuxerStreamImpl(audio), &audio_stream) | 65 mojo::BindToProxy(new MojoDemuxerStreamImpl(audio), &audio_stream); |
| 66 ->DidConnect(); | |
| 67 } | |
| 68 | 66 |
| 69 mojo::DemuxerStreamPtr video_stream; | 67 mojo::DemuxerStreamPtr video_stream; |
| 70 if (video) { | 68 if (video) |
| 71 mojo::BindToProxy(new MojoDemuxerStreamImpl(video), &video_stream) | 69 mojo::BindToProxy(new MojoDemuxerStreamImpl(video), &video_stream); |
| 72 ->DidConnect(); | |
| 73 } | |
| 74 | 70 |
| 75 remote_audio_renderer_->Initialize( | 71 remote_audio_renderer_->Initialize( |
| 76 audio_stream.Pass(), | 72 audio_stream.Pass(), |
| 77 video_stream.Pass(), | 73 video_stream.Pass(), |
| 78 BindToCurrentLoop(base::Bind(&MojoRendererImpl::OnInitialized, | 74 BindToCurrentLoop(base::Bind(&MojoRendererImpl::OnInitialized, |
| 79 weak_factory_.GetWeakPtr()))); | 75 weak_factory_.GetWeakPtr()))); |
| 80 } | 76 } |
| 81 | 77 |
| 82 void MojoRendererImpl::Flush(const base::Closure& flush_cb) { | 78 void MojoRendererImpl::Flush(const base::Closure& flush_cb) { |
| 83 DVLOG(2) << __FUNCTION__; | 79 DVLOG(2) << __FUNCTION__; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 194 |
| 199 void MojoRendererImpl::OnInitialized() { | 195 void MojoRendererImpl::OnInitialized() { |
| 200 DVLOG(1) << __FUNCTION__; | 196 DVLOG(1) << __FUNCTION__; |
| 201 DCHECK(task_runner_->BelongsToCurrentThread()); | 197 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 202 DCHECK(!init_cb_.is_null()); | 198 DCHECK(!init_cb_.is_null()); |
| 203 | 199 |
| 204 base::ResetAndReturn(&init_cb_).Run(); | 200 base::ResetAndReturn(&init_cb_).Run(); |
| 205 } | 201 } |
| 206 | 202 |
| 207 } // namespace media | 203 } // namespace media |
| OLD | NEW |