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 22 matching lines...) Expand all Loading... |
33 const char* GetTraceString<DemuxerStream::AUDIO>() { | 33 const char* GetTraceString<DemuxerStream::AUDIO>() { |
34 return "DecoderStream<AUDIO>::Decode"; | 34 return "DecoderStream<AUDIO>::Decode"; |
35 } | 35 } |
36 | 36 |
37 template <DemuxerStream::Type StreamType> | 37 template <DemuxerStream::Type StreamType> |
38 DecoderStream<StreamType>::DecoderStream( | 38 DecoderStream<StreamType>::DecoderStream( |
39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
40 ScopedVector<Decoder> decoders, | 40 ScopedVector<Decoder> decoders, |
41 const SetDecryptorReadyCB& set_decryptor_ready_cb) | 41 const SetDecryptorReadyCB& set_decryptor_ready_cb) |
42 : task_runner_(task_runner), | 42 : task_runner_(task_runner), |
43 weak_factory_(this), | |
44 state_(STATE_UNINITIALIZED), | 43 state_(STATE_UNINITIALIZED), |
45 stream_(NULL), | 44 stream_(NULL), |
46 decoder_selector_( | 45 decoder_selector_( |
47 new DecoderSelector<StreamType>(task_runner, | 46 new DecoderSelector<StreamType>(task_runner, |
48 decoders.Pass(), | 47 decoders.Pass(), |
49 set_decryptor_ready_cb)) {} | 48 set_decryptor_ready_cb)), |
| 49 weak_factory_(this) {} |
50 | 50 |
51 template <DemuxerStream::Type StreamType> | 51 template <DemuxerStream::Type StreamType> |
52 DecoderStream<StreamType>::~DecoderStream() { | 52 DecoderStream<StreamType>::~DecoderStream() { |
53 DCHECK(state_ == STATE_UNINITIALIZED || state_ == STATE_STOPPED) << state_; | 53 DCHECK(state_ == STATE_UNINITIALIZED || state_ == STATE_STOPPED) << state_; |
54 } | 54 } |
55 | 55 |
56 template <DemuxerStream::Type StreamType> | 56 template <DemuxerStream::Type StreamType> |
57 void DecoderStream<StreamType>::Initialize(DemuxerStream* stream, | 57 void DecoderStream<StreamType>::Initialize(DemuxerStream* stream, |
58 const StatisticsCB& statistics_cb, | 58 const StatisticsCB& statistics_cb, |
59 const InitCB& init_cb) { | 59 const InitCB& init_cb) { |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 stream_ = NULL; | 507 stream_ = NULL; |
508 decoder_.reset(); | 508 decoder_.reset(); |
509 decrypting_demuxer_stream_.reset(); | 509 decrypting_demuxer_stream_.reset(); |
510 base::ResetAndReturn(&stop_cb_).Run(); | 510 base::ResetAndReturn(&stop_cb_).Run(); |
511 } | 511 } |
512 | 512 |
513 template class DecoderStream<DemuxerStream::VIDEO>; | 513 template class DecoderStream<DemuxerStream::VIDEO>; |
514 template class DecoderStream<DemuxerStream::AUDIO>; | 514 template class DecoderStream<DemuxerStream::AUDIO>; |
515 | 515 |
516 } // namespace media | 516 } // namespace media |
OLD | NEW |