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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool CanReadWithoutStalling() const; | 97 bool CanReadWithoutStalling() const; |
98 | 98 |
99 // Returns maximum concurrent decode requests for the current |decoder_|. | 99 // Returns maximum concurrent decode requests for the current |decoder_|. |
100 int GetMaxDecodeRequests() const; | 100 int GetMaxDecodeRequests() const; |
101 | 101 |
102 // Returns true if one more decode request can be submitted to the decoder. | 102 // Returns true if one more decode request can be submitted to the decoder. |
103 bool CanDecodeMore() const; | 103 bool CanDecodeMore() const; |
104 | 104 |
105 base::TimeDelta AverageDuration() const; | 105 base::TimeDelta AverageDuration() const; |
106 | 106 |
107 // Allows callers to register for notification of splice buffers from the | |
108 // demuxer. I.e., DecoderBuffer::splice_timestamp() is not kNoTimestamp. | |
109 // | |
110 // The observer will be notified of all buffers with a splice_timestamp() and | |
111 // the first buffer after which has a splice_timestamp() of kNoTimestamp. | |
112 typedef base::Callback<void(base::TimeDelta)> SpliceObserverCB; | |
113 void set_splice_observer(const SpliceObserverCB& splice_observer) { | |
114 splice_observer_cb_ = splice_observer; | |
115 } | |
116 | |
117 // Allows callers to register for notification of config changes; this is | 107 // Allows callers to register for notification of config changes; this is |
118 // called immediately after receiving the 'kConfigChanged' status from the | 108 // called immediately after receiving the 'kConfigChanged' status from the |
119 // DemuxerStream, before any action is taken to handle the config change. | 109 // DemuxerStream, before any action is taken to handle the config change. |
120 typedef base::Closure ConfigChangeObserverCB; | 110 typedef base::Closure ConfigChangeObserverCB; |
121 void set_config_change_observer( | 111 void set_config_change_observer( |
122 const ConfigChangeObserverCB& config_change_observer) { | 112 const ConfigChangeObserverCB& config_change_observer) { |
123 config_change_observer_cb_ = config_change_observer; | 113 config_change_observer_cb_ = config_change_observer; |
124 } | 114 } |
125 | 115 |
126 const Decoder* get_previous_decoder_for_testing() const { | 116 const Decoder* get_previous_decoder_for_testing() const { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 204 |
215 std::unique_ptr<Decoder> decoder_; | 205 std::unique_ptr<Decoder> decoder_; |
216 // When falling back from H/W decoding to S/W decoding, destructing the | 206 // When falling back from H/W decoding to S/W decoding, destructing the |
217 // GpuVideoDecoder too early results in black frames being displayed. | 207 // GpuVideoDecoder too early results in black frames being displayed. |
218 // |previous_decoder_| is used to keep it alive. It is destroyed once we've | 208 // |previous_decoder_| is used to keep it alive. It is destroyed once we've |
219 // decoded at least media::limits::kMaxVideoFrames frames after fallback. | 209 // decoded at least media::limits::kMaxVideoFrames frames after fallback. |
220 int decoded_frames_since_fallback_; | 210 int decoded_frames_since_fallback_; |
221 std::unique_ptr<Decoder> previous_decoder_; | 211 std::unique_ptr<Decoder> previous_decoder_; |
222 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; | 212 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; |
223 | 213 |
224 SpliceObserverCB splice_observer_cb_; | |
225 ConfigChangeObserverCB config_change_observer_cb_; | 214 ConfigChangeObserverCB config_change_observer_cb_; |
226 | 215 |
227 // If a splice_timestamp() has been seen, this is true until a | |
228 // splice_timestamp() of kNoTimestamp is encountered. | |
229 bool active_splice_; | |
230 | |
231 // An end-of-stream buffer has been sent for decoding, no more buffers should | 216 // An end-of-stream buffer has been sent for decoding, no more buffers should |
232 // be sent for decoding until it completes. | 217 // be sent for decoding until it completes. |
233 // TODO(sandersd): Turn this into a State. http://crbug.com/408316 | 218 // TODO(sandersd): Turn this into a State. http://crbug.com/408316 |
234 bool decoding_eos_; | 219 bool decoding_eos_; |
235 | 220 |
236 // Decoded buffers that haven't been read yet. Used when the decoder supports | 221 // Decoded buffers that haven't been read yet. Used when the decoder supports |
237 // parallel decoding. | 222 // parallel decoding. |
238 std::list<scoped_refptr<Output> > ready_outputs_; | 223 std::list<scoped_refptr<Output> > ready_outputs_; |
239 | 224 |
240 // Number of outstanding decode requests sent to the |decoder_|. | 225 // Number of outstanding decode requests sent to the |decoder_|. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 258 |
274 template <> | 259 template <> |
275 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 260 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
276 | 261 |
277 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 262 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
278 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 263 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
279 | 264 |
280 } // namespace media | 265 } // namespace media |
281 | 266 |
282 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 267 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
OLD | NEW |