2015-10-16 14:35:07 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef AUDIO_AUDIO_SEND_STREAM_H_
|
|
|
|
|
#define AUDIO_AUDIO_SEND_STREAM_H_
|
2015-10-16 14:35:07 -07:00
|
|
|
|
2016-02-23 10:46:32 -08:00
|
|
|
#include <memory>
|
2017-03-23 11:04:48 -07:00
|
|
|
#include <vector>
|
2016-02-23 10:46:32 -08:00
|
|
|
|
2018-11-19 10:27:07 +01:00
|
|
|
#include "audio/channel_send.h"
|
2018-01-17 11:18:31 +01:00
|
|
|
#include "audio/transport_feedback_packet_loss_tracker.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/audio_send_stream.h"
|
|
|
|
|
#include "call/audio_state.h"
|
|
|
|
|
#include "call/bitrate_allocator.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/constructor_magic.h"
|
2019-01-23 12:37:49 +01:00
|
|
|
#include "rtc_base/experiments/audio_allocation_settings.h"
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
#include "rtc_base/race_checker.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/thread_checker.h"
|
2015-10-16 14:35:07 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2016-09-21 06:51:47 -07:00
|
|
|
class RtcEventLog;
|
2017-02-07 07:14:08 -08:00
|
|
|
class RtcpBandwidthObserver;
|
2016-11-30 07:51:13 -08:00
|
|
|
class RtcpRttStats;
|
2017-03-27 05:36:15 -07:00
|
|
|
class RtpTransportControllerSendInterface;
|
2015-11-16 07:34:50 -08:00
|
|
|
|
2015-11-25 08:16:52 -08:00
|
|
|
namespace internal {
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
class AudioState;
|
|
|
|
|
|
2016-07-26 04:44:06 -07:00
|
|
|
class AudioSendStream final : public webrtc::AudioSendStream,
|
2017-03-23 11:04:48 -07:00
|
|
|
public webrtc::BitrateAllocatorObserver,
|
2019-02-04 15:16:06 -08:00
|
|
|
public webrtc::PacketFeedbackObserver,
|
|
|
|
|
public webrtc::OverheadObserver {
|
2015-10-16 14:35:07 -07:00
|
|
|
public:
|
2015-10-27 03:35:21 -07:00
|
|
|
AudioSendStream(const webrtc::AudioSendStream::Config& config,
|
2015-12-07 10:26:18 +01:00
|
|
|
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
|
2016-09-01 01:17:40 -07:00
|
|
|
rtc::TaskQueue* worker_queue,
|
2018-01-11 13:52:30 +01:00
|
|
|
ProcessThread* module_process_thread,
|
2018-10-26 12:57:07 +02:00
|
|
|
RtpTransportControllerSendInterface* rtp_transport,
|
2018-10-22 13:00:40 +02:00
|
|
|
BitrateAllocatorInterface* bitrate_allocator,
|
2016-11-30 07:51:13 -08:00
|
|
|
RtcEventLog* event_log,
|
2017-05-23 06:07:11 -07:00
|
|
|
RtcpRttStats* rtcp_rtt_stats,
|
2018-11-20 17:15:13 +01:00
|
|
|
const absl::optional<RtpState>& suspended_rtp_state);
|
2018-11-19 10:27:07 +01:00
|
|
|
// For unit tests, which need to supply a mock ChannelSend.
|
2018-01-11 13:52:30 +01:00
|
|
|
AudioSendStream(const webrtc::AudioSendStream::Config& config,
|
|
|
|
|
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
|
|
|
|
|
rtc::TaskQueue* worker_queue,
|
2018-10-26 12:57:07 +02:00
|
|
|
RtpTransportControllerSendInterface* rtp_transport,
|
2018-10-22 13:00:40 +02:00
|
|
|
BitrateAllocatorInterface* bitrate_allocator,
|
2018-01-11 13:52:30 +01:00
|
|
|
RtcEventLog* event_log,
|
|
|
|
|
RtcpRttStats* rtcp_rtt_stats,
|
2018-06-15 12:28:07 +02:00
|
|
|
const absl::optional<RtpState>& suspended_rtp_state,
|
2018-11-19 10:27:07 +01:00
|
|
|
std::unique_ptr<voe::ChannelSendInterface> channel_send);
|
2015-10-16 14:35:07 -07:00
|
|
|
~AudioSendStream() override;
|
|
|
|
|
|
2016-05-01 20:18:34 -07:00
|
|
|
// webrtc::AudioSendStream implementation.
|
2017-07-26 02:09:44 -07:00
|
|
|
const webrtc::AudioSendStream::Config& GetConfig() const override;
|
2017-04-27 02:08:52 -07:00
|
|
|
void Reconfigure(const webrtc::AudioSendStream::Config& config) override;
|
2015-10-16 14:35:07 -07:00
|
|
|
void Start() override;
|
|
|
|
|
void Stop() override;
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
void SendAudioData(std::unique_ptr<AudioFrame> audio_frame) override;
|
2016-11-17 05:25:37 -08:00
|
|
|
bool SendTelephoneEvent(int payload_type,
|
|
|
|
|
int payload_frequency,
|
|
|
|
|
int event,
|
2016-03-11 03:06:41 -08:00
|
|
|
int duration_ms) override;
|
2016-06-16 10:53:22 -07:00
|
|
|
void SetMuted(bool muted) override;
|
2015-10-16 14:35:07 -07:00
|
|
|
webrtc::AudioSendStream::Stats GetStats() const override;
|
2017-11-24 17:29:59 +01:00
|
|
|
webrtc::AudioSendStream::Stats GetStats(
|
|
|
|
|
bool has_remote_tracks) const override;
|
2015-10-16 14:35:07 -07:00
|
|
|
|
2016-05-01 20:18:34 -07:00
|
|
|
void SignalNetworkState(NetworkState state);
|
|
|
|
|
bool DeliverRtcp(const uint8_t* packet, size_t length);
|
2016-07-26 04:44:06 -07:00
|
|
|
|
|
|
|
|
// Implements BitrateAllocatorObserver.
|
2018-10-25 15:08:32 +02:00
|
|
|
uint32_t OnBitrateUpdated(BitrateAllocationUpdate update) override;
|
2016-07-26 04:44:06 -07:00
|
|
|
|
2017-03-23 11:04:48 -07:00
|
|
|
// From PacketFeedbackObserver.
|
|
|
|
|
void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override;
|
|
|
|
|
void OnPacketFeedbackVector(
|
|
|
|
|
const std::vector<PacketFeedback>& packet_feedback_vector) override;
|
|
|
|
|
|
2019-02-04 15:16:06 -08:00
|
|
|
void SetTransportOverhead(int transport_overhead_per_packet_bytes);
|
|
|
|
|
|
|
|
|
|
// OverheadObserver override reports audio packetization overhead from
|
|
|
|
|
// RTP/RTCP module or Media Transport.
|
|
|
|
|
void OnOverheadChanged(size_t overhead_bytes_per_packet_bytes) override;
|
2015-10-16 14:35:07 -07:00
|
|
|
|
2017-05-23 06:07:11 -07:00
|
|
|
RtpState GetRtpState() const;
|
2018-11-19 10:27:07 +01:00
|
|
|
const voe::ChannelSendInterface* GetChannel() const;
|
2017-05-23 06:07:11 -07:00
|
|
|
|
2019-02-04 15:16:06 -08:00
|
|
|
// Returns combined per-packet overhead.
|
|
|
|
|
size_t TestOnlyGetPerPacketOverheadBytes() const
|
|
|
|
|
RTC_LOCKS_EXCLUDED(overhead_per_packet_lock_);
|
|
|
|
|
|
2015-10-16 14:35:07 -07:00
|
|
|
private:
|
2017-07-19 00:39:19 -07:00
|
|
|
class TimedTransport;
|
|
|
|
|
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
internal::AudioState* audio_state();
|
|
|
|
|
const internal::AudioState* audio_state() const;
|
2015-11-16 07:34:50 -08:00
|
|
|
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
void StoreEncoderProperties(int sample_rate_hz, size_t num_channels);
|
|
|
|
|
|
2017-04-27 02:08:52 -07:00
|
|
|
// These are all static to make it less likely that (the old) config_ is
|
|
|
|
|
// accessed unintentionally.
|
|
|
|
|
static void ConfigureStream(AudioSendStream* stream,
|
|
|
|
|
const Config& new_config,
|
|
|
|
|
bool first_time);
|
|
|
|
|
static bool SetupSendCodec(AudioSendStream* stream, const Config& new_config);
|
|
|
|
|
static bool ReconfigureSendCodec(AudioSendStream* stream,
|
|
|
|
|
const Config& new_config);
|
|
|
|
|
static void ReconfigureANA(AudioSendStream* stream, const Config& new_config);
|
|
|
|
|
static void ReconfigureCNG(AudioSendStream* stream, const Config& new_config);
|
|
|
|
|
static void ReconfigureBitrateObserver(AudioSendStream* stream,
|
|
|
|
|
const Config& new_config);
|
|
|
|
|
|
2017-12-22 09:36:42 -08:00
|
|
|
void ConfigureBitrateObserver(int min_bitrate_bps,
|
|
|
|
|
int max_bitrate_bps,
|
2019-01-23 09:41:43 +01:00
|
|
|
double bitrate_priority);
|
2017-04-27 02:08:52 -07:00
|
|
|
void RemoveBitrateObserver();
|
2016-10-20 03:27:12 -07:00
|
|
|
|
2019-02-04 15:16:06 -08:00
|
|
|
// Sets per-packet overhead on encoded (for ANA) based on current known values
|
|
|
|
|
// of transport and packetization overheads.
|
|
|
|
|
void UpdateOverheadForEncoder()
|
|
|
|
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(overhead_per_packet_lock_);
|
|
|
|
|
|
|
|
|
|
// Returns combined per-packet overhead.
|
|
|
|
|
size_t GetPerPacketOverheadBytes() const
|
|
|
|
|
RTC_EXCLUSIVE_LOCKS_REQUIRED(overhead_per_packet_lock_);
|
|
|
|
|
|
2017-04-27 08:03:42 -07:00
|
|
|
void RegisterCngPayloadType(int payload_type, int clockrate_hz);
|
|
|
|
|
|
2017-03-23 11:04:48 -07:00
|
|
|
rtc::ThreadChecker worker_thread_checker_;
|
|
|
|
|
rtc::ThreadChecker pacer_thread_checker_;
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
rtc::RaceChecker audio_capture_race_checker_;
|
2016-09-01 01:17:40 -07:00
|
|
|
rtc::TaskQueue* worker_queue_;
|
2019-01-23 12:37:49 +01:00
|
|
|
const AudioAllocationSettings allocation_settings_;
|
2017-04-27 02:08:52 -07:00
|
|
|
webrtc::AudioSendStream::Config config_;
|
2015-11-06 15:34:49 -08:00
|
|
|
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
2018-11-19 10:27:07 +01:00
|
|
|
const std::unique_ptr<voe::ChannelSendInterface> channel_send_;
|
2017-04-27 02:08:52 -07:00
|
|
|
RtcEventLog* const event_log_;
|
2015-10-27 03:35:21 -07:00
|
|
|
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
int encoder_sample_rate_hz_ = 0;
|
|
|
|
|
size_t encoder_num_channels_ = 0;
|
|
|
|
|
bool sending_ = false;
|
|
|
|
|
|
2018-10-22 13:00:40 +02:00
|
|
|
BitrateAllocatorInterface* const bitrate_allocator_;
|
2018-10-26 12:57:07 +02:00
|
|
|
RtpTransportControllerSendInterface* const rtp_transport_;
|
2016-07-26 04:44:06 -07:00
|
|
|
|
2017-03-23 11:04:48 -07:00
|
|
|
rtc::CriticalSection packet_loss_tracker_cs_;
|
|
|
|
|
TransportFeedbackPacketLossTracker packet_loss_tracker_
|
2017-09-09 04:17:22 -07:00
|
|
|
RTC_GUARDED_BY(&packet_loss_tracker_cs_);
|
2017-03-23 11:04:48 -07:00
|
|
|
|
2017-05-23 06:07:11 -07:00
|
|
|
RtpRtcp* rtp_rtcp_module_;
|
2018-06-15 12:28:07 +02:00
|
|
|
absl::optional<RtpState> const suspended_rtp_state_;
|
2017-05-23 06:07:11 -07:00
|
|
|
|
2017-12-07 20:54:55 +01:00
|
|
|
// RFC 5285: Each distinct extension MUST have a unique ID. The value 0 is
|
|
|
|
|
// reserved for padding and MUST NOT be used as a local identifier.
|
|
|
|
|
// So it should be safe to use 0 here to indicate "not configured".
|
|
|
|
|
struct ExtensionIds {
|
|
|
|
|
int audio_level = 0;
|
|
|
|
|
int transport_sequence_number = 0;
|
2018-03-26 10:24:32 -07:00
|
|
|
int mid = 0;
|
2018-12-21 09:23:38 -08:00
|
|
|
int rid = 0;
|
|
|
|
|
int repaired_rid = 0;
|
2017-12-07 20:54:55 +01:00
|
|
|
};
|
|
|
|
|
static ExtensionIds FindExtensionIds(
|
|
|
|
|
const std::vector<RtpExtension>& extensions);
|
2019-01-23 12:37:49 +01:00
|
|
|
static int TransportSeqNumId(const Config& config);
|
2017-12-07 20:54:55 +01:00
|
|
|
|
2019-02-04 15:16:06 -08:00
|
|
|
rtc::CriticalSection overhead_per_packet_lock_;
|
|
|
|
|
|
|
|
|
|
// Current transport overhead (ICE, TURN, etc.)
|
|
|
|
|
size_t transport_overhead_per_packet_bytes_
|
|
|
|
|
RTC_GUARDED_BY(overhead_per_packet_lock_) = 0;
|
|
|
|
|
|
|
|
|
|
// Current audio packetization overhead (RTP or Media Transport).
|
|
|
|
|
size_t audio_overhead_per_packet_bytes_
|
|
|
|
|
RTC_GUARDED_BY(overhead_per_packet_lock_) = 0;
|
|
|
|
|
|
2015-10-27 03:35:21 -07:00
|
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream);
|
2015-10-16 14:35:07 -07:00
|
|
|
};
|
|
|
|
|
} // namespace internal
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // AUDIO_AUDIO_SEND_STREAM_H_
|