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

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

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. 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
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/filters/audio_timestamp_validator.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_AUDIO_TIMESTAMP_VALIDATOR_H_ 5 #ifndef MEDIA_FILTERS_AUDIO_TIMESTAMP_VALIDATOR_H_
6 #define MEDIA_FILTERS_AUDIO_TIMESTAMP_VALIDATOR_H_ 6 #define MEDIA_FILTERS_AUDIO_TIMESTAMP_VALIDATOR_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "media/base/audio_buffer.h" 10 #include "media/base/audio_buffer.h"
11 #include "media/base/audio_decoder_config.h" 11 #include "media/base/audio_decoder_config.h"
12 #include "media/base/audio_timestamp_helper.h" 12 #include "media/base/audio_timestamp_helper.h"
13 #include "media/base/decoder_buffer.h" 13 #include "media/base/decoder_buffer.h"
14 #include "media/base/media_log.h" 14 #include "media/base/media_log.h"
15 #include "media/base/timestamp_constants.h" 15 #include "media/base/timestamp_constants.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 class MEDIA_EXPORT AudioTimestampValidator { 19 class MEDIA_EXPORT AudioTimestampValidator {
20 public: 20 public:
21 AudioTimestampValidator(const AudioDecoderConfig& decoder_config, 21 AudioTimestampValidator(const AudioDecoderConfig& decoder_config,
22 const scoped_refptr<MediaLog>& media_log); 22 MediaLog* media_log);
23 ~AudioTimestampValidator(); 23 ~AudioTimestampValidator();
24 24
25 // These methods monitor DecoderBuffer timestamps for gaps for the purpose of 25 // These methods monitor DecoderBuffer timestamps for gaps for the purpose of
26 // warning developers when gaps may cause AV sync drift. A DecoderBuffer's 26 // warning developers when gaps may cause AV sync drift. A DecoderBuffer's
27 // timestamp should roughly equal the timestamp of the previous buffer offset 27 // timestamp should roughly equal the timestamp of the previous buffer offset
28 // by the previous buffer's duration. 28 // by the previous buffer's duration.
29 void CheckForTimestampGap(const scoped_refptr<DecoderBuffer>& buffer); 29 void CheckForTimestampGap(const scoped_refptr<DecoderBuffer>& buffer);
30 void RecordOutputDuration(const scoped_refptr<AudioBuffer>& buffer); 30 void RecordOutputDuration(const scoped_refptr<AudioBuffer>& buffer);
31 31
32 private: 32 private:
33 bool has_codec_delay_; 33 bool has_codec_delay_;
34 scoped_refptr<MediaLog> media_log_; 34 MediaLog* media_log_;
35 35
36 // Accumulates time from decoded audio frames. We adjust the base timestamp as 36 // Accumulates time from decoded audio frames. We adjust the base timestamp as
37 // needed for the first few buffers (stabilization period) of decoded output 37 // needed for the first few buffers (stabilization period) of decoded output
38 // to account for pre-skip and codec delay. See CheckForTimestampGap(). 38 // to account for pre-skip and codec delay. See CheckForTimestampGap().
39 std::unique_ptr<AudioTimestampHelper> audio_output_ts_helper_; 39 std::unique_ptr<AudioTimestampHelper> audio_output_ts_helper_;
40 40
41 base::TimeDelta audio_base_ts_; 41 base::TimeDelta audio_base_ts_;
42 42
43 // Initially false, set to true when we observe gap between encoded timestamps 43 // Initially false, set to true when we observe gap between encoded timestamps
44 // match gap between output decoder buffers. 44 // match gap between output decoder buffers.
(...skipping 13 matching lines...) Expand all
58 // the detected gap amount. This avoids log spam while still emitting 58 // the detected gap amount. This avoids log spam while still emitting
59 // logs if things get worse. See CheckTimestampForGap(). 59 // logs if things get worse. See CheckTimestampForGap().
60 uint32_t drift_warning_threshold_msec_; 60 uint32_t drift_warning_threshold_msec_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(AudioTimestampValidator); 62 DISALLOW_COPY_AND_ASSIGN(AudioTimestampValidator);
63 }; 63 };
64 64
65 } // namespace media 65 } // namespace media
66 66
67 #endif // MEDIA_FILTERS_AUDIO_TIMESTAMP_VALIDATOR_H_ 67 #endif // MEDIA_FILTERS_AUDIO_TIMESTAMP_VALIDATOR_H_
OLDNEW
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/filters/audio_timestamp_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698