Index: media/filters/decrypting_video_decoder.cc |
diff --git a/media/filters/decrypting_video_decoder.cc b/media/filters/decrypting_video_decoder.cc |
index eb40625f8a3720f5a41c7aaf44f03398f5e68747..2651c5da7404031a82f2453a542f737f7f48ab04 100644 |
--- a/media/filters/decrypting_video_decoder.cc |
+++ b/media/filters/decrypting_video_decoder.cc |
@@ -125,18 +125,12 @@ void DecryptingVideoDecoder::Reset(const base::Closure& closure) { |
DoReset(); |
} |
-void DecryptingVideoDecoder::Stop() { |
+DecryptingVideoDecoder::~DecryptingVideoDecoder() { |
DCHECK(task_runner_->BelongsToCurrentThread()); |
- DVLOG(2) << "Stop() - state: " << state_; |
- // Invalidate all weak pointers so that pending callbacks won't be fired into |
- // this object. |
- weak_factory_.InvalidateWeakPtrs(); |
+ if (state_ == kUninitialized) |
+ return; |
- // 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 |
- // callbacks). |
if (decryptor_) { |
decryptor_->DeinitializeDecoder(Decryptor::kVideo); |
decryptor_ = NULL; |
@@ -150,12 +144,6 @@ void DecryptingVideoDecoder::Stop() { |
base::ResetAndReturn(&decode_cb_).Run(kAborted); |
if (!reset_cb_.is_null()) |
base::ResetAndReturn(&reset_cb_).Run(); |
- |
- state_ = kStopped; |
-} |
- |
-DecryptingVideoDecoder::~DecryptingVideoDecoder() { |
- DCHECK(state_ == kUninitialized || state_ == kStopped) << state_; |
} |
void DecryptingVideoDecoder::SetDecryptor(Decryptor* decryptor) { |
@@ -168,7 +156,7 @@ void DecryptingVideoDecoder::SetDecryptor(Decryptor* decryptor) { |
if (!decryptor) { |
base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); |
- state_ = kStopped; |
+ state_ = kError; |
return; |
} |
@@ -191,7 +179,8 @@ void DecryptingVideoDecoder::FinishInitialization(bool success) { |
if (!success) { |
base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); |
- state_ = kStopped; |
+ decryptor_ = NULL; |
+ state_ = kError; |
return; |
} |