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

Side by Side Diff: media/renderers/renderer_impl.cc

Issue 935243002: Decryptors can report kNoKey to WebMediaPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android changes Created 5 years, 9 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/renderers/renderer_impl.h" 5 #include "media/renderers/renderer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // need |time_source_| (which can be |audio_renderer_|) to be alive. 49 // need |time_source_| (which can be |audio_renderer_|) to be alive.
50 video_renderer_.reset(); 50 video_renderer_.reset();
51 audio_renderer_.reset(); 51 audio_renderer_.reset();
52 52
53 if (!init_cb_.is_null()) 53 if (!init_cb_.is_null())
54 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); 54 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT);
55 else if (!flush_cb_.is_null()) 55 else if (!flush_cb_.is_null())
56 base::ResetAndReturn(&flush_cb_).Run(); 56 base::ResetAndReturn(&flush_cb_).Run();
57 } 57 }
58 58
59 void RendererImpl::Initialize(DemuxerStreamProvider* demuxer_stream_provider, 59 void RendererImpl::Initialize(
60 const PipelineStatusCB& init_cb, 60 DemuxerStreamProvider* demuxer_stream_provider,
61 const StatisticsCB& statistics_cb, 61 const PipelineStatusCB& init_cb,
62 const BufferingStateCB& buffering_state_cb, 62 const StatisticsCB& statistics_cb,
63 const PaintCB& paint_cb, 63 const BufferingStateCB& buffering_state_cb,
64 const base::Closure& ended_cb, 64 const PaintCB& paint_cb,
65 const PipelineStatusCB& error_cb) { 65 const base::Closure& ended_cb,
66 const PipelineStatusCB& error_cb,
67 const base::Closure& waiting_for_decryption_key_cb) {
66 DVLOG(1) << __FUNCTION__; 68 DVLOG(1) << __FUNCTION__;
67 DCHECK(task_runner_->BelongsToCurrentThread()); 69 DCHECK(task_runner_->BelongsToCurrentThread());
68 DCHECK_EQ(state_, STATE_UNINITIALIZED); 70 DCHECK_EQ(state_, STATE_UNINITIALIZED);
69 DCHECK(!init_cb.is_null()); 71 DCHECK(!init_cb.is_null());
70 DCHECK(!statistics_cb.is_null()); 72 DCHECK(!statistics_cb.is_null());
71 DCHECK(!buffering_state_cb.is_null()); 73 DCHECK(!buffering_state_cb.is_null());
72 DCHECK(!paint_cb.is_null()); 74 DCHECK(!paint_cb.is_null());
73 DCHECK(!ended_cb.is_null()); 75 DCHECK(!ended_cb.is_null());
74 DCHECK(!error_cb.is_null()); 76 DCHECK(!error_cb.is_null());
75 DCHECK(demuxer_stream_provider->GetStream(DemuxerStream::AUDIO) || 77 DCHECK(demuxer_stream_provider->GetStream(DemuxerStream::AUDIO) ||
76 demuxer_stream_provider->GetStream(DemuxerStream::VIDEO)); 78 demuxer_stream_provider->GetStream(DemuxerStream::VIDEO));
77 79
78 demuxer_stream_provider_ = demuxer_stream_provider; 80 demuxer_stream_provider_ = demuxer_stream_provider;
79 statistics_cb_ = statistics_cb; 81 statistics_cb_ = statistics_cb;
80 buffering_state_cb_ = buffering_state_cb; 82 buffering_state_cb_ = buffering_state_cb;
81 paint_cb_ = paint_cb; 83 paint_cb_ = paint_cb;
82 ended_cb_ = ended_cb; 84 ended_cb_ = ended_cb;
83 error_cb_ = error_cb; 85 error_cb_ = error_cb;
84 init_cb_ = init_cb; 86 init_cb_ = init_cb;
87 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb;
85 88
86 state_ = STATE_INITIALIZING; 89 state_ = STATE_INITIALIZING;
87 InitializeAudioRenderer(); 90 InitializeAudioRenderer();
88 } 91 }
89 92
90 void RendererImpl::SetCdm(CdmContext* cdm_context, 93 void RendererImpl::SetCdm(CdmContext* cdm_context,
91 const CdmAttachedCB& cdm_attached_cb) { 94 const CdmAttachedCB& cdm_attached_cb) {
92 DVLOG(1) << __FUNCTION__; 95 DVLOG(1) << __FUNCTION__;
93 DCHECK(task_runner_->BelongsToCurrentThread()); 96 DCHECK(task_runner_->BelongsToCurrentThread());
94 DCHECK(cdm_context); 97 DCHECK(cdm_context);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 254
252 // Note: After the initialization of a renderer, error events from it may 255 // Note: After the initialization of a renderer, error events from it may
253 // happen at any time and all future calls must guard against STATE_ERROR. 256 // happen at any time and all future calls must guard against STATE_ERROR.
254 audio_renderer_->Initialize( 257 audio_renderer_->Initialize(
255 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO), done_cb, 258 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO), done_cb,
256 base::Bind(&RendererImpl::SetDecryptorReadyCallback, weak_this_), 259 base::Bind(&RendererImpl::SetDecryptorReadyCallback, weak_this_),
257 base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_), 260 base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_),
258 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_, 261 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_,
259 &audio_buffering_state_), 262 &audio_buffering_state_),
260 base::Bind(&RendererImpl::OnAudioRendererEnded, weak_this_), 263 base::Bind(&RendererImpl::OnAudioRendererEnded, weak_this_),
261 base::Bind(&RendererImpl::OnError, weak_this_)); 264 base::Bind(&RendererImpl::OnError, weak_this_),
265 waiting_for_decryption_key_cb_);
262 } 266 }
263 267
264 void RendererImpl::OnAudioRendererInitializeDone(PipelineStatus status) { 268 void RendererImpl::OnAudioRendererInitializeDone(PipelineStatus status) {
265 DVLOG(1) << __FUNCTION__ << ": " << status; 269 DVLOG(1) << __FUNCTION__ << ": " << status;
266 DCHECK(task_runner_->BelongsToCurrentThread()); 270 DCHECK(task_runner_->BelongsToCurrentThread());
267 271
268 // OnError() may be fired at any time by the renderers, even if they thought 272 // OnError() may be fired at any time by the renderers, even if they thought
269 // they initialized successfully (due to delayed output device setup). 273 // they initialized successfully (due to delayed output device setup).
270 if (state_ != STATE_INITIALIZING) { 274 if (state_ != STATE_INITIALIZING) {
271 DCHECK(init_cb_.is_null()); 275 DCHECK(init_cb_.is_null());
(...skipping 28 matching lines...) Expand all
300 video_renderer_->Initialize( 304 video_renderer_->Initialize(
301 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO), done_cb, 305 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO), done_cb,
302 base::Bind(&RendererImpl::SetDecryptorReadyCallback, weak_this_), 306 base::Bind(&RendererImpl::SetDecryptorReadyCallback, weak_this_),
303 base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_), 307 base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_),
304 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_, 308 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_,
305 &video_buffering_state_), 309 &video_buffering_state_),
306 base::ResetAndReturn(&paint_cb_), 310 base::ResetAndReturn(&paint_cb_),
307 base::Bind(&RendererImpl::OnVideoRendererEnded, weak_this_), 311 base::Bind(&RendererImpl::OnVideoRendererEnded, weak_this_),
308 base::Bind(&RendererImpl::OnError, weak_this_), 312 base::Bind(&RendererImpl::OnError, weak_this_),
309 base::Bind(&RendererImpl::GetMediaTimeForSyncingVideo, 313 base::Bind(&RendererImpl::GetMediaTimeForSyncingVideo,
310 base::Unretained(this))); 314 base::Unretained(this)),
315 waiting_for_decryption_key_cb_);
311 } 316 }
312 317
313 void RendererImpl::OnVideoRendererInitializeDone(PipelineStatus status) { 318 void RendererImpl::OnVideoRendererInitializeDone(PipelineStatus status) {
314 DVLOG(1) << __FUNCTION__ << ": " << status; 319 DVLOG(1) << __FUNCTION__ << ": " << status;
315 DCHECK(task_runner_->BelongsToCurrentThread()); 320 DCHECK(task_runner_->BelongsToCurrentThread());
316 321
317 // OnError() may be fired at any time by the renderers, even if they thought 322 // OnError() may be fired at any time by the renderers, even if they thought
318 // they initialized successfully (due to delayed output device setup). 323 // they initialized successfully (due to delayed output device setup).
319 if (state_ != STATE_INITIALIZING) { 324 if (state_ != STATE_INITIALIZING) {
320 DCHECK(init_cb_.is_null()); 325 DCHECK(init_cb_.is_null());
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 572 }
568 573
569 // After OnError() returns, the pipeline may destroy |this|. 574 // After OnError() returns, the pipeline may destroy |this|.
570 base::ResetAndReturn(&error_cb_).Run(error); 575 base::ResetAndReturn(&error_cb_).Run(error);
571 576
572 if (!flush_cb_.is_null()) 577 if (!flush_cb_.is_null())
573 base::ResetAndReturn(&flush_cb_).Run(); 578 base::ResetAndReturn(&flush_cb_).Run();
574 } 579 }
575 580
576 } // namespace media 581 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698