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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "media/base/demuxer_stream_provider.h" | 13 #include "media/base/demuxer_stream_provider.h" |
14 #include "media/base/renderer_client.h" | 14 #include "media/base/renderer_client.h" |
15 #include "media/mojo/services/mojo_demuxer_stream_impl.h" | 15 #include "media/mojo/services/mojo_demuxer_stream_impl.h" |
| 16 #include "mojo/converters/geometry/geometry_type_converters.h" |
16 | 17 |
17 namespace media { | 18 namespace media { |
18 | 19 |
19 MojoRendererImpl::MojoRendererImpl( | 20 MojoRendererImpl::MojoRendererImpl( |
20 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 21 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
21 interfaces::RendererPtr remote_renderer) | 22 interfaces::RendererPtr remote_renderer) |
22 : task_runner_(task_runner), | 23 : task_runner_(task_runner), |
23 remote_renderer_info_(remote_renderer.PassInterface()), | 24 remote_renderer_info_(remote_renderer.PassInterface()), |
24 binding_(this) { | 25 binding_(this) { |
25 DVLOG(1) << __FUNCTION__; | 26 DVLOG(1) << __FUNCTION__; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 void MojoRendererImpl::OnError() { | 173 void MojoRendererImpl::OnError() { |
173 DVLOG(1) << __FUNCTION__; | 174 DVLOG(1) << __FUNCTION__; |
174 DCHECK(task_runner_->BelongsToCurrentThread()); | 175 DCHECK(task_runner_->BelongsToCurrentThread()); |
175 DCHECK(init_cb_.is_null()); | 176 DCHECK(init_cb_.is_null()); |
176 | 177 |
177 // TODO(tim): Should we plumb error code from remote renderer? | 178 // TODO(tim): Should we plumb error code from remote renderer? |
178 // http://crbug.com/410451. | 179 // http://crbug.com/410451. |
179 client_->OnError(PIPELINE_ERROR_DECODE); | 180 client_->OnError(PIPELINE_ERROR_DECODE); |
180 } | 181 } |
181 | 182 |
| 183 void MojoRendererImpl::OnVideoNaturalSizeChange(mojo::SizePtr size) { |
| 184 DVLOG(2) << __FUNCTION__ << ": " << size->width << "," << size->height; |
| 185 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 186 client_->OnVideoNaturalSizeChange(size.To<gfx::Size>()); |
| 187 } |
| 188 |
| 189 void MojoRendererImpl::OnVideoOpacityChange(bool opaque) { |
| 190 DVLOG(2) << __FUNCTION__ << ": " << opaque; |
| 191 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 192 client_->OnVideoOpacityChange(opaque); |
| 193 } |
| 194 |
182 void MojoRendererImpl::OnConnectionError() { | 195 void MojoRendererImpl::OnConnectionError() { |
183 DVLOG(1) << __FUNCTION__; | 196 DVLOG(1) << __FUNCTION__; |
184 DCHECK(task_runner_->BelongsToCurrentThread()); | 197 DCHECK(task_runner_->BelongsToCurrentThread()); |
185 | 198 |
186 if (!init_cb_.is_null()) { | 199 if (!init_cb_.is_null()) { |
187 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); | 200 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); |
188 return; | 201 return; |
189 } | 202 } |
190 | 203 |
191 client_->OnError(PIPELINE_ERROR_DECODE); | 204 client_->OnError(PIPELINE_ERROR_DECODE); |
192 } | 205 } |
193 | 206 |
194 void MojoRendererImpl::OnInitialized(bool success) { | 207 void MojoRendererImpl::OnInitialized(bool success) { |
195 DVLOG(1) << __FUNCTION__; | 208 DVLOG(1) << __FUNCTION__; |
196 DCHECK(task_runner_->BelongsToCurrentThread()); | 209 DCHECK(task_runner_->BelongsToCurrentThread()); |
197 DCHECK(!init_cb_.is_null()); | 210 DCHECK(!init_cb_.is_null()); |
198 | 211 |
199 base::ResetAndReturn(&init_cb_) | 212 base::ResetAndReturn(&init_cb_) |
200 .Run(success ? PIPELINE_OK : PIPELINE_ERROR_INITIALIZATION_FAILED); | 213 .Run(success ? PIPELINE_OK : PIPELINE_ERROR_INITIALIZATION_FAILED); |
201 } | 214 } |
202 | 215 |
203 } // namespace media | 216 } // namespace media |
OLD | NEW |