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

Side by Side Diff: webrtc/modules/audio_coding/codecs/audio_encoder.h

Issue 1967503002: Audio codec usage statistics (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: CL attempt 2. Added/responded to most comments Created 4 years, 7 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 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 EncodedInfo(); 47 EncodedInfo();
48 EncodedInfo(const EncodedInfo&); 48 EncodedInfo(const EncodedInfo&);
49 EncodedInfo(EncodedInfo&&); 49 EncodedInfo(EncodedInfo&&);
50 ~EncodedInfo(); 50 ~EncodedInfo();
51 EncodedInfo& operator=(const EncodedInfo&); 51 EncodedInfo& operator=(const EncodedInfo&);
52 EncodedInfo& operator=(EncodedInfo&&); 52 EncodedInfo& operator=(EncodedInfo&&);
53 53
54 std::vector<EncodedInfoLeaf> redundant; 54 std::vector<EncodedInfoLeaf> redundant;
55 }; 55 };
56 56
57 AudioEncoder();
58
57 virtual ~AudioEncoder() = default; 59 virtual ~AudioEncoder() = default;
58 60
59 // Returns the input sample rate in Hz and the number of input channels. 61 // Returns the input sample rate in Hz and the number of input channels.
60 // These are constants set at instantiation time. 62 // These are constants set at instantiation time.
61 virtual int SampleRateHz() const = 0; 63 virtual int SampleRateHz() const = 0;
62 virtual size_t NumChannels() const = 0; 64 virtual size_t NumChannels() const = 0;
63 65
64 // Returns the rate at which the RTP timestamps are updated. The default 66 // Returns the rate at which the RTP timestamps are updated. The default
65 // implementation returns SampleRateHz(). 67 // implementation returns SampleRateHz().
66 virtual int RtpTimestampRateHz() const; 68 virtual int RtpTimestampRateHz() const;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // implementation does the latter). 131 // implementation does the latter).
130 virtual void SetTargetBitrate(int target_bps); 132 virtual void SetTargetBitrate(int target_bps);
131 133
132 protected: 134 protected:
133 // Subclasses implement this to perform the actual encoding. Called by 135 // Subclasses implement this to perform the actual encoding. Called by
134 // Encode(). 136 // Encode().
135 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, 137 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
136 rtc::ArrayView<const int16_t> audio, 138 rtc::ArrayView<const int16_t> audio,
137 rtc::Buffer* encoded) = 0; 139 rtc::Buffer* encoded) = 0;
138 140
141 // Returns a pointer to a statically allocated string with the codec
142 // name, e.g. "Opus" or "iSAC". The default implementation returns
143 // null, which means no name
144 virtual const char* GetCodecName() const;
145
139 private: 146 private:
140 // This function is deprecated. It was used to return the maximum number of 147 // This function is deprecated. It was used to return the maximum number of
141 // bytes that can be produced by the encoder at each Encode() call. Since the 148 // bytes that can be produced by the encoder at each Encode() call. Since the
142 // Encode interface was changed to use rtc::Buffer, this is no longer 149 // Encode interface was changed to use rtc::Buffer, this is no longer
143 // applicable. It is only kept in to avoid breaking subclasses that still have 150 // applicable. It is only kept in to avoid breaking subclasses that still have
144 // it implemented (with the override attribute). It will be removed as soon 151 // it implemented (with the override attribute). It will be removed as soon
145 // as these subclasses have been given a chance to change. 152 // as these subclasses have been given a chance to change.
146 virtual size_t MaxEncodedBytes() const; 153 virtual size_t MaxEncodedBytes() const;
154
155 // Every time AudioEncoder::Encode() is called, this number is
156 // incremented. Every 500 increments, this number is set to zero and
157 // a value is logged to the UMA histogram
158 // "WebRTC.Audio.Encoder.CodecType"
159 size_t encoded_packets;
147 }; 160 };
148 } // namespace webrtc 161 } // namespace webrtc
149 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ 162 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698