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