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

Unified Diff: media/filters/decoder_stream.cc

Issue 1939993002: Ignore calls to Reset() when in error state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/decoder_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/decoder_stream.cc
diff --git a/media/filters/decoder_stream.cc b/media/filters/decoder_stream.cc
index e8f590cf9627c66222c27f9de13f220b593c9e07..85a0e42e192bed2e4d6777dbe6e421a7a5499fe6 100644
--- a/media/filters/decoder_stream.cc
+++ b/media/filters/decoder_stream.cc
@@ -157,12 +157,20 @@ void DecoderStream<StreamType>::Reset(const base::Closure& closure) {
reset_cb_ = closure;
if (!read_cb_.is_null()) {
- task_runner_->PostTask(FROM_HERE, base::Bind(
- base::ResetAndReturn(&read_cb_), ABORTED, scoped_refptr<Output>()));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(base::ResetAndReturn(&read_cb_), ABORTED,
+ scoped_refptr<Output>()));
}
ready_outputs_.clear();
+ // It's possible to have received a DECODE_ERROR and entered STATE_ERROR right
+ // before a Reset() is executed. See crbug.com/597605 or crbug.com/607454.
sandersd (OOO until July 31) 2016/05/02 22:57:03 or -> and.
tguilbert 2016/05/03 00:06:41 Done.
+ if (state_ == STATE_ERROR) {
+ task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&reset_cb_));
sandersd (OOO until July 31) 2016/05/02 22:57:03 Should this be below the |read_cb_| check? It seem
tguilbert 2016/05/03 00:06:41 This is something that I considered. The comments
+ return;
+ }
+
// During decoder reinitialization, the Decoder does not need to be and
// cannot be Reset(). |decrypting_demuxer_stream_| was reset before decoder
// reinitialization.
@@ -710,7 +718,8 @@ void DecoderStream<StreamType>::ResetDecoder() {
FUNCTION_DVLOG(2);
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER ||
- state_ == STATE_ERROR || state_ == STATE_END_OF_STREAM) << state_;
+ state_ == STATE_END_OF_STREAM)
+ << state_;
DCHECK(!reset_cb_.is_null());
decoder_->Reset(base::Bind(&DecoderStream<StreamType>::OnDecoderReset,
@@ -722,7 +731,8 @@ void DecoderStream<StreamType>::OnDecoderReset() {
FUNCTION_DVLOG(2);
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER ||
- state_ == STATE_ERROR || state_ == STATE_END_OF_STREAM) << state_;
+ state_ == STATE_END_OF_STREAM)
+ << state_;
// If Reset() was called during pending read, read callback should be fired
// before the reset callback is fired.
DCHECK(read_cb_.is_null());
« no previous file with comments | « media/filters/decoder_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698