123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- #ifndef CALL_AUDIO_SEND_STREAM_H_
- #define CALL_AUDIO_SEND_STREAM_H_
- #include <memory>
- #include <string>
- #include <vector>
- #include "absl/types/optional.h"
- #include "api/audio_codecs/audio_codec_pair_id.h"
- #include "api/audio_codecs/audio_encoder.h"
- #include "api/audio_codecs/audio_encoder_factory.h"
- #include "api/audio_codecs/audio_format.h"
- #include "api/call/transport.h"
- #include "api/crypto/crypto_options.h"
- #include "api/crypto/frame_encryptor_interface.h"
- #include "api/frame_transformer_interface.h"
- #include "api/rtp_parameters.h"
- #include "api/scoped_refptr.h"
- #include "call/audio_sender.h"
- #include "call/rtp_config.h"
- #include "modules/audio_processing/include/audio_processing_statistics.h"
- #include "modules/rtp_rtcp/include/report_block_data.h"
- namespace webrtc {
- class AudioSendStream : public AudioSender {
- public:
- struct Stats {
- Stats();
- ~Stats();
-
- uint32_t local_ssrc = 0;
- int64_t payload_bytes_sent = 0;
- int64_t header_and_padding_bytes_sent = 0;
-
- uint64_t retransmitted_bytes_sent = 0;
- int32_t packets_sent = 0;
-
- uint64_t retransmitted_packets_sent = 0;
- int32_t packets_lost = -1;
- float fraction_lost = -1.0f;
- std::string codec_name;
- absl::optional<int> codec_payload_type;
- int32_t jitter_ms = -1;
- int64_t rtt_ms = -1;
- int16_t audio_level = 0;
-
-
- double total_input_energy = 0.0;
- double total_input_duration = 0.0;
- bool typing_noise_detected = false;
- ANAStats ana_statistics;
- AudioProcessingStats apm_statistics;
- int64_t target_bitrate_bps = 0;
-
-
-
-
- std::vector<ReportBlockData> report_block_datas;
- };
- struct Config {
- Config() = delete;
- explicit Config(Transport* send_transport);
- ~Config();
- std::string ToString() const;
-
- struct Rtp {
- Rtp();
- ~Rtp();
- std::string ToString() const;
-
- uint32_t ssrc = 0;
-
-
- std::string rid;
-
-
- std::string mid;
-
- bool extmap_allow_mixed = false;
-
- std::vector<RtpExtension> extensions;
-
- std::string c_name;
- } rtp;
-
- int rtcp_report_interval_ms = 5000;
-
-
- Transport* send_transport = nullptr;
-
-
-
- int min_bitrate_bps = -1;
- int max_bitrate_bps = -1;
- double bitrate_priority = 1.0;
- bool has_dscp = false;
-
-
- absl::optional<std::string> audio_network_adaptor_config;
- struct SendCodecSpec {
- SendCodecSpec(int payload_type, const SdpAudioFormat& format);
- ~SendCodecSpec();
- std::string ToString() const;
- bool operator==(const SendCodecSpec& rhs) const;
- bool operator!=(const SendCodecSpec& rhs) const {
- return !(*this == rhs);
- }
- int payload_type;
- SdpAudioFormat format;
- bool nack_enabled = false;
- bool transport_cc_enabled = false;
- absl::optional<int> cng_payload_type;
- absl::optional<int> red_payload_type;
-
- absl::optional<int> target_bitrate_bps;
- };
- absl::optional<SendCodecSpec> send_codec_spec;
- rtc::scoped_refptr<AudioEncoderFactory> encoder_factory;
- absl::optional<AudioCodecPairId> codec_pair_id;
-
- std::string track_id;
-
- webrtc::CryptoOptions crypto_options;
-
-
-
- rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor;
-
-
- rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer;
- };
- virtual ~AudioSendStream() = default;
- virtual const webrtc::AudioSendStream::Config& GetConfig() const = 0;
-
- virtual void Reconfigure(const Config& config) = 0;
-
-
- virtual void Start() = 0;
-
-
- virtual void Stop() = 0;
-
- virtual bool SendTelephoneEvent(int payload_type,
- int payload_frequency,
- int event,
- int duration_ms) = 0;
- virtual void SetMuted(bool muted) = 0;
- virtual Stats GetStats() const = 0;
- virtual Stats GetStats(bool has_remote_tracks) const = 0;
- };
- }
- #endif
|