OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/decoder_stream.h" | 5 #include "media/filters/decoder_stream.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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER || | 559 DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER || |
560 state_ == STATE_ERROR || state_ == STATE_END_OF_STREAM) << state_; | 560 state_ == STATE_ERROR || state_ == STATE_END_OF_STREAM) << state_; |
561 // If Reset() was called during pending read, read callback should be fired | 561 // If Reset() was called during pending read, read callback should be fired |
562 // before the reset callback is fired. | 562 // before the reset callback is fired. |
563 DCHECK(read_cb_.is_null()); | 563 DCHECK(read_cb_.is_null()); |
564 DCHECK(!reset_cb_.is_null()); | 564 DCHECK(!reset_cb_.is_null()); |
565 DCHECK(stop_cb_.is_null()); | 565 DCHECK(stop_cb_.is_null()); |
566 | 566 |
567 if (state_ != STATE_FLUSHING_DECODER) { | 567 if (state_ != STATE_FLUSHING_DECODER) { |
568 state_ = STATE_NORMAL; | 568 state_ = STATE_NORMAL; |
| 569 active_splice_ = false; |
569 base::ResetAndReturn(&reset_cb_).Run(); | 570 base::ResetAndReturn(&reset_cb_).Run(); |
570 return; | 571 return; |
571 } | 572 } |
572 | 573 |
573 // The resetting process will be continued in OnDecoderReinitialized(). | 574 // The resetting process will be continued in OnDecoderReinitialized(). |
574 ReinitializeDecoder(); | 575 ReinitializeDecoder(); |
575 } | 576 } |
576 | 577 |
577 template <DemuxerStream::Type StreamType> | 578 template <DemuxerStream::Type StreamType> |
578 void DecoderStream<StreamType>::StopDecoder() { | 579 void DecoderStream<StreamType>::StopDecoder() { |
579 FUNCTION_DVLOG(2); | 580 FUNCTION_DVLOG(2); |
580 DCHECK(task_runner_->BelongsToCurrentThread()); | 581 DCHECK(task_runner_->BelongsToCurrentThread()); |
581 DCHECK(state_ != STATE_UNINITIALIZED && state_ != STATE_STOPPED) << state_; | 582 DCHECK(state_ != STATE_UNINITIALIZED && state_ != STATE_STOPPED) << state_; |
582 DCHECK(!stop_cb_.is_null()); | 583 DCHECK(!stop_cb_.is_null()); |
583 | 584 |
584 state_ = STATE_STOPPED; | 585 state_ = STATE_STOPPED; |
585 decoder_->Stop(); | 586 decoder_->Stop(); |
586 stream_ = NULL; | 587 stream_ = NULL; |
587 decoder_.reset(); | 588 decoder_.reset(); |
588 decrypting_demuxer_stream_.reset(); | 589 decrypting_demuxer_stream_.reset(); |
589 // Post |stop_cb_| because pending |read_cb_| and/or |reset_cb_| are also | 590 // Post |stop_cb_| because pending |read_cb_| and/or |reset_cb_| are also |
590 // posted in Stop(). | 591 // posted in Stop(). |
591 task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&stop_cb_)); | 592 task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&stop_cb_)); |
592 } | 593 } |
593 | 594 |
594 template class DecoderStream<DemuxerStream::VIDEO>; | 595 template class DecoderStream<DemuxerStream::VIDEO>; |
595 template class DecoderStream<DemuxerStream::AUDIO>; | 596 template class DecoderStream<DemuxerStream::AUDIO>; |
596 | 597 |
597 } // namespace media | 598 } // namespace media |
OLD | NEW |