| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 int GetMaxDecodeRequests() const; | 99 int GetMaxDecodeRequests() const; |
| 100 | 100 |
| 101 // Returns true if one more decode request can be submitted to the decoder. | 101 // Returns true if one more decode request can be submitted to the decoder. |
| 102 bool CanDecodeMore() const; | 102 bool CanDecodeMore() const; |
| 103 | 103 |
| 104 base::TimeDelta AverageDuration() const; | 104 base::TimeDelta AverageDuration() const; |
| 105 | 105 |
| 106 // Allows callers to register for notification of config changes; this is | 106 // Allows callers to register for notification of config changes; this is |
| 107 // called immediately after receiving the 'kConfigChanged' status from the | 107 // called immediately after receiving the 'kConfigChanged' status from the |
| 108 // DemuxerStream, before any action is taken to handle the config change. | 108 // DemuxerStream, before any action is taken to handle the config change. |
| 109 typedef base::Closure ConfigChangeObserverCB; | 109 using ConfigChangeObserverCB = base::Closure; |
| 110 void set_config_change_observer( | 110 void set_config_change_observer( |
| 111 const ConfigChangeObserverCB& config_change_observer) { | 111 ConfigChangeObserverCB config_change_observer) { |
| 112 config_change_observer_cb_ = config_change_observer; | 112 config_change_observer_cb_ = config_change_observer; |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Allows tests to keep track the currently selected decoder. |
| 116 using DecoderChangeObserverCB = base::RepeatingCallback<void(Decoder*)>; |
| 117 void set_decoder_change_observer_for_testing( |
| 118 DecoderChangeObserverCB decoder_change_observer_cb) { |
| 119 decoder_change_observer_cb_ = std::move(decoder_change_observer_cb); |
| 120 } |
| 121 |
| 115 int get_pending_buffers_size_for_testing() const { | 122 int get_pending_buffers_size_for_testing() const { |
| 116 return pending_buffers_.size(); | 123 return pending_buffers_.size(); |
| 117 } | 124 } |
| 118 | 125 |
| 119 int get_fallback_buffers_size_for_testing() const { | 126 int get_fallback_buffers_size_for_testing() const { |
| 120 return fallback_buffers_.size(); | 127 return fallback_buffers_.size(); |
| 121 } | 128 } |
| 122 | 129 |
| 123 private: | 130 private: |
| 124 enum State { | 131 enum State { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 std::unique_ptr<DecoderSelector<StreamType>> decoder_selector_; | 207 std::unique_ptr<DecoderSelector<StreamType>> decoder_selector_; |
| 201 | 208 |
| 202 std::unique_ptr<Decoder> decoder_; | 209 std::unique_ptr<Decoder> decoder_; |
| 203 | 210 |
| 204 // Whether |decoder_| has produced a frame yet. Reset on fallback. | 211 // Whether |decoder_| has produced a frame yet. Reset on fallback. |
| 205 bool decoder_produced_a_frame_; | 212 bool decoder_produced_a_frame_; |
| 206 | 213 |
| 207 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; | 214 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; |
| 208 | 215 |
| 209 ConfigChangeObserverCB config_change_observer_cb_; | 216 ConfigChangeObserverCB config_change_observer_cb_; |
| 217 DecoderChangeObserverCB decoder_change_observer_cb_; |
| 210 | 218 |
| 211 // An end-of-stream buffer has been sent for decoding, no more buffers should | 219 // An end-of-stream buffer has been sent for decoding, no more buffers should |
| 212 // be sent for decoding until it completes. | 220 // be sent for decoding until it completes. |
| 213 // TODO(sandersd): Turn this into a State. http://crbug.com/408316 | 221 // TODO(sandersd): Turn this into a State. http://crbug.com/408316 |
| 214 bool decoding_eos_; | 222 bool decoding_eos_; |
| 215 | 223 |
| 216 // Decoded buffers that haven't been read yet. Used when the decoder supports | 224 // Decoded buffers that haven't been read yet. Used when the decoder supports |
| 217 // parallel decoding. | 225 // parallel decoding. |
| 218 std::list<scoped_refptr<Output> > ready_outputs_; | 226 std::list<scoped_refptr<Output> > ready_outputs_; |
| 219 | 227 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 261 |
| 254 template <> | 262 template <> |
| 255 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 263 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
| 256 | 264 |
| 257 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 265 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
| 258 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 266 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
| 259 | 267 |
| 260 } // namespace media | 268 } // namespace media |
| 261 | 269 |
| 262 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 270 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
| OLD | NEW |