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

Side by Side Diff: media/base/audio_discard_helper.h

Issue 2435603009: Use ffmpeg for opus decoding, no need to maintain our decoder. (Closed)
Patch Set: Created 4 years, 2 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_BASE_AUDIO_DISCARD_HELPER_H_ 5 #ifndef MEDIA_BASE_AUDIO_DISCARD_HELPER_H_
6 #define MEDIA_BASE_AUDIO_DISCARD_HELPER_H_ 6 #define MEDIA_BASE_AUDIO_DISCARD_HELPER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 16 matching lines...) Expand all
27 // 27 //
28 // |decoder_delay| is the number of frames a decoder will output before data 28 // |decoder_delay| is the number of frames a decoder will output before data
29 // corresponding to the first encoded buffer is output. Callers only need to 29 // corresponding to the first encoded buffer is output. Callers only need to
30 // specify this if the decoder inserts frames which have no corresponding 30 // specify this if the decoder inserts frames which have no corresponding
31 // encoded buffer. 31 // encoded buffer.
32 // 32 //
33 // For example, most MP3 decoders will output 529 junk frames before the data 33 // For example, most MP3 decoders will output 529 junk frames before the data
34 // corresponding to the first encoded buffer is output. These frames are not 34 // corresponding to the first encoded buffer is output. These frames are not
35 // represented in the encoded data stream and instead are an artifact of how 35 // represented in the encoded data stream and instead are an artifact of how
36 // most MP3 decoders work. See http://lame.sourceforge.net/tech-FAQ.txt 36 // most MP3 decoders work. See http://lame.sourceforge.net/tech-FAQ.txt
37 AudioDiscardHelper(int sample_rate, size_t decoder_delay); 37 AudioDiscardHelper(int sample_rate,
38 size_t decoder_delay,
39 bool delayed_discard);
38 ~AudioDiscardHelper(); 40 ~AudioDiscardHelper();
39 41
40 // Converts a TimeDelta to a frame count based on the constructed sample rate. 42 // Converts a TimeDelta to a frame count based on the constructed sample rate.
41 // |duration| must be positive. 43 // |duration| must be positive.
42 size_t TimeDeltaToFrames(base::TimeDelta duration) const; 44 size_t TimeDeltaToFrames(base::TimeDelta duration) const;
43 45
44 // Resets internal state and indicates that |initial_discard| of upcoming 46 // Resets internal state and indicates that |initial_discard| of upcoming
45 // frames should be discarded. 47 // frames should be discarded.
46 void Reset(size_t initial_discard); 48 void Reset(size_t initial_discard);
47 49
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // associated buffer. 85 // associated buffer.
84 size_t discard_frames_; 86 size_t discard_frames_;
85 87
86 // The last encoded buffer timestamp seen by ProcessBuffers() or kNoTimestamp 88 // The last encoded buffer timestamp seen by ProcessBuffers() or kNoTimestamp
87 // if no buffers have been seen thus far. Used to issue warnings for buffer 89 // if no buffers have been seen thus far. Used to issue warnings for buffer
88 // sequences with non-monotonic timestamps. 90 // sequences with non-monotonic timestamps.
89 base::TimeDelta last_input_timestamp_; 91 base::TimeDelta last_input_timestamp_;
90 92
91 // Certain codecs require two encoded buffers before they'll output the first 93 // Certain codecs require two encoded buffers before they'll output the first
92 // decoded buffer. In this case DiscardPadding must be carried over from the 94 // decoded buffer. In this case DiscardPadding must be carried over from the
93 // previous encoded buffer. Enabled automatically if an encoded buffer is 95 // previous encoded buffer. Enabled automatically if an encoded buffer is
wolenetz 2016/10/21 22:30:58 It's const, ctor initialized now, so no longer ena
wolenetz 2016/11/18 00:36:41 In patch set 2, this code comment still incorrectl
DaleCurtis 2016/11/18 00:51:27 Fixed.
94 // given to ProcessBuffers() with a NULL decoded buffer. 96 // given to ProcessBuffers() with a NULL decoded buffer.
95 bool delayed_discard_; 97 const bool delayed_discard_;
96 DecoderBuffer::DiscardPadding delayed_discard_padding_; 98 DecoderBuffer::DiscardPadding delayed_discard_padding_;
97 99
98 // When |decoder_delay_| > 0, the number of frames which should be discarded 100 // When |decoder_delay_| > 0, the number of frames which should be discarded
99 // from the next buffer. The index at which to start discarding is calculated 101 // from the next buffer. The index at which to start discarding is calculated
100 // by subtracting |delayed_end_discard_| from |decoder_delay_|. 102 // by subtracting |delayed_end_discard_| from |decoder_delay_|.
101 size_t delayed_end_discard_; 103 size_t delayed_end_discard_;
102 104
103 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioDiscardHelper); 105 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioDiscardHelper);
104 }; 106 };
105 107
106 } // namespace media 108 } // namespace media
107 109
108 #endif // MEDIA_BASE_AUDIO_DISCARD_HELPER_H_ 110 #endif // MEDIA_BASE_AUDIO_DISCARD_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698