| 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_selector.h" | 5 #include "media/filters/decoder_selector.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 | 196 |
| 197 template <DemuxerStream::Type StreamType> | 197 template <DemuxerStream::Type StreamType> |
| 198 void DecoderSelector<StreamType>::InitializeDecoder() { | 198 void DecoderSelector<StreamType>::InitializeDecoder() { |
| 199 DVLOG(2) << __func__; | 199 DVLOG(2) << __func__; |
| 200 DCHECK(task_runner_->BelongsToCurrentThread()); | 200 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 201 DCHECK(!decoder_); | 201 DCHECK(!decoder_); |
| 202 | 202 |
| 203 // Select the next non-blacklisted decoder. | 203 // Select the next non-blacklisted decoder. |
| 204 while (!decoders_.empty()) { | 204 while (!decoders_.empty()) { |
| 205 std::unique_ptr<Decoder> decoder(decoders_.front()); | 205 std::unique_ptr<Decoder> decoder(std::move(decoders_.front())); |
| 206 decoders_.weak_erase(decoders_.begin()); | 206 decoders_.erase(decoders_.begin()); |
| 207 // When |decrypted_stream_| is selected, the |config_| has changed so ignore | 207 // When |decrypted_stream_| is selected, the |config_| has changed so ignore |
| 208 // the blacklist. | 208 // the blacklist. |
| 209 if (decrypted_stream_ || | 209 if (decrypted_stream_ || |
| 210 decoder->GetDisplayName() != blacklisted_decoder_) { | 210 decoder->GetDisplayName() != blacklisted_decoder_) { |
| 211 decoder_ = std::move(decoder); | 211 decoder_ = std::move(decoder); |
| 212 break; | 212 break; |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 if (!decoder_) { | 216 if (!decoder_) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 // These forward declarations tell the compiler that we will use | 259 // These forward declarations tell the compiler that we will use |
| 260 // DecoderSelector with these arguments, allowing us to keep these definitions | 260 // DecoderSelector with these arguments, allowing us to keep these definitions |
| 261 // in our .cc without causing linker errors. This also means if anyone tries to | 261 // in our .cc without causing linker errors. This also means if anyone tries to |
| 262 // instantiate a DecoderSelector with anything but these two specializations | 262 // instantiate a DecoderSelector with anything but these two specializations |
| 263 // they'll most likely get linker errors. | 263 // they'll most likely get linker errors. |
| 264 template class DecoderSelector<DemuxerStream::AUDIO>; | 264 template class DecoderSelector<DemuxerStream::AUDIO>; |
| 265 template class DecoderSelector<DemuxerStream::VIDEO>; | 265 template class DecoderSelector<DemuxerStream::VIDEO>; |
| 266 | 266 |
| 267 } // namespace media | 267 } // namespace media |
| OLD | NEW |