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

Unified Diff: media/filters/decrypting_video_decoder.cc

Issue 395703002: Fold {Audio|Video}Decoder::Stop() into the dtor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/decrypting_video_decoder.h ('k') | media/filters/decrypting_video_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « media/filters/decrypting_video_decoder.h ('k') | media/filters/decrypting_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698