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

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

Issue 1720343002: Attempt decoder fallback when the first decode call fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resume_zero
Patch Set: Created 4 years, 10 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 const scoped_refptr<Output>& output); 149 const scoped_refptr<Output>& output);
150 150
151 // Decodes |buffer| and returns the result via OnDecodeOutputReady(). 151 // Decodes |buffer| and returns the result via OnDecodeOutputReady().
152 void Decode(const scoped_refptr<DecoderBuffer>& buffer); 152 void Decode(const scoped_refptr<DecoderBuffer>& buffer);
153 153
154 // Flushes the decoder with an EOS buffer to retrieve internally buffered 154 // Flushes the decoder with an EOS buffer to retrieve internally buffered
155 // decoder output. 155 // decoder output.
156 void FlushDecoder(); 156 void FlushDecoder();
157 157
158 // Callback for Decoder::Decode(). 158 // Callback for Decoder::Decode().
159 void OnDecodeDone(int buffer_size, bool end_of_stream, DecoderStatus status); 159 void OnDecodeDone(int sequence_token,
160 int buffer_size,
161 bool end_of_stream,
162 DecoderStatus status);
160 163
161 // Output callback passed to Decoder::Initialize(). 164 // Output callback passed to Decoder::Initialize().
162 void OnDecodeOutputReady(const scoped_refptr<Output>& output); 165 void OnDecodeOutputReady(const scoped_refptr<Output>& output);
163 166
164 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). 167 // Reads a buffer from |stream_| and returns the result via OnBufferReady().
165 void ReadFromDemuxerStream(); 168 void ReadFromDemuxerStream();
166 169
167 // Callback for DemuxerStream::Read(). 170 // Callback for DemuxerStream::Read().
168 void OnBufferReady(DemuxerStream::Status status, 171 void OnBufferReady(DemuxerStream::Status status,
169 const scoped_refptr<DecoderBuffer>& buffer); 172 const scoped_refptr<DecoderBuffer>& buffer);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // Decoded buffers that haven't been read yet. Used when the decoder supports 222 // Decoded buffers that haven't been read yet. Used when the decoder supports
220 // parallel decoding. 223 // parallel decoding.
221 std::list<scoped_refptr<Output> > ready_outputs_; 224 std::list<scoped_refptr<Output> > ready_outputs_;
222 225
223 // Number of outstanding decode requests sent to the |decoder_|. 226 // Number of outstanding decode requests sent to the |decoder_|.
224 int pending_decode_requests_; 227 int pending_decode_requests_;
225 228
226 // Tracks the duration of incoming packets over time. 229 // Tracks the duration of incoming packets over time.
227 MovingAverage duration_tracker_; 230 MovingAverage duration_tracker_;
228 231
232 // Used to reattempt decoding when decode fails right after Initialize().
233 std::deque<scoped_refptr<DecoderBuffer>> pending_buffers_;
234 int sequence_token_;
235
229 // NOTE: Weak pointers must be invalidated before all other member variables. 236 // NOTE: Weak pointers must be invalidated before all other member variables.
230 base::WeakPtrFactory<DecoderStream<StreamType> > weak_factory_; 237 base::WeakPtrFactory<DecoderStream<StreamType> > weak_factory_;
231 }; 238 };
232 239
233 template <> 240 template <>
234 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; 241 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const;
235 242
236 template <> 243 template <>
237 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; 244 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const;
238 245
239 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; 246 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream;
240 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; 247 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream;
241 248
242 } // namespace media 249 } // namespace media
243 250
244 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ 251 #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