OLD | NEW |
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/base/optional.h" | 20 #include "webrtc/base/optional.h" |
21 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
22 | 22 |
23 namespace webrtc { | 23 namespace webrtc { |
24 | 24 |
25 class Clock; | 25 class Clock; |
| 26 class RtcEventLog; |
26 | 27 |
27 // This is the interface class for encoders in AudioCoding module. Each codec | 28 // This is the interface class for encoders in AudioCoding module. Each codec |
28 // type must have an implementation of this class. | 29 // type must have an implementation of this class. |
29 class AudioEncoder { | 30 class AudioEncoder { |
30 public: | 31 public: |
31 // Used for UMA logging of codec usage. The same codecs, with the | 32 // Used for UMA logging of codec usage. The same codecs, with the |
32 // same values, must be listed in | 33 // same values, must be listed in |
33 // src/tools/metrics/histograms/histograms.xml in chromium to log | 34 // src/tools/metrics/histograms/histograms.xml in chromium to log |
34 // correct values. | 35 // correct values. |
35 enum class CodecType { | 36 enum class CodecType { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // returns a pointer to an array where they are stored (which is required to | 157 // returns a pointer to an array where they are stored (which is required to |
157 // live as long as this encoder). Unless the returned array is empty, you may | 158 // live as long as this encoder). Unless the returned array is empty, you may |
158 // not call any methods on this encoder afterwards, except for the | 159 // not call any methods on this encoder afterwards, except for the |
159 // destructor. The default implementation just returns an empty array. | 160 // destructor. The default implementation just returns an empty array. |
160 // NOTE: This method is subject to change. Do not call or override it. | 161 // NOTE: This method is subject to change. Do not call or override it. |
161 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> | 162 virtual rtc::ArrayView<std::unique_ptr<AudioEncoder>> |
162 ReclaimContainedEncoders(); | 163 ReclaimContainedEncoders(); |
163 | 164 |
164 // Enables audio network adaptor. Returns true if successful. | 165 // Enables audio network adaptor. Returns true if successful. |
165 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, | 166 virtual bool EnableAudioNetworkAdaptor(const std::string& config_string, |
| 167 RtcEventLog* event_log, |
166 const Clock* clock); | 168 const Clock* clock); |
167 | 169 |
168 // Disables audio network adaptor. | 170 // Disables audio network adaptor. |
169 virtual void DisableAudioNetworkAdaptor(); | 171 virtual void DisableAudioNetworkAdaptor(); |
170 | 172 |
171 // Provides uplink packet loss fraction to this encoder to allow it to adapt. | 173 // Provides uplink packet loss fraction to this encoder to allow it to adapt. |
172 // |uplink_packet_loss_fraction| is in the range [0.0, 1.0]. | 174 // |uplink_packet_loss_fraction| is in the range [0.0, 1.0]. |
173 virtual void OnReceivedUplinkPacketLossFraction( | 175 virtual void OnReceivedUplinkPacketLossFraction( |
174 float uplink_packet_loss_fraction); | 176 float uplink_packet_loss_fraction); |
175 | 177 |
(...skipping 20 matching lines...) Expand all Loading... |
196 | 198 |
197 protected: | 199 protected: |
198 // Subclasses implement this to perform the actual encoding. Called by | 200 // Subclasses implement this to perform the actual encoding. Called by |
199 // Encode(). | 201 // Encode(). |
200 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, | 202 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
201 rtc::ArrayView<const int16_t> audio, | 203 rtc::ArrayView<const int16_t> audio, |
202 rtc::Buffer* encoded) = 0; | 204 rtc::Buffer* encoded) = 0; |
203 }; | 205 }; |
204 } // namespace webrtc | 206 } // namespace webrtc |
205 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ | 207 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ |
OLD | NEW |