123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- #ifndef CALL_AUDIO_RECEIVE_STREAM_H_
- #define CALL_AUDIO_RECEIVE_STREAM_H_
- #include <map>
- #include <memory>
- #include <string>
- #include <vector>
- #include "absl/types/optional.h"
- #include "api/audio_codecs/audio_decoder_factory.h"
- #include "api/call/transport.h"
- #include "api/crypto/crypto_options.h"
- #include "api/crypto/frame_decryptor_interface.h"
- #include "api/frame_transformer_interface.h"
- #include "api/rtp_parameters.h"
- #include "api/scoped_refptr.h"
- #include "api/transport/rtp/rtp_source.h"
- #include "call/rtp_config.h"
- namespace webrtc {
- class AudioSinkInterface;
- class AudioReceiveStream {
- public:
- struct Stats {
- Stats();
- ~Stats();
- uint32_t remote_ssrc = 0;
- int64_t payload_bytes_rcvd = 0;
- int64_t header_and_padding_bytes_rcvd = 0;
- uint32_t packets_rcvd = 0;
- uint64_t fec_packets_received = 0;
- uint64_t fec_packets_discarded = 0;
- uint32_t packets_lost = 0;
- std::string codec_name;
- absl::optional<int> codec_payload_type;
- uint32_t jitter_ms = 0;
- uint32_t jitter_buffer_ms = 0;
- uint32_t jitter_buffer_preferred_ms = 0;
- uint32_t delay_estimate_ms = 0;
- int32_t audio_level = -1;
-
-
- double total_output_energy = 0.0;
- uint64_t total_samples_received = 0;
- double total_output_duration = 0.0;
- uint64_t concealed_samples = 0;
- uint64_t silent_concealed_samples = 0;
- uint64_t concealment_events = 0;
- double jitter_buffer_delay_seconds = 0.0;
- uint64_t jitter_buffer_emitted_count = 0;
- double jitter_buffer_target_delay_seconds = 0.0;
- uint64_t inserted_samples_for_deceleration = 0;
- uint64_t removed_samples_for_acceleration = 0;
-
- float expand_rate = 0.0f;
- float speech_expand_rate = 0.0f;
- float secondary_decoded_rate = 0.0f;
- float secondary_discarded_rate = 0.0f;
- float accelerate_rate = 0.0f;
- float preemptive_expand_rate = 0.0f;
- uint64_t delayed_packet_outage_samples = 0;
- int32_t decoding_calls_to_silence_generator = 0;
- int32_t decoding_calls_to_neteq = 0;
- int32_t decoding_normal = 0;
-
- int32_t decoding_plc = 0;
- int32_t decoding_codec_plc = 0;
- int32_t decoding_cng = 0;
- int32_t decoding_plc_cng = 0;
- int32_t decoding_muted_output = 0;
- int64_t capture_start_ntp_time_ms = 0;
-
-
-
- absl::optional<int64_t> last_packet_received_timestamp_ms;
- uint64_t jitter_buffer_flushes = 0;
- double relative_packet_arrival_delay_seconds = 0.0;
- int32_t interruption_count = 0;
- int32_t total_interruption_duration_ms = 0;
-
- absl::optional<int64_t> estimated_playout_ntp_timestamp_ms;
- };
- struct Config {
- Config();
- ~Config();
- std::string ToString() const;
-
- struct Rtp {
- Rtp();
- ~Rtp();
- std::string ToString() const;
-
- uint32_t remote_ssrc = 0;
-
- uint32_t local_ssrc = 0;
-
-
-
-
- bool transport_cc = false;
-
- NackConfig nack;
-
- std::vector<RtpExtension> extensions;
- } rtp;
- Transport* rtcp_send_transport = nullptr;
-
- size_t jitter_buffer_max_packets = 200;
- bool jitter_buffer_fast_accelerate = false;
- int jitter_buffer_min_delay_ms = 0;
- bool jitter_buffer_enable_rtx_handling = false;
-
-
-
- std::string sync_group;
-
- std::map<int, SdpAudioFormat> decoder_map;
- rtc::scoped_refptr<AudioDecoderFactory> decoder_factory;
- absl::optional<AudioCodecPairId> codec_pair_id;
-
- webrtc::CryptoOptions crypto_options;
-
-
-
- rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor;
-
-
- rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer;
- };
-
- virtual void Reconfigure(const Config& config) = 0;
-
-
- virtual void Start() = 0;
-
-
- virtual void Stop() = 0;
- virtual Stats GetStats() const = 0;
-
-
-
-
-
-
-
- virtual void SetSink(AudioSinkInterface* sink) = 0;
-
-
- virtual void SetGain(float gain) = 0;
-
-
-
-
- virtual bool SetBaseMinimumPlayoutDelayMs(int delay_ms) = 0;
-
- virtual int GetBaseMinimumPlayoutDelayMs() const = 0;
- virtual std::vector<RtpSource> GetSources() const = 0;
- protected:
- virtual ~AudioReceiveStream() {}
- };
- }
- #endif
|