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

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

Issue 2362703002: Adding audio network adaptor to AudioEncoderOpus. (Closed)
Patch Set: adding a missing deps 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 /* 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
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
13 13
14 #include <algorithm> 14 #include <algorithm>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/array_view.h" 17 #include "webrtc/base/array_view.h"
18 #include "webrtc/base/buffer.h" 18 #include "webrtc/base/buffer.h"
19 #include "webrtc/base/deprecation.h" 19 #include "webrtc/base/deprecation.h"
20 #include "webrtc/typedefs.h" 20 #include "webrtc/typedefs.h"
21 21
22 namespace webrtc { 22 namespace webrtc {
23 23
24 class Clock;
25
24 // This is the interface class for encoders in AudioCoding module. Each codec 26 // This is the interface class for encoders in AudioCoding module. Each codec
25 // type must have an implementation of this class. 27 // type must have an implementation of this class.
26 class AudioEncoder { 28 class AudioEncoder {
27 public: 29 public:
28 // Used for UMA logging of codec usage. The same codecs, with the 30 // Used for UMA logging of codec usage. The same codecs, with the
29 // same values, must be listed in 31 // same values, must be listed in
30 // src/tools/metrics/histograms/histograms.xml in chromium to log 32 // src/tools/metrics/histograms/histograms.xml in chromium to log
31 // correct values. 33 // correct values.
32 enum class CodecType { 34 enum class CodecType {
33 kOther = 0, // Codec not specified, and/or not listed in this enum 35 kOther = 0, // Codec not specified, and/or not listed in this enum
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 157
156 // Causes this encoder to let go of any other encoders it contains, and 158 // Causes this encoder to let go of any other encoders it contains, and
157 // returns a pointer to an array where they are stored (which is required to 159 // returns a pointer to an array where they are stored (which is required to
158 // live as long as this encoder). Unless the returned array is empty, you may 160 // live as long as this encoder). Unless the returned array is empty, you may
159 // not call any methods on this encoder afterwards, except for the 161 // not call any methods on this encoder afterwards, except for the
160 // destructor. The default implementation just returns an empty array. 162 // destructor. The default implementation just returns an empty array.
161 // NOTE: This method is subject to change. Do not call or override it. 163 // NOTE: This method is subject to change. Do not call or override it.
162 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> 164 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>>
163 ReclaimContainedEncoders(); 165 ReclaimContainedEncoders();
164 166
167 // Enables audio network adaptor. Returns true if successful.
168 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string,
169 const Clock* clock);
170
171 // Disables audio network adaptor.
172 virtual void DisableAudioNetworkAdaptor();
173
174 // Provides uplink bandwidth to this encoder to allow it to adapt.
175 virtual void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps);
176
177 // Provides uplink packet loss fraction to this encoder to allow it to adapt.
178 virtual void OnReceivedUplinkPacketLossFraction(
179 float uplink_packet_loss_fraction);
180
181 // Provides target audio bitrate to this encoder to allow it to adapt.
182 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps);
183
184 // Provides RTT to this encoder to allow it to adapt.
185 virtual void OnReceivedRtt(int rtt_ms);
186
187 // To allow encoder to adapt its frame length, it must be provided the frame
188 // length range that receives can accept.
189 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms,
190 int max_frame_length_ms);
191
165 protected: 192 protected:
166 // Subclasses implement this to perform the actual encoding. Called by 193 // Subclasses implement this to perform the actual encoding. Called by
167 // Encode(). 194 // Encode().
168 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, 195 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
169 rtc::ArrayView<const int16_t> audio, 196 rtc::ArrayView<const int16_t> audio,
170 rtc::Buffer* encoded) = 0; 197 rtc::Buffer* encoded) = 0;
171 }; 198 };
172 } // namespace webrtc 199 } // namespace webrtc
173 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ 200 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698