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

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

Issue 1939993002: Ignore calls to Reset() when in error state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | media/filters/decoder_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // |read_cb| is always called asynchronously. This method should only be 76 // |read_cb| is always called asynchronously. This method should only be
77 // called after initialization has succeeded and must not be called during 77 // called after initialization has succeeded and must not be called during
78 // pending Reset(). 78 // pending Reset().
79 void Read(const ReadCB& read_cb); 79 void Read(const ReadCB& read_cb);
80 80
81 // Resets the decoder, flushes all decoded outputs and/or internal buffers, 81 // Resets the decoder, flushes all decoded outputs and/or internal buffers,
82 // fires any existing pending read callback and calls |closure| on completion. 82 // fires any existing pending read callback and calls |closure| on completion.
83 // Note that |closure| is always called asynchronously. This method should 83 // Note that |closure| is always called asynchronously. This method should
84 // only be called after initialization has succeeded and must not be called 84 // only be called after initialization has succeeded and must not be called
85 // during pending Reset(). 85 // during pending Reset().
86 // N.B: If the decoder stream has run into an error, calling this method does
87 // not 'reset' it to a normal state.
86 void Reset(const base::Closure& closure); 88 void Reset(const base::Closure& closure);
87 89
88 // Returns true if the decoder currently has the ability to decode and return 90 // Returns true if the decoder currently has the ability to decode and return
89 // an Output. 91 // an Output.
90 // TODO(rileya): Remove the need for this by refactoring Decoder queueing 92 // TODO(rileya): Remove the need for this by refactoring Decoder queueing
91 // behavior. 93 // behavior.
92 bool CanReadWithoutStalling() const; 94 bool CanReadWithoutStalling() const;
93 95
94 // Returns maximum concurrent decode requests for the current |decoder_|. 96 // Returns maximum concurrent decode requests for the current |decoder_|.
95 int GetMaxDecodeRequests() const; 97 int GetMaxDecodeRequests() const;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 private: 135 private:
134 enum State { 136 enum State {
135 STATE_UNINITIALIZED, 137 STATE_UNINITIALIZED,
136 STATE_INITIALIZING, 138 STATE_INITIALIZING,
137 STATE_NORMAL, // Includes idle, pending decoder decode/reset. 139 STATE_NORMAL, // Includes idle, pending decoder decode/reset.
138 STATE_FLUSHING_DECODER, 140 STATE_FLUSHING_DECODER,
139 STATE_PENDING_DEMUXER_READ, 141 STATE_PENDING_DEMUXER_READ,
140 STATE_REINITIALIZING_DECODER, 142 STATE_REINITIALIZING_DECODER,
141 STATE_END_OF_STREAM, // End of stream reached; returns EOS on all reads. 143 STATE_END_OF_STREAM, // End of stream reached; returns EOS on all reads.
142 STATE_ERROR, 144 STATE_ERROR,
143 // TODO(tguilbert): support config changes during decoder fallback, see
144 // crbug.com/603713
145 STATE_CONFIG_CHANGE_RECEIVED_WHILE_REINITIALIZING_DECODER
146 }; 145 };
147 146
148 void SelectDecoder(CdmContext* cdm_context); 147 void SelectDecoder(CdmContext* cdm_context);
149 148
150 // Called when |decoder_selector| selected the |selected_decoder|. 149 // Called when |decoder_selector| selected the |selected_decoder|.
151 // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream 150 // |decrypting_demuxer_stream| was also populated if a DecryptingDemuxerStream
152 // is created to help decrypt the encrypted stream. 151 // is created to help decrypt the encrypted stream.
153 void OnDecoderSelected( 152 void OnDecoderSelected(
154 std::unique_ptr<Decoder> selected_decoder, 153 std::unique_ptr<Decoder> selected_decoder,
155 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream); 154 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 241
243 // Stores buffers that might be reused if the decoder fails right after 242 // Stores buffers that might be reused if the decoder fails right after
244 // Initialize(). 243 // Initialize().
245 std::deque<scoped_refptr<DecoderBuffer>> pending_buffers_; 244 std::deque<scoped_refptr<DecoderBuffer>> pending_buffers_;
246 245
247 // Stores buffers that are guaranteed to be fed to the decoder before fetching 246 // Stores buffers that are guaranteed to be fed to the decoder before fetching
248 // more from the demuxer stream. All buffers in this queue first were in 247 // more from the demuxer stream. All buffers in this queue first were in
249 // |pending_buffers_|. 248 // |pending_buffers_|.
250 std::deque<scoped_refptr<DecoderBuffer>> fallback_buffers_; 249 std::deque<scoped_refptr<DecoderBuffer>> fallback_buffers_;
251 250
251 // TODO(tguilbert): support config changes during decoder fallback, see
252 // crbug.com/603713
253 bool received_config_change_during_reinit_;
254
255 // Used to track read requests in case the STATE_PENDIND_DEMUXER_READ get
256 // overwritten by an error.
257 bool pending_demuxer_read_;
258
252 // NOTE: Weak pointers must be invalidated before all other member variables. 259 // NOTE: Weak pointers must be invalidated before all other member variables.
253 base::WeakPtrFactory<DecoderStream<StreamType>> weak_factory_; 260 base::WeakPtrFactory<DecoderStream<StreamType>> weak_factory_;
254 261
255 // Used to invalidate pending decode requests and output callbacks when 262 // Used to invalidate pending decode requests and output callbacks when
256 // falling back to a new decoder (on first decode error). 263 // falling back to a new decoder (on first decode error).
257 base::WeakPtrFactory<DecoderStream<StreamType>> fallback_weak_factory_; 264 base::WeakPtrFactory<DecoderStream<StreamType>> fallback_weak_factory_;
258 }; 265 };
259 266
260 template <> 267 template <>
261 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; 268 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const;
262 269
263 template <> 270 template <>
264 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; 271 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const;
265 272
266 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; 273 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream;
267 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; 274 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream;
268 275
269 } // namespace media 276 } // namespace media
270 277
271 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ 278 #endif // MEDIA_FILTERS_DECODER_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/decoder_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698