OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWORK_
ADAPTOR_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWORK_
ADAPTOR_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWORK_
ADAPTOR_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWORK_
ADAPTOR_H_ |
13 | 13 |
14 #include "webrtc/base/optional.h" | 14 #include "webrtc/base/optional.h" |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 | 17 |
18 // An AudioNetworkAdaptor optimizes the audio experience by suggesting a | 18 // An AudioNetworkAdaptor optimizes the audio experience by suggesting a |
19 // suitable runtime configuration (bit rate, frame length, FEC, etc.) to the | 19 // suitable runtime configuration (bit rate, frame length, FEC, etc.) to the |
20 // encoder based on network metrics. | 20 // encoder based on network metrics. |
21 class AudioNetworkAdaptor { | 21 class AudioNetworkAdaptor { |
22 public: | 22 public: |
23 struct EncoderRuntimeConfig { | 23 struct EncoderRuntimeConfig { |
24 EncoderRuntimeConfig(); | 24 EncoderRuntimeConfig(); |
25 EncoderRuntimeConfig(const EncoderRuntimeConfig& other); | 25 EncoderRuntimeConfig(const EncoderRuntimeConfig& other); |
26 ~EncoderRuntimeConfig(); | 26 ~EncoderRuntimeConfig(); |
27 rtc::Optional<int> bitrate_bps; | 27 rtc::Optional<int> bitrate_bps; |
28 rtc::Optional<int> frame_length_ms; | 28 rtc::Optional<int> frame_length_ms; |
| 29 // Note: This is what we tell the encoder. It doesn't have to reflect |
| 30 // the actual NetworkMetrics; it's subject to our decision. |
29 rtc::Optional<float> uplink_packet_loss_fraction; | 31 rtc::Optional<float> uplink_packet_loss_fraction; |
30 rtc::Optional<bool> enable_fec; | 32 rtc::Optional<bool> enable_fec; |
31 rtc::Optional<bool> enable_dtx; | 33 rtc::Optional<bool> enable_dtx; |
32 | 34 |
33 // Some encoders can encode fewer channels than the actual input to make | 35 // Some encoders can encode fewer channels than the actual input to make |
34 // better use of the bandwidth. |num_channels| sets the number of channels | 36 // better use of the bandwidth. |num_channels| sets the number of channels |
35 // to encode. | 37 // to encode. |
36 rtc::Optional<size_t> num_channels; | 38 rtc::Optional<size_t> num_channels; |
37 }; | 39 }; |
38 | 40 |
39 virtual ~AudioNetworkAdaptor() = default; | 41 virtual ~AudioNetworkAdaptor() = default; |
40 | 42 |
41 virtual void SetUplinkBandwidth(int uplink_bandwidth_bps) = 0; | 43 virtual void SetUplinkBandwidth(int uplink_bandwidth_bps) = 0; |
42 | 44 |
43 virtual void SetUplinkPacketLossFraction( | 45 virtual void SetUplinkPacketLossFraction( |
44 float uplink_packet_loss_fraction) = 0; | 46 float uplink_packet_loss_fraction) = 0; |
45 | 47 |
| 48 virtual void SetUplinkRecoverablePacketLossFraction( |
| 49 float uplink_recoverable_packet_loss_fraction) = 0; |
| 50 |
46 virtual void SetRtt(int rtt_ms) = 0; | 51 virtual void SetRtt(int rtt_ms) = 0; |
47 | 52 |
48 virtual void SetTargetAudioBitrate(int target_audio_bitrate_bps) = 0; | 53 virtual void SetTargetAudioBitrate(int target_audio_bitrate_bps) = 0; |
49 | 54 |
50 virtual void SetOverhead(size_t overhead_bytes_per_packet) = 0; | 55 virtual void SetOverhead(size_t overhead_bytes_per_packet) = 0; |
51 | 56 |
52 virtual EncoderRuntimeConfig GetEncoderRuntimeConfig() = 0; | 57 virtual EncoderRuntimeConfig GetEncoderRuntimeConfig() = 0; |
53 | 58 |
54 virtual void StartDebugDump(FILE* file_handle) = 0; | 59 virtual void StartDebugDump(FILE* file_handle) = 0; |
55 | 60 |
56 virtual void StopDebugDump() = 0; | 61 virtual void StopDebugDump() = 0; |
57 }; | 62 }; |
58 | 63 |
59 } // namespace webrtc | 64 } // namespace webrtc |
60 | 65 |
61 #endif // WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWO
RK_ADAPTOR_H_ | 66 #endif // WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_INCLUDE_AUDIO_NETWO
RK_ADAPTOR_H_ |
OLD | NEW |