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

Side by Side Diff: media/mojo/clients/mojo_renderer.cc

Issue 2101043003: Plumb callbacks from mojo media service to client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 5 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/clients/mojo_renderer.h" 5 #include "media/mojo/clients/mojo_renderer.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/pipeline_status.h"
14 #include "media/base/renderer_client.h" 15 #include "media/base/renderer_client.h"
15 #include "media/base/video_renderer_sink.h" 16 #include "media/base/video_renderer_sink.h"
16 #include "media/mojo/clients/mojo_demuxer_stream_impl.h" 17 #include "media/mojo/clients/mojo_demuxer_stream_impl.h"
18 #include "media/mojo/common/media_type_converters.h"
17 #include "media/renderers/video_overlay_factory.h" 19 #include "media/renderers/video_overlay_factory.h"
18 20
19 namespace media { 21 namespace media {
20 22
21 MojoRenderer::MojoRenderer( 23 MojoRenderer::MojoRenderer(
22 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 24 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
23 std::unique_ptr<VideoOverlayFactory> video_overlay_factory, 25 std::unique_ptr<VideoOverlayFactory> video_overlay_factory,
24 VideoRendererSink* video_renderer_sink, 26 VideoRendererSink* video_renderer_sink,
25 mojom::RendererPtr remote_renderer) 27 mojom::RendererPtr remote_renderer)
26 : task_runner_(task_runner), 28 : task_runner_(task_runner),
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 video_overlay_factory_->CreateFrame(size)); 234 video_overlay_factory_->CreateFrame(size));
233 client_->OnVideoNaturalSizeChange(size); 235 client_->OnVideoNaturalSizeChange(size);
234 } 236 }
235 237
236 void MojoRenderer::OnVideoOpacityChange(bool opaque) { 238 void MojoRenderer::OnVideoOpacityChange(bool opaque) {
237 DVLOG(2) << __FUNCTION__ << ": " << opaque; 239 DVLOG(2) << __FUNCTION__ << ": " << opaque;
238 DCHECK(task_runner_->BelongsToCurrentThread()); 240 DCHECK(task_runner_->BelongsToCurrentThread());
239 client_->OnVideoOpacityChange(opaque); 241 client_->OnVideoOpacityChange(opaque);
240 } 242 }
241 243
244 void MojoRenderer::OnStatisticsUpdate(mojom::PipelineStatisticsPtr stats) {
245 DVLOG(2) << __FUNCTION__;
alokp 2016/06/27 21:50:48 This fires too often. I would use a level 3 here.
slan 2016/06/27 22:19:39 Done.
246 DCHECK(task_runner_->BelongsToCurrentThread());
247 client_->OnStatisticsUpdate(stats.To<PipelineStatistics>());
248 }
249
250 void MojoRenderer::OnWaitingForDecryptionKey() {
251 DVLOG(2) << __FUNCTION__;
alokp 2016/06/27 21:50:48 level 1 here.
slan 2016/06/27 22:19:39 Done.
252 DCHECK(task_runner_->BelongsToCurrentThread());
253 client_->OnWaitingForDecryptionKey();
254 }
255
242 void MojoRenderer::OnConnectionError() { 256 void MojoRenderer::OnConnectionError() {
243 DVLOG(1) << __FUNCTION__; 257 DVLOG(1) << __FUNCTION__;
244 DCHECK(task_runner_->BelongsToCurrentThread()); 258 DCHECK(task_runner_->BelongsToCurrentThread());
245 259
246 encountered_error_ = true; 260 encountered_error_ = true;
247 CancelPendingCallbacks(); 261 CancelPendingCallbacks();
248 262
249 if (client_) 263 if (client_)
250 client_->OnError(PIPELINE_ERROR_DECODE); 264 client_->OnError(PIPELINE_ERROR_DECODE);
251 } 265 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); 336 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED);
323 337
324 if (!flush_cb_.is_null()) 338 if (!flush_cb_.is_null())
325 base::ResetAndReturn(&flush_cb_).Run(); 339 base::ResetAndReturn(&flush_cb_).Run();
326 340
327 if (!cdm_attached_cb_.is_null()) 341 if (!cdm_attached_cb_.is_null())
328 base::ResetAndReturn(&cdm_attached_cb_).Run(false); 342 base::ResetAndReturn(&cdm_attached_cb_).Run(false);
329 } 343 }
330 344
331 } // namespace media 345 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698