| 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 #ifndef MEDIA_FILTERS_DECODER_STREAM_H_ | 5 #ifndef MEDIA_FILTERS_DECODER_STREAM_H_ |
| 6 #define MEDIA_FILTERS_DECODER_STREAM_H_ | 6 #define MEDIA_FILTERS_DECODER_STREAM_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 int get_fallback_buffers_size_for_testing() const { | 134 int get_fallback_buffers_size_for_testing() const { |
| 135 return fallback_buffers_.size(); | 135 return fallback_buffers_.size(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 private: | 138 private: |
| 139 enum State { | 139 enum State { |
| 140 STATE_UNINITIALIZED, | 140 STATE_UNINITIALIZED, |
| 141 STATE_INITIALIZING, | 141 STATE_INITIALIZING, |
| 142 STATE_NORMAL, // Includes idle, pending decoder decode/reset. | 142 STATE_NORMAL, // Includes idle, pending decoder decode/reset. |
| 143 STATE_FLUSHING_DECODER, | 143 STATE_FLUSHING_DECODER, |
| 144 STATE_PENDING_DEMUXER_READ, | |
| 145 STATE_REINITIALIZING_DECODER, | 144 STATE_REINITIALIZING_DECODER, |
| 146 STATE_END_OF_STREAM, // End of stream reached; returns EOS on all reads. | 145 STATE_END_OF_STREAM, // End of stream reached; returns EOS on all reads. |
| 147 STATE_ERROR, | 146 STATE_ERROR, |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 void SelectDecoder(CdmContext* cdm_context); | 149 void SelectDecoder(CdmContext* cdm_context); |
| 151 | 150 |
| 152 // Called when |decoder_selector| selected the |selected_decoder|. | 151 // Called when |decoder_selector| selected the |selected_decoder|. |
| 153 // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream | 152 // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream |
| 154 // is created to help decrypt the encrypted stream. | 153 // is created to help decrypt the encrypted stream. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 249 |
| 251 // Stores buffers that are guaranteed to be fed to the decoder before fetching | 250 // Stores buffers that are guaranteed to be fed to the decoder before fetching |
| 252 // more from the demuxer stream. All buffers in this queue first were in | 251 // more from the demuxer stream. All buffers in this queue first were in |
| 253 // |pending_buffers_|. | 252 // |pending_buffers_|. |
| 254 std::deque<scoped_refptr<DecoderBuffer>> fallback_buffers_; | 253 std::deque<scoped_refptr<DecoderBuffer>> fallback_buffers_; |
| 255 | 254 |
| 256 // TODO(tguilbert): support config changes during decoder fallback, see | 255 // TODO(tguilbert): support config changes during decoder fallback, see |
| 257 // crbug.com/603713 | 256 // crbug.com/603713 |
| 258 bool received_config_change_during_reinit_; | 257 bool received_config_change_during_reinit_; |
| 259 | 258 |
| 260 // Used to track read requests in case the STATE_PENDIND_DEMUXER_READ get | 259 // Used to track read requests; not rolled into |state_| since that is |
| 261 // overwritten by an error. | 260 // overwritten in many cases. |
| 262 bool pending_demuxer_read_; | 261 bool pending_demuxer_read_; |
| 263 | 262 |
| 264 // NOTE: Weak pointers must be invalidated before all other member variables. | 263 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 265 base::WeakPtrFactory<DecoderStream<StreamType>> weak_factory_; | 264 base::WeakPtrFactory<DecoderStream<StreamType>> weak_factory_; |
| 266 | 265 |
| 267 // Used to invalidate pending decode requests and output callbacks when | 266 // Used to invalidate pending decode requests and output callbacks when |
| 268 // falling back to a new decoder (on first decode error). | 267 // falling back to a new decoder (on first decode error). |
| 269 base::WeakPtrFactory<DecoderStream<StreamType>> fallback_weak_factory_; | 268 base::WeakPtrFactory<DecoderStream<StreamType>> fallback_weak_factory_; |
| 270 }; | 269 }; |
| 271 | 270 |
| 272 template <> | 271 template <> |
| 273 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; | 272 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; |
| 274 | 273 |
| 275 template <> | 274 template <> |
| 276 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 275 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
| 277 | 276 |
| 278 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 277 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
| 279 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 278 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
| 280 | 279 |
| 281 } // namespace media | 280 } // namespace media |
| 282 | 281 |
| 283 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 282 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
| OLD | NEW |