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 "decoder_selector.h" | 5 #include "decoder_selector.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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return; | 123 return; |
124 | 124 |
125 // We must be trying to initialize the |decoder_| or the | 125 // We must be trying to initialize the |decoder_| or the |
126 // |decrypted_stream_|. Invalid all weak pointers so that all initialization | 126 // |decrypted_stream_|. Invalid all weak pointers so that all initialization |
127 // callbacks won't fire. | 127 // callbacks won't fire. |
128 weak_ptr_factory_.InvalidateWeakPtrs(); | 128 weak_ptr_factory_.InvalidateWeakPtrs(); |
129 | 129 |
130 if (decoder_) { | 130 if (decoder_) { |
131 // |decrypted_stream_| is either NULL or already initialized. We don't | 131 // |decrypted_stream_| is either NULL or already initialized. We don't |
132 // need to Stop() |decrypted_stream_| in either case. | 132 // need to Stop() |decrypted_stream_| in either case. |
133 decoder_->Stop(); | 133 decoder_.reset(); |
134 ReturnNullDecoder(); | 134 ReturnNullDecoder(); |
135 return; | 135 return; |
136 } | 136 } |
137 | 137 |
138 if (decrypted_stream_) { | 138 if (decrypted_stream_) { |
139 decrypted_stream_->Stop(); | 139 decrypted_stream_->Stop(); |
140 ReturnNullDecoder(); | 140 ReturnNullDecoder(); |
141 return; | 141 return; |
142 } | 142 } |
143 | 143 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 // These forward declarations tell the compiler that we will use | 233 // These forward declarations tell the compiler that we will use |
234 // DecoderSelector with these arguments, allowing us to keep these definitions | 234 // DecoderSelector with these arguments, allowing us to keep these definitions |
235 // in our .cc without causing linker errors. This also means if anyone tries to | 235 // in our .cc without causing linker errors. This also means if anyone tries to |
236 // instantiate a DecoderSelector with anything but these two specializations | 236 // instantiate a DecoderSelector with anything but these two specializations |
237 // they'll most likely get linker errors. | 237 // they'll most likely get linker errors. |
238 template class DecoderSelector<DemuxerStream::AUDIO>; | 238 template class DecoderSelector<DemuxerStream::AUDIO>; |
239 template class DecoderSelector<DemuxerStream::VIDEO>; | 239 template class DecoderSelector<DemuxerStream::VIDEO>; |
240 | 240 |
241 } // namespace media | 241 } // namespace media |
OLD | NEW |