| 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/base/video_renderer_sink.h" |
| 15 #include "media/mojo/services/mojo_demuxer_stream_impl.h" | 16 #include "media/mojo/services/mojo_demuxer_stream_impl.h" |
| 17 #include "media/renderers/video_overlay_factory.h" |
| 16 #include "mojo/converters/geometry/geometry_type_converters.h" | 18 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 17 | 19 |
| 18 namespace media { | 20 namespace media { |
| 19 | 21 |
| 20 MojoRendererImpl::MojoRendererImpl( | 22 MojoRendererImpl::MojoRendererImpl( |
| 21 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 23 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 24 std::unique_ptr<VideoOverlayFactory> video_overlay_factory, |
| 25 VideoRendererSink* video_renderer_sink, |
| 22 mojom::RendererPtr remote_renderer) | 26 mojom::RendererPtr remote_renderer) |
| 23 : task_runner_(task_runner), | 27 : task_runner_(task_runner), |
| 28 video_overlay_factory_(std::move(video_overlay_factory)), |
| 29 video_renderer_sink_(video_renderer_sink), |
| 24 remote_renderer_info_(remote_renderer.PassInterface()), | 30 remote_renderer_info_(remote_renderer.PassInterface()), |
| 25 binding_(this) { | 31 binding_(this) { |
| 26 DVLOG(1) << __FUNCTION__; | 32 DVLOG(1) << __FUNCTION__; |
| 27 } | 33 } |
| 28 | 34 |
| 29 MojoRendererImpl::~MojoRendererImpl() { | 35 MojoRendererImpl::~MojoRendererImpl() { |
| 30 DVLOG(1) << __FUNCTION__; | 36 DVLOG(1) << __FUNCTION__; |
| 31 DCHECK(task_runner_->BelongsToCurrentThread()); | 37 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 32 } | 38 } |
| 33 | 39 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 DVLOG(1) << __FUNCTION__; | 179 DVLOG(1) << __FUNCTION__; |
| 174 DCHECK(task_runner_->BelongsToCurrentThread()); | 180 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 175 DCHECK(init_cb_.is_null()); | 181 DCHECK(init_cb_.is_null()); |
| 176 | 182 |
| 177 // TODO(tim): Should we plumb error code from remote renderer? | 183 // TODO(tim): Should we plumb error code from remote renderer? |
| 178 // http://crbug.com/410451. | 184 // http://crbug.com/410451. |
| 179 client_->OnError(PIPELINE_ERROR_DECODE); | 185 client_->OnError(PIPELINE_ERROR_DECODE); |
| 180 } | 186 } |
| 181 | 187 |
| 182 void MojoRendererImpl::OnVideoNaturalSizeChange(mojo::SizePtr size) { | 188 void MojoRendererImpl::OnVideoNaturalSizeChange(mojo::SizePtr size) { |
| 183 DVLOG(2) << __FUNCTION__ << ": " << size->width << "," << size->height; | 189 gfx::Size new_size = size.To<gfx::Size>(); |
| 190 DVLOG(2) << __FUNCTION__ << ": " << new_size.ToString(); |
| 184 DCHECK(task_runner_->BelongsToCurrentThread()); | 191 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 185 client_->OnVideoNaturalSizeChange(size.To<gfx::Size>()); | 192 |
| 193 video_renderer_sink_->PaintFrameUsingOldRenderingPath( |
| 194 video_overlay_factory_->CreateFrame(new_size)); |
| 195 client_->OnVideoNaturalSizeChange(new_size); |
| 186 } | 196 } |
| 187 | 197 |
| 188 void MojoRendererImpl::OnVideoOpacityChange(bool opaque) { | 198 void MojoRendererImpl::OnVideoOpacityChange(bool opaque) { |
| 189 DVLOG(2) << __FUNCTION__ << ": " << opaque; | 199 DVLOG(2) << __FUNCTION__ << ": " << opaque; |
| 190 DCHECK(task_runner_->BelongsToCurrentThread()); | 200 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 191 client_->OnVideoOpacityChange(opaque); | 201 client_->OnVideoOpacityChange(opaque); |
| 192 } | 202 } |
| 193 | 203 |
| 194 void MojoRendererImpl::OnConnectionError() { | 204 void MojoRendererImpl::OnConnectionError() { |
| 195 DVLOG(1) << __FUNCTION__; | 205 DVLOG(1) << __FUNCTION__; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 206 void MojoRendererImpl::OnInitialized(bool success) { | 216 void MojoRendererImpl::OnInitialized(bool success) { |
| 207 DVLOG(1) << __FUNCTION__; | 217 DVLOG(1) << __FUNCTION__; |
| 208 DCHECK(task_runner_->BelongsToCurrentThread()); | 218 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 209 DCHECK(!init_cb_.is_null()); | 219 DCHECK(!init_cb_.is_null()); |
| 210 | 220 |
| 211 base::ResetAndReturn(&init_cb_) | 221 base::ResetAndReturn(&init_cb_) |
| 212 .Run(success ? PIPELINE_OK : PIPELINE_ERROR_INITIALIZATION_FAILED); | 222 .Run(success ? PIPELINE_OK : PIPELINE_ERROR_INITIALIZATION_FAILED); |
| 213 } | 223 } |
| 214 | 224 |
| 215 } // namespace media | 225 } // namespace media |
| OLD | NEW |