Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: media/filters/decoder_stream.h

Issue 2841553003: media: Discard the previous decoder immediately on fallback (Closed)
Patch Set: Remove out of date comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 typedef base::Closure ConfigChangeObserverCB;
110 void set_config_change_observer( 110 void set_config_change_observer(
111 const ConfigChangeObserverCB& config_change_observer) { 111 const 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 const Decoder* get_previous_decoder_for_testing() const {
116 return previous_decoder_.get();
117 }
118
119 int get_pending_buffers_size_for_testing() const { 115 int get_pending_buffers_size_for_testing() const {
120 return pending_buffers_.size(); 116 return pending_buffers_.size();
121 } 117 }
122 118
123 int get_fallback_buffers_size_for_testing() const { 119 int get_fallback_buffers_size_for_testing() const {
124 return fallback_buffers_.size(); 120 return fallback_buffers_.size();
125 } 121 }
126 122
127 private: 123 private:
128 enum State { 124 enum State {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 base::Closure reset_cb_; 194 base::Closure reset_cb_;
199 195
200 DemuxerStream* stream_; 196 DemuxerStream* stream_;
201 197
202 CdmContext* cdm_context_; 198 CdmContext* cdm_context_;
203 199
204 std::unique_ptr<DecoderSelector<StreamType>> decoder_selector_; 200 std::unique_ptr<DecoderSelector<StreamType>> decoder_selector_;
205 201
206 std::unique_ptr<Decoder> decoder_; 202 std::unique_ptr<Decoder> decoder_;
207 203
208 // When falling back from H/W decoding to S/W decoding, destructing the 204 // Whether |decoder_| has produced a frame yet. Reset on fallback.
209 // GpuVideoDecoder too early results in black frames being displayed. 205 bool decoder_produced_a_frame_;
210 // |previous_decoder_| is used to keep it alive. It is destroyed once we've
211 // decoded at least media::limits::kMaxVideoFrames frames after fallback.
212 int decoded_frames_since_fallback_;
213 std::unique_ptr<Decoder> previous_decoder_;
214 206
215 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; 207 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_;
216 208
217 ConfigChangeObserverCB config_change_observer_cb_; 209 ConfigChangeObserverCB config_change_observer_cb_;
218 210
219 // An end-of-stream buffer has been sent for decoding, no more buffers should 211 // An end-of-stream buffer has been sent for decoding, no more buffers should
220 // be sent for decoding until it completes. 212 // be sent for decoding until it completes.
221 // TODO(sandersd): Turn this into a State. http://crbug.com/408316 213 // TODO(sandersd): Turn this into a State. http://crbug.com/408316
222 bool decoding_eos_; 214 bool decoding_eos_;
223 215
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 253
262 template <> 254 template <>
263 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; 255 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const;
264 256
265 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; 257 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream;
266 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; 258 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream;
267 259
268 } // namespace media 260 } // namespace media
269 261
270 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ 262 #endif // MEDIA_FILTERS_DECODER_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698