Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: media/mojo/services/mojo_renderer_impl.cc

Issue 2008193002: Change mojo geometry structs from using type converters to StructTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/base/video_renderer_sink.h"
16 #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" 17 #include "media/renderers/video_overlay_factory.h"
18 #include "ui/gfx/geometry/mojo/geometry_type_converters.h"
19 18
20 namespace media { 19 namespace media {
21 20
22 MojoRendererImpl::MojoRendererImpl( 21 MojoRendererImpl::MojoRendererImpl(
23 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 22 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
24 std::unique_ptr<VideoOverlayFactory> video_overlay_factory, 23 std::unique_ptr<VideoOverlayFactory> video_overlay_factory,
25 VideoRendererSink* video_renderer_sink, 24 VideoRendererSink* video_renderer_sink,
26 mojom::RendererPtr remote_renderer) 25 mojom::RendererPtr remote_renderer)
27 : task_runner_(task_runner), 26 : task_runner_(task_runner),
28 video_overlay_factory_(std::move(video_overlay_factory)), 27 video_overlay_factory_(std::move(video_overlay_factory)),
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 void MojoRendererImpl::OnError() { 177 void MojoRendererImpl::OnError() {
179 DVLOG(1) << __FUNCTION__; 178 DVLOG(1) << __FUNCTION__;
180 DCHECK(task_runner_->BelongsToCurrentThread()); 179 DCHECK(task_runner_->BelongsToCurrentThread());
181 DCHECK(init_cb_.is_null()); 180 DCHECK(init_cb_.is_null());
182 181
183 // TODO(tim): Should we plumb error code from remote renderer? 182 // TODO(tim): Should we plumb error code from remote renderer?
184 // http://crbug.com/410451. 183 // http://crbug.com/410451.
185 client_->OnError(PIPELINE_ERROR_DECODE); 184 client_->OnError(PIPELINE_ERROR_DECODE);
186 } 185 }
187 186
188 void MojoRendererImpl::OnVideoNaturalSizeChange(mojo::SizePtr size) { 187 void MojoRendererImpl::OnVideoNaturalSizeChange(const gfx::Size& size) {
189 gfx::Size new_size = size.To<gfx::Size>(); 188 DVLOG(2) << __FUNCTION__ << ": " << size.ToString();
190 DVLOG(2) << __FUNCTION__ << ": " << new_size.ToString();
191 DCHECK(task_runner_->BelongsToCurrentThread()); 189 DCHECK(task_runner_->BelongsToCurrentThread());
192 190
193 video_renderer_sink_->PaintSingleFrame( 191 video_renderer_sink_->PaintSingleFrame(
194 video_overlay_factory_->CreateFrame(new_size)); 192 video_overlay_factory_->CreateFrame(size));
195 client_->OnVideoNaturalSizeChange(new_size); 193 client_->OnVideoNaturalSizeChange(size);
196 } 194 }
197 195
198 void MojoRendererImpl::OnVideoOpacityChange(bool opaque) { 196 void MojoRendererImpl::OnVideoOpacityChange(bool opaque) {
199 DVLOG(2) << __FUNCTION__ << ": " << opaque; 197 DVLOG(2) << __FUNCTION__ << ": " << opaque;
200 DCHECK(task_runner_->BelongsToCurrentThread()); 198 DCHECK(task_runner_->BelongsToCurrentThread());
201 client_->OnVideoOpacityChange(opaque); 199 client_->OnVideoOpacityChange(opaque);
202 } 200 }
203 201
204 void MojoRendererImpl::OnConnectionError() { 202 void MojoRendererImpl::OnConnectionError() {
205 DVLOG(1) << __FUNCTION__; 203 DVLOG(1) << __FUNCTION__;
(...skipping 10 matching lines...) Expand all
216 void MojoRendererImpl::OnInitialized(bool success) { 214 void MojoRendererImpl::OnInitialized(bool success) {
217 DVLOG(1) << __FUNCTION__; 215 DVLOG(1) << __FUNCTION__;
218 DCHECK(task_runner_->BelongsToCurrentThread()); 216 DCHECK(task_runner_->BelongsToCurrentThread());
219 DCHECK(!init_cb_.is_null()); 217 DCHECK(!init_cb_.is_null());
220 218
221 base::ResetAndReturn(&init_cb_) 219 base::ResetAndReturn(&init_cb_)
222 .Run(success ? PIPELINE_OK : PIPELINE_ERROR_INITIALIZATION_FAILED); 220 .Run(success ? PIPELINE_OK : PIPELINE_ERROR_INITIALIZATION_FAILED);
223 } 221 }
224 222
225 } // namespace media 223 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698