| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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_CALL_AUDIO_SEND_STREAM_H_ | 11 #ifndef WEBRTC_CALL_AUDIO_SEND_STREAM_H_ |
| 12 #define WEBRTC_CALL_AUDIO_SEND_STREAM_H_ | 12 #define WEBRTC_CALL_AUDIO_SEND_STREAM_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/api/audio_codecs/audio_format.h" |
| 18 #include "webrtc/api/call/transport.h" | 19 #include "webrtc/api/call/transport.h" |
| 19 #include "webrtc/base/optional.h" | 20 #include "webrtc/base/optional.h" |
| 20 #include "webrtc/config.h" | 21 #include "webrtc/config.h" |
| 21 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | 22 #include "webrtc/modules/audio_coding/codecs/audio_encoder_factory.h" |
| 22 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
| 23 | 24 |
| 24 namespace webrtc { | 25 namespace webrtc { |
| 25 | 26 |
| 26 // WORK IN PROGRESS | 27 // WORK IN PROGRESS |
| 27 // This class is under development and is not yet intended for for use outside | 28 // This class is under development and is not yet intended for for use outside |
| 28 // of WebRtc/Libjingle. Please use the VoiceEngine API instead. | 29 // of WebRtc/Libjingle. Please use the VoiceEngine API instead. |
| 29 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 | 30 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 |
| 30 | 31 |
| 31 class AudioSendStream { | 32 class AudioSendStream { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // disable audio bitrate adaptation. | 96 // disable audio bitrate adaptation. |
| 96 // Note: This is still an experimental feature and not ready for real usage. | 97 // Note: This is still an experimental feature and not ready for real usage. |
| 97 int min_bitrate_bps = -1; | 98 int min_bitrate_bps = -1; |
| 98 int max_bitrate_bps = -1; | 99 int max_bitrate_bps = -1; |
| 99 | 100 |
| 100 // Defines whether to turn on audio network adaptor, and defines its config | 101 // Defines whether to turn on audio network adaptor, and defines its config |
| 101 // string. | 102 // string. |
| 102 rtc::Optional<std::string> audio_network_adaptor_config; | 103 rtc::Optional<std::string> audio_network_adaptor_config; |
| 103 | 104 |
| 104 struct SendCodecSpec { | 105 struct SendCodecSpec { |
| 105 SendCodecSpec(); | 106 SendCodecSpec(int payload_type, const SdpAudioFormat& format); |
| 107 ~SendCodecSpec(); |
| 106 std::string ToString() const; | 108 std::string ToString() const; |
| 107 | 109 |
| 108 bool operator==(const SendCodecSpec& rhs) const; | 110 bool operator==(const SendCodecSpec& rhs) const; |
| 109 bool operator!=(const SendCodecSpec& rhs) const { | 111 bool operator!=(const SendCodecSpec& rhs) const { |
| 110 return !(*this == rhs); | 112 return !(*this == rhs); |
| 111 } | 113 } |
| 112 | 114 |
| 115 int payload_type; |
| 116 SdpAudioFormat format; |
| 113 bool nack_enabled = false; | 117 bool nack_enabled = false; |
| 114 bool transport_cc_enabled = false; | 118 bool transport_cc_enabled = false; |
| 115 bool enable_codec_fec = false; | 119 rtc::Optional<int> cng_payload_type; |
| 116 bool enable_opus_dtx = false; | 120 // If unset, use the encoder's default target bitrate. |
| 117 int opus_max_playback_rate = 0; | 121 rtc::Optional<int> target_bitrate_bps; |
| 118 int cng_payload_type = -1; | 122 }; |
| 119 int cng_plfreq = -1; | 123 |
| 120 int max_ptime_ms = -1; | 124 rtc::Optional<SendCodecSpec> send_codec_spec; |
| 121 int min_ptime_ms = -1; | 125 rtc::scoped_refptr<AudioEncoderFactory> encoder_factory; |
| 122 webrtc::CodecInst codec_inst; | |
| 123 } send_codec_spec; | |
| 124 }; | 126 }; |
| 125 | 127 |
| 128 // Reconfigure the stream according to the Configuration. |
| 129 virtual void Reconfigure(const Config& config) = 0; |
| 130 |
| 126 // Starts stream activity. | 131 // Starts stream activity. |
| 127 // When a stream is active, it can receive, process and deliver packets. | 132 // When a stream is active, it can receive, process and deliver packets. |
| 128 virtual void Start() = 0; | 133 virtual void Start() = 0; |
| 129 // Stops stream activity. | 134 // Stops stream activity. |
| 130 // When a stream is stopped, it can't receive, process or deliver packets. | 135 // When a stream is stopped, it can't receive, process or deliver packets. |
| 131 virtual void Stop() = 0; | 136 virtual void Stop() = 0; |
| 132 | 137 |
| 133 // TODO(solenberg): Make payload_type a config property instead. | 138 // TODO(solenberg): Make payload_type a config property instead. |
| 134 virtual bool SendTelephoneEvent(int payload_type, int payload_frequency, | 139 virtual bool SendTelephoneEvent(int payload_type, int payload_frequency, |
| 135 int event, int duration_ms) = 0; | 140 int event, int duration_ms) = 0; |
| 136 | 141 |
| 137 virtual void SetMuted(bool muted) = 0; | 142 virtual void SetMuted(bool muted) = 0; |
| 138 | 143 |
| 139 virtual Stats GetStats() const = 0; | 144 virtual Stats GetStats() const = 0; |
| 140 | 145 |
| 141 protected: | 146 protected: |
| 142 virtual ~AudioSendStream() {} | 147 virtual ~AudioSendStream() {} |
| 143 }; | 148 }; |
| 144 } // namespace webrtc | 149 } // namespace webrtc |
| 145 | 150 |
| 146 #endif // WEBRTC_CALL_AUDIO_SEND_STREAM_H_ | 151 #endif // WEBRTC_CALL_AUDIO_SEND_STREAM_H_ |
| OLD | NEW |