| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (select_decoder_cb_.is_null()) | 116 if (select_decoder_cb_.is_null()) |
| 117 return; | 117 return; |
| 118 | 118 |
| 119 // We must be trying to initialize the |decoder_| or the | 119 // We must be trying to initialize the |decoder_| or the |
| 120 // |decrypted_stream_|. Invalid all weak pointers so that all initialization | 120 // |decrypted_stream_|. Invalid all weak pointers so that all initialization |
| 121 // callbacks won't fire. | 121 // callbacks won't fire. |
| 122 weak_ptr_factory_.InvalidateWeakPtrs(); | 122 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 123 | 123 |
| 124 if (decoder_) { | 124 if (decoder_) { |
| 125 // |decrypted_stream_| is either NULL or already initialized. We don't | 125 // |decrypted_stream_| is either NULL or already initialized. We don't |
| 126 // need to Reset() |decrypted_stream_| in either case. | 126 // need to Stop() |decrypted_stream_| in either case. |
| 127 decoder_->Stop(base::Bind(&DecoderSelector<StreamType>::ReturnNullDecoder, | 127 decoder_->Stop(base::Bind(&DecoderSelector<StreamType>::ReturnNullDecoder, |
| 128 weak_ptr_factory_.GetWeakPtr())); | 128 weak_ptr_factory_.GetWeakPtr())); |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 | 131 |
| 132 if (decrypted_stream_) { | 132 if (decrypted_stream_) { |
| 133 decrypted_stream_->Stop( | 133 decrypted_stream_->Stop( |
| 134 base::Bind(&DecoderSelector<StreamType>::ReturnNullDecoder, | 134 base::Bind(&DecoderSelector<StreamType>::ReturnNullDecoder, |
| 135 weak_ptr_factory_.GetWeakPtr())); | 135 weak_ptr_factory_.GetWeakPtr())); |
| 136 return; | 136 return; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 // These forward declarations tell the compiler that we will use | 239 // These forward declarations tell the compiler that we will use |
| 240 // DecoderSelector with these arguments, allowing us to keep these definitions | 240 // DecoderSelector with these arguments, allowing us to keep these definitions |
| 241 // in our .cc without causing linker errors. This also means if anyone tries to | 241 // in our .cc without causing linker errors. This also means if anyone tries to |
| 242 // instantiate a DecoderSelector with anything but these two specializations | 242 // instantiate a DecoderSelector with anything but these two specializations |
| 243 // they'll most likely get linker errors. | 243 // they'll most likely get linker errors. |
| 244 template class DecoderSelector<DemuxerStream::AUDIO>; | 244 template class DecoderSelector<DemuxerStream::AUDIO>; |
| 245 template class DecoderSelector<DemuxerStream::VIDEO>; | 245 template class DecoderSelector<DemuxerStream::VIDEO>; |
| 246 | 246 |
| 247 } // namespace media | 247 } // namespace media |
| OLD | NEW |