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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 MojoRendererImpl::~MojoRendererImpl() { | 29 MojoRendererImpl::~MojoRendererImpl() { |
30 DVLOG(1) << __FUNCTION__; | 30 DVLOG(1) << __FUNCTION__; |
31 DCHECK(task_runner_->BelongsToCurrentThread()); | 31 DCHECK(task_runner_->BelongsToCurrentThread()); |
32 // Connection to |remote_media_renderer_| will error-out here. | 32 // Connection to |remote_media_renderer_| will error-out here. |
33 } | 33 } |
34 | 34 |
35 // TODO(xhwang): Support |paint_cb| if needed. | 35 // TODO(xhwang): Support |paint_cb| if needed. |
36 void MojoRendererImpl::Initialize( | 36 void MojoRendererImpl::Initialize( |
37 DemuxerStreamProvider* demuxer_stream_provider, | 37 DemuxerStreamProvider* demuxer_stream_provider, |
38 const base::Closure& init_cb, | 38 const PipelineStatusCB& init_cb, |
39 const StatisticsCB& statistics_cb, | 39 const StatisticsCB& statistics_cb, |
40 const BufferingStateCB& buffering_state_cb, | 40 const BufferingStateCB& buffering_state_cb, |
41 const PaintCB& /* paint_cb */, | 41 const PaintCB& /* paint_cb */, |
42 const base::Closure& ended_cb, | 42 const base::Closure& ended_cb, |
43 const PipelineStatusCB& error_cb) { | 43 const PipelineStatusCB& error_cb) { |
44 DVLOG(1) << __FUNCTION__; | 44 DVLOG(1) << __FUNCTION__; |
45 DCHECK(task_runner_->BelongsToCurrentThread()); | 45 DCHECK(task_runner_->BelongsToCurrentThread()); |
46 DCHECK(demuxer_stream_provider); | 46 DCHECK(demuxer_stream_provider); |
47 | 47 |
48 // Bind the mojo InterfacePtr to the message pipe on the | 48 // Bind the mojo InterfacePtr to the message pipe on the |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 FROM_HERE, | 195 FROM_HERE, |
196 base::Bind(&MojoRendererImpl::OnError, weak_factory_.GetWeakPtr())); | 196 base::Bind(&MojoRendererImpl::OnError, weak_factory_.GetWeakPtr())); |
197 return; | 197 return; |
198 } | 198 } |
199 | 199 |
200 // TODO(tim): Should we plumb error code from remote renderer? | 200 // TODO(tim): Should we plumb error code from remote renderer? |
201 // http://crbug.com/410451. | 201 // http://crbug.com/410451. |
202 if (init_cb_.is_null()) // We have initialized already. | 202 if (init_cb_.is_null()) // We have initialized already. |
203 error_cb_.Run(PIPELINE_ERROR_DECODE); | 203 error_cb_.Run(PIPELINE_ERROR_DECODE); |
204 else | 204 else |
205 error_cb_.Run(PIPELINE_ERROR_COULD_NOT_RENDER); | 205 init_cb_.Run(PIPELINE_ERROR_COULD_NOT_RENDER); |
206 } | 206 } |
207 | 207 |
208 void MojoRendererImpl::OnInitialized() { | 208 void MojoRendererImpl::OnInitialized() { |
209 DVLOG(1) << __FUNCTION__; | 209 DVLOG(1) << __FUNCTION__; |
210 DCHECK(task_runner_->BelongsToCurrentThread()); | 210 DCHECK(task_runner_->BelongsToCurrentThread()); |
211 DCHECK(!init_cb_.is_null()); | 211 if (!init_cb_.is_null()) |
212 | 212 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
213 base::ResetAndReturn(&init_cb_).Run(); | |
214 } | 213 } |
215 | 214 |
216 } // namespace media | 215 } // namespace media |
OLD | NEW |