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

Side by Side Diff: media/filters/decrypting_video_decoder.cc

Issue 2775983002: Revert "media: CHECK DecryptingVideoDecoder::Reset() assumptions" (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/filters/decrypting_video_decoder.h" 5 #include "media/filters/decrypting_video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 void DecryptingVideoDecoder::Reset(const base::Closure& closure) { 110 void DecryptingVideoDecoder::Reset(const base::Closure& closure) {
111 DVLOG(2) << "Reset() - state: " << state_; 111 DVLOG(2) << "Reset() - state: " << state_;
112 DCHECK(task_runner_->BelongsToCurrentThread()); 112 DCHECK(task_runner_->BelongsToCurrentThread());
113 DCHECK(state_ == kIdle || 113 DCHECK(state_ == kIdle ||
114 state_ == kPendingDecode || 114 state_ == kPendingDecode ||
115 state_ == kWaitingForKey || 115 state_ == kWaitingForKey ||
116 state_ == kDecodeFinished || 116 state_ == kDecodeFinished ||
117 state_ == kError) << state_; 117 state_ == kError) << state_;
118 DCHECK(init_cb_.is_null()); // No Reset() during pending initialization.
118 DCHECK(reset_cb_.is_null()); 119 DCHECK(reset_cb_.is_null());
119 120
120 reset_cb_ = BindToCurrentLoop(closure); 121 reset_cb_ = BindToCurrentLoop(closure);
121 122
122 // TODO(xhwang): These CHECKs are used to help investigate a bug. Remove them
123 // after the investigation is over. See http://crbug.com/695554
124 CHECK(state_ != kUninitialized);
125 CHECK(state_ != kPendingDecoderInit);
126 CHECK(init_cb_.is_null()); // No Reset() during pending initialization.
127
128 decryptor_->ResetDecoder(Decryptor::kVideo); 123 decryptor_->ResetDecoder(Decryptor::kVideo);
129 124
130 // Reset() cannot complete if the decode callback is still pending. 125 // Reset() cannot complete if the decode callback is still pending.
131 // Defer the resetting process in this case. The |reset_cb_| will be fired 126 // Defer the resetting process in this case. The |reset_cb_| will be fired
132 // after the decode callback is fired - see DecryptAndDecodeBuffer() and 127 // after the decode callback is fired - see DecryptAndDecodeBuffer() and
133 // DeliverFrame(). 128 // DeliverFrame().
134 if (state_ == kPendingDecode) { 129 if (state_ == kPendingDecode) {
135 DCHECK(!decode_cb_.is_null()); 130 DCHECK(!decode_cb_.is_null());
136 return; 131 return;
137 } 132 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 309 }
315 310
316 void DecryptingVideoDecoder::DoReset() { 311 void DecryptingVideoDecoder::DoReset() {
317 DCHECK(init_cb_.is_null()); 312 DCHECK(init_cb_.is_null());
318 DCHECK(decode_cb_.is_null()); 313 DCHECK(decode_cb_.is_null());
319 state_ = kIdle; 314 state_ = kIdle;
320 base::ResetAndReturn(&reset_cb_).Run(); 315 base::ResetAndReturn(&reset_cb_).Run();
321 } 316 }
322 317
323 } // namespace media 318 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698