Chromium Code Reviews| Index: media/filters/decrypting_demuxer_stream.cc |
| diff --git a/media/filters/decrypting_demuxer_stream.cc b/media/filters/decrypting_demuxer_stream.cc |
| index 2bfe10468e30c9da960c5d867bfdcd94acfbf246..cd8d8c753e9384060e88b2f115731dfe900de8bb 100644 |
| --- a/media/filters/decrypting_demuxer_stream.cc |
| +++ b/media/filters/decrypting_demuxer_stream.cc |
| @@ -75,6 +75,7 @@ void DecryptingDemuxerStream::Reset(const base::Closure& closure) { |
| DVLOG(2) << __FUNCTION__ << " - state: " << state_; |
| DCHECK(task_runner_->BelongsToCurrentThread()); |
| DCHECK(state_ != kUninitialized) << state_; |
| + DCHECK(state_ != kStopped) << state_; |
| DCHECK(reset_cb_.is_null()); |
| reset_cb_ = BindToCurrentLoop(closure); |
| @@ -108,6 +109,38 @@ void DecryptingDemuxerStream::Reset(const base::Closure& closure) { |
| DoReset(); |
| } |
| +void DecryptingDemuxerStream::Stop(const base::Closure& closure) { |
| + DVLOG(2) << __FUNCTION__ << " - state: " << state_; |
| + DCHECK(task_runner_->BelongsToCurrentThread()); |
| + DCHECK(state_ != kUninitialized) << state_; |
| + |
| + // Invalid all weak pointers so that pending callbacks won't fire. |
|
ddorwin
2014/02/14 01:55:13
Invalid*at*e
callbacks won't *be fired into this
xhwang
2014/02/14 03:00:53
Done.
|
| + weak_factory_.InvalidateWeakPtrs(); |
| + |
| + // At this point the render thread is likely paused (in WebMediaPlayerImpl's |
| + // Destroy()), so running |closure| can't wait for anything that requires the |
| + // render thread to be processing messages to complete (such as PPAPI |
|
ddorwin
2014/02/14 01:55:13
nit: ...to process messages...
xhwang
2014/02/14 03:00:53
Done.
|
| + // callbacks). |
|
ddorwin
2014/02/14 01:55:13
nit: They aren't really "PPAPI callbacks" (e.g. co
xhwang
2014/02/14 03:00:53
Done.
|
| + if (decryptor_) { |
| + decryptor_->RegisterNewKeyCB(GetDecryptorStreamType(), |
|
ddorwin
2014/02/14 01:55:13
// Clear the callback.
Why do we need to do this?
xhwang
2014/02/14 03:00:53
Done.
|
| + Decryptor::NewKeyCB()); |
| + decryptor_->CancelDecrypt(GetDecryptorStreamType()); |
| + decryptor_ = NULL; |
| + } |
| + if (!set_decryptor_ready_cb_.is_null()) |
| + base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); |
| + if (!init_cb_.is_null()) |
| + base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); |
| + if (!read_cb_.is_null()) |
| + base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); |
| + if (!reset_cb_.is_null()) |
| + base::ResetAndReturn(&reset_cb_).Run(); |
| + pending_buffer_to_decrypt_ = NULL; |
| + |
| + state_ = kStopped; |
| + BindToCurrentLoop(closure).Run(); |
|
xhwang
2014/02/14 01:33:19
l.124-141 is pretty much the same as DAD and DVD.
|
| +} |
| + |
| AudioDecoderConfig DecryptingDemuxerStream::audio_decoder_config() { |
| DCHECK(state_ != kUninitialized && state_ != kDecryptorRequested) << state_; |
| CHECK_EQ(demuxer_stream_->type(), AUDIO); |