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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 typedef typename StreamTraits::DecoderType Decoder; | 43 typedef typename StreamTraits::DecoderType Decoder; |
44 typedef typename StreamTraits::OutputType Output; | 44 typedef typename StreamTraits::OutputType Output; |
45 | 45 |
46 enum Status { | 46 enum Status { |
47 OK, // Everything went as planned. | 47 OK, // Everything went as planned. |
48 ABORTED, // Read aborted due to Reset() during pending read. | 48 ABORTED, // Read aborted due to Reset() during pending read. |
49 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. | 49 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. |
50 DECODE_ERROR, // Decoder returned decode error. | 50 DECODE_ERROR, // Decoder returned decode error. |
51 }; | 51 }; |
52 | 52 |
53 // Callback to create a list of decoders. | |
54 using CreateDecodersCB = base::RepeatingCallback<ScopedVector<Decoder>()>; | |
55 | |
53 // Indicates completion of a DecoderStream initialization. | 56 // Indicates completion of a DecoderStream initialization. |
54 typedef base::Callback<void(bool success)> InitCB; | 57 using InitCB = base::Callback<void(bool success)>; |
55 | 58 |
56 // Indicates completion of a DecoderStream read. | 59 // Indicates completion of a DecoderStream read. |
57 typedef base::Callback<void(Status, const scoped_refptr<Output>&)> ReadCB; | 60 using ReadCB = base::Callback<void(Status, const scoped_refptr<Output>&)>; |
58 | 61 |
59 DecoderStream(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 62 DecoderStream(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
60 ScopedVector<Decoder> decoders, | 63 CreateDecodersCB create_decoders_cb, |
61 MediaLog* media_log); | 64 MediaLog* media_log); |
62 virtual ~DecoderStream(); | 65 virtual ~DecoderStream(); |
63 | 66 |
64 // Returns the string representation of the StreamType for logging purpose. | 67 // Returns the string representation of the StreamType for logging purpose. |
65 std::string GetStreamTypeString(); | 68 std::string GetStreamTypeString(); |
66 | 69 |
67 // Initializes the DecoderStream and returns the initialization result | 70 // Initializes the DecoderStream and returns the initialization result |
68 // through |init_cb|. Note that |init_cb| is always called asynchronously. | 71 // through |init_cb|. Note that |init_cb| is always called asynchronously. |
69 // |cdm_context| can be used to handle encrypted stream. Can be null if the | 72 // |cdm_context| can be used to handle encrypted stream. Can be null if the |
70 // stream is not encrypted. | 73 // stream is not encrypted. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 | 207 |
205 CdmContext* cdm_context_; | 208 CdmContext* cdm_context_; |
206 | 209 |
207 std::unique_ptr<DecoderSelector<StreamType>> decoder_selector_; | 210 std::unique_ptr<DecoderSelector<StreamType>> decoder_selector_; |
208 | 211 |
209 std::unique_ptr<Decoder> decoder_; | 212 std::unique_ptr<Decoder> decoder_; |
210 | 213 |
211 // Whether |decoder_| has produced a frame yet. Reset on fallback. | 214 // Whether |decoder_| has produced a frame yet. Reset on fallback. |
212 bool decoder_produced_a_frame_; | 215 bool decoder_produced_a_frame_; |
213 | 216 |
217 // Whether we are on a fallback decoder. Used to make sure we at most fallback | |
watk
2017/05/04 21:35:33
What about instead of "on a fallback decoder" we s
xhwang
2017/05/04 23:53:14
How about has_fallen_back_once_on_decode_error_ ?
| |
218 // once, to prevent issues like fallback infinitely. | |
watk
2017/05/04 21:35:33
s/fallback infinitely/infinite fallback/
xhwang
2017/05/04 23:53:14
Done.
| |
219 bool is_on_fallback_decoder_; | |
220 | |
214 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; | 221 std::unique_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream_; |
215 | 222 |
216 ConfigChangeObserverCB config_change_observer_cb_; | 223 ConfigChangeObserverCB config_change_observer_cb_; |
217 DecoderChangeObserverCB decoder_change_observer_cb_; | 224 DecoderChangeObserverCB decoder_change_observer_cb_; |
218 | 225 |
219 // An end-of-stream buffer has been sent for decoding, no more buffers should | 226 // An end-of-stream buffer has been sent for decoding, no more buffers should |
220 // be sent for decoding until it completes. | 227 // be sent for decoding until it completes. |
221 // TODO(sandersd): Turn this into a State. http://crbug.com/408316 | 228 // TODO(sandersd): Turn this into a State. http://crbug.com/408316 |
222 bool decoding_eos_; | 229 bool decoding_eos_; |
223 | 230 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 | 268 |
262 template <> | 269 template <> |
263 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; | 270 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; |
264 | 271 |
265 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; | 272 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; |
266 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; | 273 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; |
267 | 274 |
268 } // namespace media | 275 } // namespace media |
269 | 276 |
270 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ | 277 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ |
OLD | NEW |