Chromium Code Reviews| Index: media/filters/decoder_stream.h |
| diff --git a/media/filters/decoder_stream.h b/media/filters/decoder_stream.h |
| index a7f084fa3f6f806caff60e210708abe6a86ec85a..800beb04424f348d2587941fa93b5d24e3ec7a61 100644 |
| --- a/media/filters/decoder_stream.h |
| +++ b/media/filters/decoder_stream.h |
| @@ -122,6 +122,14 @@ class MEDIA_EXPORT DecoderStream { |
| return previous_decoder_.get(); |
| } |
| + int get_pending_buffers_size_for_testing() const { |
| + return pending_buffers_.size(); |
| + } |
| + |
| + int get_fallback_buffers_size_for_testing() const { |
| + return fallback_buffers_.size(); |
| + } |
| + |
| private: |
| enum State { |
| STATE_UNINITIALIZED, |
| @@ -131,7 +139,10 @@ class MEDIA_EXPORT DecoderStream { |
| STATE_PENDING_DEMUXER_READ, |
| STATE_REINITIALIZING_DECODER, |
| STATE_END_OF_STREAM, // End of stream reached; returns EOS on all reads. |
| - STATE_ERROR |
| + STATE_ERROR, |
| + // TODO(tguilbert): support config changes during decoder fallback, see |
| + // crbug.com/603713 |
| + STATE_CONFIG_CHANGE_RECEIVED_WHILE_REINITIALIZING_DECODER |
| }; |
| void SelectDecoder(CdmContext* cdm_context); |
| @@ -148,8 +159,12 @@ class MEDIA_EXPORT DecoderStream { |
| const scoped_refptr<Output>& output); |
| // Decodes |buffer| and returns the result via OnDecodeOutputReady(). |
| + // Saves |buffer| into |pending_buffers_| if appropriate. |
| void Decode(const scoped_refptr<DecoderBuffer>& buffer); |
| + // Performs the heavy lifting of the decode call. |
| + void DecodeInternal(const scoped_refptr<DecoderBuffer>& buffer); |
| + |
| // Flushes the decoder with an EOS buffer to retrieve internally buffered |
| // decoder output. |
| void FlushDecoder(); |
| @@ -225,8 +240,18 @@ class MEDIA_EXPORT DecoderStream { |
| // Tracks the duration of incoming packets over time. |
| MovingAverage duration_tracker_; |
| + // Stores buffers that might be reused if the decoder fails right after |
| + // Initialize(). |
| + std::deque<scoped_refptr<DecoderBuffer>> pending_buffers_; |
| + |
| + // Stores buffers that are garanteed to be fed to the decoder before fetching |
|
DaleCurtis
2016/04/15 01:19:17
guaranteed
tguilbert
2016/04/15 20:45:52
Done.
|
| + // more from the demuxer stream. Populated by |pending_buffers_| on decoder |
|
DaleCurtis
2016/04/15 01:19:17
"Populated by ..." seems like it should be followe
tguilbert
2016/04/15 20:45:52
Done.
|
| + // fallback. |
| + std::deque<scoped_refptr<DecoderBuffer>> fallback_buffers_; |
| + |
| // NOTE: Weak pointers must be invalidated before all other member variables. |
| - base::WeakPtrFactory<DecoderStream<StreamType> > weak_factory_; |
| + base::WeakPtrFactory<DecoderStream<StreamType>> weak_factory_; |
| + base::WeakPtrFactory<DecoderStream<StreamType>> decode_weak_factory_; |
|
DaleCurtis
2016/04/15 01:19:17
This should have a comment about exactly what this
tguilbert
2016/04/15 20:45:52
Done.
|
| }; |
| template <> |