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

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

Issue 1954633002: MEDIA_LOG for large encoded timestamp gaps in decoder stream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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 11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "media/base/audio_decoder.h" 17 #include "media/base/audio_decoder.h"
18 #include "media/base/audio_timestamp_helper.h"
17 #include "media/base/demuxer_stream.h" 19 #include "media/base/demuxer_stream.h"
18 #include "media/base/media_export.h" 20 #include "media/base/media_export.h"
19 #include "media/base/media_log.h" 21 #include "media/base/media_log.h"
20 #include "media/base/moving_average.h" 22 #include "media/base/moving_average.h"
21 #include "media/base/pipeline_status.h" 23 #include "media/base/pipeline_status.h"
22 #include "media/base/timestamp_constants.h" 24 #include "media/base/timestamp_constants.h"
25 #include "media/filters/audio_timestamp_validator.h"
23 #include "media/filters/decoder_selector.h" 26 #include "media/filters/decoder_selector.h"
24 #include "media/filters/decoder_stream_traits.h" 27 #include "media/filters/decoder_stream_traits.h"
25 28
26 namespace base { 29 namespace base {
27 class SingleThreadTaskRunner; 30 class SingleThreadTaskRunner;
28 } 31 }
29 32
30 namespace media { 33 namespace media {
31 34
32 class CdmContext; 35 class CdmContext;
33 class DecryptingDemuxerStream; 36 class DecryptingDemuxerStream;
34 37
35 // Wraps a DemuxerStream and a list of Decoders and provides decoded 38 // Wraps a DemuxerStream and a list of Decoders and provides decoded
36 // output to its client (e.g. Audio/VideoRendererImpl). 39 // output to its client (e.g. Audio/VideoRendererImpl).
37 template<DemuxerStream::Type StreamType> 40 template<DemuxerStream::Type StreamType>
38 class MEDIA_EXPORT DecoderStream { 41 class MEDIA_EXPORT DecoderStream {
39 public: 42 public:
40 typedef DecoderStreamTraits<StreamType> StreamTraits; 43 typedef DecoderStreamTraits<StreamType> StreamTraits;
41 typedef typename StreamTraits::DecoderType Decoder; 44 typedef typename StreamTraits::DecoderType Decoder;
42 typedef typename StreamTraits::OutputType Output; 45 typedef typename StreamTraits::OutputType Output;
46 typedef typename StreamTraits::ConfigType Config;
43 47
44 enum Status { 48 enum Status {
45 OK, // Everything went as planned. 49 OK, // Everything went as planned.
46 ABORTED, // Read aborted due to Reset() during pending read. 50 ABORTED, // Read aborted due to Reset() during pending read.
47 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. 51 DEMUXER_READ_ABORTED, // Demuxer returned aborted read.
48 DECODE_ERROR, // Decoder returned decode error. 52 DECODE_ERROR, // Decoder returned decode error.
49 }; 53 };
50 54
51 // Indicates completion of a DecoderStream initialization. 55 // Indicates completion of a DecoderStream initialization.
52 typedef base::Callback<void(bool success)> InitCB; 56 typedef base::Callback<void(bool success)> InitCB;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 void ReinitializeDecoder(); 189 void ReinitializeDecoder();
186 190
187 // Callback for Decoder reinitialization. 191 // Callback for Decoder reinitialization.
188 void OnDecoderReinitialized(bool success); 192 void OnDecoderReinitialized(bool success);
189 193
190 void CompleteDecoderReinitialization(bool success); 194 void CompleteDecoderReinitialization(bool success);
191 195
192 void ResetDecoder(); 196 void ResetDecoder();
193 void OnDecoderReset(); 197 void OnDecoderReset();
194 198
199 DecoderStreamTraits<StreamType> traits_;
200
195 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 201 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
196 202
197 scoped_refptr<MediaLog> media_log_; 203 scoped_refptr<MediaLog> media_log_;
198 204
199 State state_; 205 State state_;
200 206
201 StatisticsCB statistics_cb_; 207 StatisticsCB statistics_cb_;
202 InitCB init_cb_; 208 InitCB init_cb_;
203 base::Closure waiting_for_decryption_key_cb_; 209 base::Closure waiting_for_decryption_key_cb_;
204 210
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 std::deque<scoped_refptr<DecoderBuffer>> fallback_buffers_; 256 std::deque<scoped_refptr<DecoderBuffer>> fallback_buffers_;
251 257
252 // TODO(tguilbert): support config changes during decoder fallback, see 258 // TODO(tguilbert): support config changes during decoder fallback, see
253 // crbug.com/603713 259 // crbug.com/603713
254 bool received_config_change_during_reinit_; 260 bool received_config_change_during_reinit_;
255 261
256 // Used to track read requests in case the STATE_PENDIND_DEMUXER_READ get 262 // Used to track read requests in case the STATE_PENDIND_DEMUXER_READ get
257 // overwritten by an error. 263 // overwritten by an error.
258 bool pending_demuxer_read_; 264 bool pending_demuxer_read_;
259 265
266 // Validates encoded timestamps match decoded output duration. MEDIA_LOG warns
DaleCurtis 2016/06/20 18:40:33 Delete now?
chcunningham 2016/06/21 00:31:59 Whoops, definitely!
267 // if timestamp gaps are detected. Sufficiently large gaps can lead to AV sync
268 // drift.
269 std::unique_ptr<AudioTimestampValidator> audio_ts_validator_;
270
260 // NOTE: Weak pointers must be invalidated before all other member variables. 271 // NOTE: Weak pointers must be invalidated before all other member variables.
261 base::WeakPtrFactory<DecoderStream<StreamType>> weak_factory_; 272 base::WeakPtrFactory<DecoderStream<StreamType>> weak_factory_;
262 273
263 // Used to invalidate pending decode requests and output callbacks when 274 // Used to invalidate pending decode requests and output callbacks when
264 // falling back to a new decoder (on first decode error). 275 // falling back to a new decoder (on first decode error).
265 base::WeakPtrFactory<DecoderStream<StreamType>> fallback_weak_factory_; 276 base::WeakPtrFactory<DecoderStream<StreamType>> fallback_weak_factory_;
266 }; 277 };
267 278
268 template <> 279 template <>
269 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const; 280 bool DecoderStream<DemuxerStream::AUDIO>::CanReadWithoutStalling() const;
270 281
271 template <> 282 template <>
272 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; 283 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const;
273 284
274 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; 285 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream;
275 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; 286 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream;
276 287
277 } // namespace media 288 } // namespace media
278 289
279 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ 290 #endif // MEDIA_FILTERS_DECODER_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698