| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // Post callbacks to prevent reentrance into this object. | 182 // Post callbacks to prevent reentrance into this object. |
| 183 if (!read_cb_.is_null()) { | 183 if (!read_cb_.is_null()) { |
| 184 task_runner_->PostTask(FROM_HERE, base::Bind( | 184 task_runner_->PostTask(FROM_HERE, base::Bind( |
| 185 base::ResetAndReturn(&read_cb_), ABORTED, scoped_refptr<Output>())); | 185 base::ResetAndReturn(&read_cb_), ABORTED, scoped_refptr<Output>())); |
| 186 } | 186 } |
| 187 if (!reset_cb_.is_null()) | 187 if (!reset_cb_.is_null()) |
| 188 task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&reset_cb_)); | 188 task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&reset_cb_)); |
| 189 | 189 |
| 190 if (decrypting_demuxer_stream_) | 190 if (decrypting_demuxer_stream_) |
| 191 decrypting_demuxer_stream_->Stop(); | 191 decrypting_demuxer_stream_->Stop(); |
| 192 if (decoder_) | |
| 193 decoder_->Stop(); | |
| 194 | 192 |
| 195 state_ = STATE_STOPPED; | |
| 196 stream_ = NULL; | 193 stream_ = NULL; |
| 197 decoder_.reset(); | 194 decoder_.reset(); |
| 198 decrypting_demuxer_stream_.reset(); | 195 decrypting_demuxer_stream_.reset(); |
| 196 |
| 197 state_ = STATE_STOPPED; |
| 199 task_runner_->PostTask(FROM_HERE, closure); | 198 task_runner_->PostTask(FROM_HERE, closure); |
| 200 } | 199 } |
| 201 | 200 |
| 202 template <DemuxerStream::Type StreamType> | 201 template <DemuxerStream::Type StreamType> |
| 203 bool DecoderStream<StreamType>::CanReadWithoutStalling() const { | 202 bool DecoderStream<StreamType>::CanReadWithoutStalling() const { |
| 204 DCHECK(task_runner_->BelongsToCurrentThread()); | 203 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 205 return !ready_outputs_.empty() || decoder_->CanReadWithoutStalling(); | 204 return !ready_outputs_.empty() || decoder_->CanReadWithoutStalling(); |
| 206 } | 205 } |
| 207 | 206 |
| 208 template <> | 207 template <> |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 } | 565 } |
| 567 | 566 |
| 568 // The resetting process will be continued in OnDecoderReinitialized(). | 567 // The resetting process will be continued in OnDecoderReinitialized(). |
| 569 ReinitializeDecoder(); | 568 ReinitializeDecoder(); |
| 570 } | 569 } |
| 571 | 570 |
| 572 template class DecoderStream<DemuxerStream::VIDEO>; | 571 template class DecoderStream<DemuxerStream::VIDEO>; |
| 573 template class DecoderStream<DemuxerStream::AUDIO>; | 572 template class DecoderStream<DemuxerStream::AUDIO>; |
| 574 | 573 |
| 575 } // namespace media | 574 } // namespace media |
| OLD | NEW |