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_API_AUDIO_CODECS_AUDIO_ENCODER_H_ | 11 #ifndef WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_H_ |
12 #define WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_H_ | 12 #define WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_H_ |
13 | 13 |
14 #include <algorithm> | 14 #include <algorithm> |
15 #include <memory> | 15 #include <memory> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/api/array_view.h" | 19 #include "webrtc/api/array_view.h" |
20 #include "webrtc/api/optional.h" | 20 #include "webrtc/api/optional.h" |
21 #include "webrtc/rtc_base/buffer.h" | 21 #include "webrtc/rtc_base/buffer.h" |
22 #include "webrtc/rtc_base/deprecation.h" | 22 #include "webrtc/rtc_base/deprecation.h" |
23 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 | 26 |
27 class Clock; | 27 class Clock; |
28 class RtcEventLog; | 28 class RtcEventLog; |
29 | 29 |
| 30 // Statistics related to Audio Network Adaptation. |
| 31 struct ANAStats { |
| 32 ANAStats(); |
| 33 ANAStats(const ANAStats&); |
| 34 ~ANAStats(); |
| 35 // Number of actions taken by the ANA bitrate controller since the start of |
| 36 // the call. If this value is not set, it indicates that the bitrate |
| 37 // controller is disabled. |
| 38 rtc::Optional<uint32_t> bitrate_action_counter; |
| 39 // Number of actions taken by the ANA channel controller since the start of |
| 40 // the call. If this value is not set, it indicates that the channel |
| 41 // controller is disabled. |
| 42 rtc::Optional<uint32_t> channel_action_counter; |
| 43 // Number of actions taken by the ANA DTX controller since the start of the |
| 44 // call. If this value is not set, it indicates that the DTX controller is |
| 45 // disabled. |
| 46 rtc::Optional<uint32_t> dtx_action_counter; |
| 47 // Number of actions taken by the ANA FEC controller since the start of the |
| 48 // call. If this value is not set, it indicates that the FEC controller is |
| 49 // disabled. |
| 50 rtc::Optional<uint32_t> fec_action_counter; |
| 51 // Number of actions taken by the ANA frame length controller since the start |
| 52 // of the call. If this value is not set, it indicates that the frame length |
| 53 // controller is disabled. |
| 54 rtc::Optional<uint32_t> frame_length_action_counter; |
| 55 }; |
| 56 |
30 // This is the interface class for encoders in AudioCoding module. Each codec | 57 // This is the interface class for encoders in AudioCoding module. Each codec |
31 // type must have an implementation of this class. | 58 // type must have an implementation of this class. |
32 class AudioEncoder { | 59 class AudioEncoder { |
33 public: | 60 public: |
34 // Used for UMA logging of codec usage. The same codecs, with the | 61 // Used for UMA logging of codec usage. The same codecs, with the |
35 // same values, must be listed in | 62 // same values, must be listed in |
36 // src/tools/metrics/histograms/histograms.xml in chromium to log | 63 // src/tools/metrics/histograms/histograms.xml in chromium to log |
37 // correct values. | 64 // correct values. |
38 enum class CodecType { | 65 enum class CodecType { |
39 kOther = 0, // Codec not specified, and/or not listed in this enum | 66 kOther = 0, // Codec not specified, and/or not listed in this enum |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 223 |
197 // Provides overhead to this encoder to adapt. The overhead is the number of | 224 // Provides overhead to this encoder to adapt. The overhead is the number of |
198 // bytes that will be added to each packet the encoder generates. | 225 // bytes that will be added to each packet the encoder generates. |
199 virtual void OnReceivedOverhead(size_t overhead_bytes_per_packet); | 226 virtual void OnReceivedOverhead(size_t overhead_bytes_per_packet); |
200 | 227 |
201 // To allow encoder to adapt its frame length, it must be provided the frame | 228 // To allow encoder to adapt its frame length, it must be provided the frame |
202 // length range that receivers can accept. | 229 // length range that receivers can accept. |
203 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, | 230 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, |
204 int max_frame_length_ms); | 231 int max_frame_length_ms); |
205 | 232 |
| 233 // Get statistics related to audio network adaptation. |
| 234 virtual ANAStats GetANAStats() const; |
| 235 |
206 protected: | 236 protected: |
207 // Subclasses implement this to perform the actual encoding. Called by | 237 // Subclasses implement this to perform the actual encoding. Called by |
208 // Encode(). | 238 // Encode(). |
209 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, | 239 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
210 rtc::ArrayView<const int16_t> audio, | 240 rtc::ArrayView<const int16_t> audio, |
211 rtc::Buffer* encoded) = 0; | 241 rtc::Buffer* encoded) = 0; |
212 }; | 242 }; |
213 } // namespace webrtc | 243 } // namespace webrtc |
214 #endif // WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_H_ | 244 #endif // WEBRTC_API_AUDIO_CODECS_AUDIO_ENCODER_H_ |
OLD | NEW |