Delete media transport integration.
MediaTransport is deprecated and the code is unused.
No-Try: True
Bug: webrtc:9719
Change-Id: I5b864c1e74bf04df16c15f51b8fac3d407331dcd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160620
Commit-Queue: Bjorn Mellem <mellem@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29923}
diff --git a/audio/BUILD.gn b/audio/BUILD.gn
index e64b76f..a6d7ed4 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -53,7 +53,6 @@
"../api/neteq:neteq_api",
"../api/rtc_event_log",
"../api/task_queue",
- "../api/transport/media:media_transport_interface",
"../api/transport/rtp:rtp_source",
"../call:bitrate_allocator",
"../call:call_interfaces",
@@ -121,13 +120,11 @@
"mock_voe_channel_proxy.h",
"remix_resample_unittest.cc",
"test/audio_stats_test.cc",
- "test/media_transport_test.cc",
]
deps = [
":audio",
":audio_end_to_end_test",
"../api:libjingle_peerconnection_api",
- "../api:loopback_media_transport",
"../api:mock_audio_mixer",
"../api:mock_frame_decryptor",
"../api:mock_frame_encryptor",
@@ -137,7 +134,6 @@
"../api/audio_codecs/opus:audio_encoder_opus",
"../api/rtc_event_log",
"../api/task_queue:default_task_queue_factory",
- "../api/transport/media:media_transport_interface",
"../api/units:time_delta",
"../call:mock_bitrate_allocator",
"../call:mock_call_interfaces",
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index e1041be..2e02388 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -56,7 +56,6 @@
ss << "{rtp: " << rtp.ToString();
ss << ", rtcp_send_transport: "
<< (rtcp_send_transport ? "(Transport)" : "null");
- ss << ", media_transport_config: " << media_transport_config.DebugString();
if (!sync_group.empty()) {
ss << ", sync_group: " << sync_group;
}
@@ -78,9 +77,8 @@
static_cast<internal::AudioState*>(audio_state);
return voe::CreateChannelReceive(
clock, module_process_thread, neteq_factory,
- internal_audio_state->audio_device_module(),
- config.media_transport_config, config.rtcp_send_transport, event_log,
- config.rtp.local_ssrc, config.rtp.remote_ssrc,
+ internal_audio_state->audio_device_module(), config.rtcp_send_transport,
+ event_log, config.rtp.local_ssrc, config.rtp.remote_ssrc,
config.jitter_buffer_max_packets, config.jitter_buffer_fast_accelerate,
config.jitter_buffer_min_delay_ms,
config.jitter_buffer_enable_rtx_handling, config.decoder_factory,
@@ -129,16 +127,14 @@
module_process_thread_checker_.Detach();
- if (!config.media_transport_config.media_transport) {
- RTC_DCHECK(receiver_controller);
- RTC_DCHECK(packet_router);
- // Configure bandwidth estimation.
- channel_receive_->RegisterReceiverCongestionControlObjects(packet_router);
+ RTC_DCHECK(receiver_controller);
+ RTC_DCHECK(packet_router);
+ // Configure bandwidth estimation.
+ channel_receive_->RegisterReceiverCongestionControlObjects(packet_router);
- // Register with transport.
- rtp_stream_receiver_ = receiver_controller->CreateReceiver(
- config.rtp.remote_ssrc, channel_receive_.get());
- }
+ // Register with transport.
+ rtp_stream_receiver_ = receiver_controller->CreateReceiver(
+ config.rtp.remote_ssrc, channel_receive_.get());
ConfigureStream(this, config, true);
}
@@ -147,9 +143,7 @@
RTC_LOG(LS_INFO) << "~AudioReceiveStream: " << config_.rtp.remote_ssrc;
Stop();
channel_receive_->SetAssociatedSendChannel(nullptr);
- if (!config_.media_transport_config.media_transport) {
- channel_receive_->ResetReceiverCongestionControlObjects();
- }
+ channel_receive_->ResetReceiverCongestionControlObjects();
}
void AudioReceiveStream::Reconfigure(
diff --git a/audio/audio_receive_stream_unittest.cc b/audio/audio_receive_stream_unittest.cc
index 473b387..b8eff0a 100644
--- a/audio/audio_receive_stream_unittest.cc
+++ b/audio/audio_receive_stream_unittest.cc
@@ -223,8 +223,7 @@
"{rtp: {remote_ssrc: 1234, local_ssrc: 5678, transport_cc: off, nack: "
"{rtp_history_ms: 0}, extensions: [{uri: "
"urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 3}]}, "
- "rtcp_send_transport: null, media_transport_config: {media_transport: "
- "null}}",
+ "rtcp_send_transport: null}",
config.ToString());
}
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index 323b7a9..90d72c4 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -22,7 +22,6 @@
#include "api/crypto/frame_encryptor_interface.h"
#include "api/function_view.h"
#include "api/rtc_event_log/rtc_event_log.h"
-#include "api/transport/media/media_transport_config.h"
#include "audio/audio_state.h"
#include "audio/channel_send.h"
#include "audio/conversion.h"
@@ -119,7 +118,6 @@
voe::CreateChannelSend(clock,
task_queue_factory,
module_process_thread,
- config.media_transport_config,
/*overhead_observer=*/this,
config.send_transport,
rtcp_rtt_stats,
@@ -150,7 +148,7 @@
!field_trial::IsDisabled("WebRTC-Audio-AlrProbing")),
send_side_bwe_with_overhead_(
field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")),
- config_(Config(/*send_transport=*/nullptr, MediaTransportConfig())),
+ config_(Config(/*send_transport=*/nullptr)),
audio_state_(audio_state),
channel_send_(std::move(channel_send)),
event_log_(event_log),
@@ -165,23 +163,8 @@
RTC_DCHECK(audio_state_);
RTC_DCHECK(channel_send_);
RTC_DCHECK(bitrate_allocator_);
- // Currently we require the rtp transport even when media transport is used.
RTC_DCHECK(rtp_transport);
- // TODO(nisse): Eventually, we should have only media_transport. But for the
- // time being, we can have either. When media transport is injected, there
- // should be no rtp_transport, and below check should be strengthened to XOR
- // (either rtp_transport or media_transport but not both).
- RTC_DCHECK(rtp_transport || config.media_transport_config.media_transport);
- if (config.media_transport_config.media_transport) {
- // TODO(sukhanov): Currently media transport audio overhead is considered
- // constant, we will not get overhead_observer calls when using
- // media_transport. In the future when we introduce RTP media transport we
- // should make audio overhead interface consistent and work for both RTP and
- // non-RTP implementations.
- audio_overhead_per_packet_bytes_ =
- config.media_transport_config.media_transport->GetAudioPacketOverhead();
- }
rtp_rtcp_module_ = channel_send_->GetRtpRtcp();
RTC_DCHECK(rtp_rtcp_module_);
diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc
index 6d6ec6a..95d7f73 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -144,7 +144,7 @@
ConfigHelper(bool audio_bwe_enabled, bool expect_set_encoder_call)
: clock_(1000000),
task_queue_factory_(CreateDefaultTaskQueueFactory()),
- stream_config_(/*send_transport=*/nullptr, MediaTransportConfig()),
+ stream_config_(/*send_transport=*/nullptr),
audio_processing_(new rtc::RefCountedObject<MockAudioProcessing>()),
bitrate_allocator_(&limit_observer_),
worker_queue_(task_queue_factory_->CreateTaskQueue(
@@ -347,8 +347,7 @@
} // namespace
TEST(AudioSendStreamTest, ConfigToString) {
- AudioSendStream::Config config(/*send_transport=*/nullptr,
- MediaTransportConfig());
+ AudioSendStream::Config config(/*send_transport=*/nullptr);
config.rtp.ssrc = kSsrc;
config.rtp.c_name = kCName;
config.min_bitrate_bps = 12000;
@@ -367,7 +366,7 @@
"{rtp: {ssrc: 1234, extmap-allow-mixed: true, extensions: [{uri: "
"urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 2}], "
"c_name: foo_name}, rtcp_report_interval_ms: 2500, "
- "send_transport: null, media_transport_config: {media_transport: null}, "
+ "send_transport: null, "
"min_bitrate_bps: 12000, max_bitrate_bps: 34000, "
"send_codec_spec: {nack_enabled: true, transport_cc_enabled: false, "
"cng_payload_type: 42, payload_type: 103, "
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index 502818f..2ecc3cf 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -58,21 +58,6 @@
constexpr int kVoiceEngineMinMinPlayoutDelayMs = 0;
constexpr int kVoiceEngineMaxMinPlayoutDelayMs = 10000;
-RTPHeader CreateRTPHeaderForMediaTransportFrame(
- const MediaTransportEncodedAudioFrame& frame,
- uint64_t channel_id) {
- webrtc::RTPHeader rtp_header;
- rtp_header.payloadType = frame.payload_type();
- rtp_header.payload_type_frequency = frame.sampling_rate_hz();
- rtp_header.timestamp = frame.starting_sample_index();
- rtp_header.sequenceNumber = frame.sequence_number();
-
- rtp_header.ssrc = static_cast<uint32_t>(channel_id);
-
- // The rest are initialized by the RTPHeader constructor.
- return rtp_header;
-}
-
AudioCodingModule::Config AcmConfig(
NetEqFactory* neteq_factory,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
@@ -90,15 +75,13 @@
return acm_config;
}
-class ChannelReceive : public ChannelReceiveInterface,
- public MediaTransportAudioSinkInterface {
+class ChannelReceive : public ChannelReceiveInterface {
public:
// Used for receive streams.
ChannelReceive(Clock* clock,
ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
AudioDeviceModule* audio_device_module,
- const MediaTransportConfig& media_transport_config,
Transport* rtcp_send_transport,
RtcEventLog* rtc_event_log,
uint32_t local_ssrc,
@@ -177,12 +160,6 @@
// Used for obtaining RTT for a receive-only channel.
void SetAssociatedSendChannel(const ChannelSendInterface* channel) override;
- // TODO(sukhanov): Return const pointer. It requires making media transport
- // getters like GetLatestTargetTransferRate to be also const.
- MediaTransportInterface* media_transport() const {
- return media_transport_config_.media_transport;
- }
-
private:
void ReceivePacket(const uint8_t* packet,
size_t packet_length,
@@ -193,10 +170,6 @@
int GetRtpTimestampRateHz() const;
int64_t GetRTT() const;
- // MediaTransportAudioSinkInterface override;
- void OnData(uint64_t channel_id,
- MediaTransportEncodedAudioFrame frame) override;
-
void OnReceivedPayloadData(rtc::ArrayView<const uint8_t> payload,
const RTPHeader& rtpHeader);
@@ -283,8 +256,6 @@
rtc::ThreadChecker construction_thread_;
- MediaTransportConfig media_transport_config_;
-
// E2EE Audio Frame Decryption
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor_;
webrtc::CryptoOptions crypto_options_;
@@ -293,9 +264,6 @@
void ChannelReceive::OnReceivedPayloadData(
rtc::ArrayView<const uint8_t> payload,
const RTPHeader& rtpHeader) {
- // We should not be receiving any RTP packets if media_transport is set.
- RTC_CHECK(!media_transport());
-
if (!Playing()) {
// Avoid inserting into NetEQ when we are not playing. Count the
// packet as discarded.
@@ -320,26 +288,6 @@
}
}
-// MediaTransportAudioSinkInterface override.
-void ChannelReceive::OnData(uint64_t channel_id,
- MediaTransportEncodedAudioFrame frame) {
- RTC_CHECK(media_transport());
-
- if (!Playing()) {
- // Avoid inserting into NetEQ when we are not playing. Count the
- // packet as discarded.
- return;
- }
-
- // Send encoded audio frame to Decoder / NetEq.
- if (acm_receiver_.InsertPacket(
- CreateRTPHeaderForMediaTransportFrame(frame, channel_id),
- frame.encoded_data()) != 0) {
- RTC_DLOG(LS_ERROR) << "ChannelReceive::OnData: unable to "
- "push data to the ACM";
- }
-}
-
AudioMixer::Source::AudioFrameInfo ChannelReceive::GetAudioFrameWithInfo(
int sample_rate_hz,
AudioFrame* audio_frame) {
@@ -460,7 +408,6 @@
ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
AudioDeviceModule* audio_device_module,
- const MediaTransportConfig& media_transport_config,
Transport* rtcp_send_transport,
RtcEventLog* rtc_event_log,
uint32_t local_ssrc,
@@ -492,7 +439,6 @@
_audioDeviceModulePtr(audio_device_module),
_outputGain(1.0f),
associated_send_channel_(nullptr),
- media_transport_config_(media_transport_config),
frame_decryptor_(frame_decryptor),
crypto_options_(crypto_options) {
// TODO(nisse): Use _moduleProcessThreadPtr instead?
@@ -526,19 +472,11 @@
// Ensure that RTCP is enabled for the created channel.
_rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound);
-
- if (media_transport()) {
- media_transport()->SetReceiveAudioSink(this);
- }
}
ChannelReceive::~ChannelReceive() {
RTC_DCHECK(construction_thread_.IsCurrent());
- if (media_transport()) {
- media_transport()->SetReceiveAudioSink(nullptr);
- }
-
StopPlayout();
if (_moduleProcessThreadPtr)
@@ -931,14 +869,6 @@
}
int64_t ChannelReceive::GetRTT() const {
- if (media_transport()) {
- auto target_rate = media_transport()->GetLatestTargetTransferRate();
- if (target_rate.has_value()) {
- return target_rate->network_estimate.round_trip_time.ms();
- }
-
- return 0;
- }
std::vector<RTCPReportBlock> report_blocks;
_rtpRtcpModule->RemoteRTCPStat(&report_blocks);
@@ -973,7 +903,6 @@
ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
AudioDeviceModule* audio_device_module,
- const MediaTransportConfig& media_transport_config,
Transport* rtcp_send_transport,
RtcEventLog* rtc_event_log,
uint32_t local_ssrc,
@@ -988,8 +917,8 @@
const webrtc::CryptoOptions& crypto_options) {
return std::make_unique<ChannelReceive>(
clock, module_process_thread, neteq_factory, audio_device_module,
- media_transport_config, rtcp_send_transport, rtc_event_log, local_ssrc,
- remote_ssrc, jitter_buffer_max_packets, jitter_buffer_fast_playout,
+ rtcp_send_transport, rtc_event_log, local_ssrc, remote_ssrc,
+ jitter_buffer_max_packets, jitter_buffer_fast_playout,
jitter_buffer_min_delay_ms, jitter_buffer_enable_rtx_handling,
decoder_factory, codec_pair_id, frame_decryptor, crypto_options);
}
diff --git a/audio/channel_receive.h b/audio/channel_receive.h
index 3cab489..034ac7b 100644
--- a/audio/channel_receive.h
+++ b/audio/channel_receive.h
@@ -23,8 +23,6 @@
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
#include "api/neteq/neteq_factory.h"
-#include "api/transport/media/media_transport_config.h"
-#include "api/transport/media/media_transport_interface.h"
#include "api/transport/rtp/rtp_source.h"
#include "call/rtp_packet_sink_interface.h"
#include "call/syncable.h"
@@ -146,7 +144,6 @@
ProcessThread* module_process_thread,
NetEqFactory* neteq_factory,
AudioDeviceModule* audio_device_module,
- const MediaTransportConfig& media_transport_config,
Transport* rtcp_send_transport,
RtcEventLog* rtc_event_log,
uint32_t local_ssrc,
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index 184ea41..5bb2cbe 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -52,34 +52,14 @@
constexpr int64_t kMaxRetransmissionWindowMs = 1000;
constexpr int64_t kMinRetransmissionWindowMs = 30;
-MediaTransportEncodedAudioFrame::FrameType
-MediaTransportFrameTypeForWebrtcFrameType(webrtc::AudioFrameType frame_type) {
- switch (frame_type) {
- case AudioFrameType::kAudioFrameSpeech:
- return MediaTransportEncodedAudioFrame::FrameType::kSpeech;
- break;
-
- case AudioFrameType::kAudioFrameCN:
- return MediaTransportEncodedAudioFrame::FrameType::
- kDiscontinuousTransmission;
- break;
-
- default:
- RTC_CHECK(false) << "Unexpected frame type="
- << static_cast<int>(frame_type);
- break;
- }
-}
-
class RtpPacketSenderProxy;
class TransportFeedbackProxy;
class TransportSequenceNumberProxy;
class VoERtcpObserver;
class ChannelSend : public ChannelSendInterface,
- public AudioPacketizationCallback, // receive encoded
- // packets from the ACM
- public TargetTransferRateObserver {
+ public AudioPacketizationCallback { // receive encoded
+ // packets from the ACM
public:
// TODO(nisse): Make OnUplinkPacketLossRate public, and delete friend
// declaration.
@@ -88,7 +68,6 @@
ChannelSend(Clock* clock,
TaskQueueFactory* task_queue_factory,
ProcessThread* module_process_thread,
- const MediaTransportConfig& media_transport_config,
OverheadObserver* overhead_observer,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
@@ -188,21 +167,8 @@
rtc::ArrayView<const uint8_t> payload)
RTC_RUN_ON(encoder_queue_);
- int32_t SendMediaTransportAudio(AudioFrameType frameType,
- uint8_t payloadType,
- uint32_t timeStamp,
- rtc::ArrayView<const uint8_t> payload)
- RTC_RUN_ON(encoder_queue_);
-
- // Return media transport or nullptr if using RTP.
- MediaTransportInterface* media_transport() {
- return media_transport_config_.media_transport;
- }
-
void OnReceivedRtt(int64_t rtt_ms);
- void OnTargetTransferRate(TargetTransferRate) override;
-
// Thread checkers document and lock usage of some methods on voe::Channel to
// specific threads we know about. The goal is to eventually split up
// voe::Channel into parts with single-threaded semantics, and thereby reduce
@@ -251,20 +217,6 @@
bool encoder_queue_is_active_ RTC_GUARDED_BY(encoder_queue_) = false;
- MediaTransportConfig media_transport_config_;
- int media_transport_sequence_number_ RTC_GUARDED_BY(encoder_queue_) = 0;
-
- rtc::CriticalSection media_transport_lock_;
- // Currently set to local SSRC at construction.
- uint64_t media_transport_channel_id_ RTC_GUARDED_BY(&media_transport_lock_) =
- 0;
- // Cache payload type and sampling frequency from most recent call to
- // SetEncoder. Needed to set MediaTransportEncodedAudioFrame metadata, and
- // invalidate on encoder change.
- int media_transport_payload_type_ RTC_GUARDED_BY(&media_transport_lock_);
- int media_transport_sampling_frequency_
- RTC_GUARDED_BY(&media_transport_lock_);
-
// E2EE Audio Frame Encryption
rtc::scoped_refptr<FrameEncryptorInterface> frame_encryptor_
RTC_GUARDED_BY(encoder_queue_);
@@ -421,18 +373,7 @@
size_t payloadSize) {
RTC_DCHECK_RUN_ON(&encoder_queue_);
rtc::ArrayView<const uint8_t> payload(payloadData, payloadSize);
-
- if (media_transport() != nullptr) {
- if (frameType == AudioFrameType::kEmptyFrame) {
- // TODO(bugs.webrtc.org/9719): Media transport Send doesn't support
- // sending empty frames.
- return 0;
- }
-
- return SendMediaTransportAudio(frameType, payloadType, timeStamp, payload);
- } else {
- return SendRtpAudio(frameType, payloadType, timeStamp, payload);
- }
+ return SendRtpAudio(frameType, payloadType, timeStamp, payload);
}
int32_t ChannelSend::SendRtpAudio(AudioFrameType frameType,
@@ -512,64 +453,9 @@
return 0;
}
-int32_t ChannelSend::SendMediaTransportAudio(
- AudioFrameType frameType,
- uint8_t payloadType,
- uint32_t timeStamp,
- rtc::ArrayView<const uint8_t> payload) {
- // TODO(nisse): Use null _transportPtr for MediaTransport.
- // RTC_DCHECK(_transportPtr == nullptr);
- uint64_t channel_id;
- int sampling_rate_hz;
- {
- rtc::CritScope cs(&media_transport_lock_);
- if (media_transport_payload_type_ != payloadType) {
- // Payload type is being changed, media_transport_sampling_frequency_,
- // no longer current.
- return -1;
- }
- sampling_rate_hz = media_transport_sampling_frequency_;
- channel_id = media_transport_channel_id_;
- }
- MediaTransportEncodedAudioFrame frame(
- /*sampling_rate_hz=*/sampling_rate_hz,
-
- // TODO(nisse): Timestamp and sample index are the same for all supported
- // audio codecs except G722. Refactor audio coding module to only use
- // sample index, and leave translation to RTP time, when needed, for
- // RTP-specific code.
- /*starting_sample_index=*/timeStamp,
-
- // Sample count isn't conveniently available from the AudioCodingModule,
- // and needs some refactoring to wire up in a good way. For now, left as
- // zero.
- /*samples_per_channel=*/0,
-
- /*sequence_number=*/media_transport_sequence_number_,
- MediaTransportFrameTypeForWebrtcFrameType(frameType), payloadType,
- std::vector<uint8_t>(payload.begin(), payload.end()));
-
- // TODO(nisse): Introduce a MediaTransportSender object bound to a specific
- // channel id.
- RTCError rtc_error =
- media_transport()->SendAudioFrame(channel_id, std::move(frame));
-
- if (!rtc_error.ok()) {
- RTC_LOG(LS_ERROR) << "Failed to send frame, rtc_error="
- << ToString(rtc_error.type()) << ", "
- << rtc_error.message();
- return -1;
- }
-
- ++media_transport_sequence_number_;
-
- return 0;
-}
-
ChannelSend::ChannelSend(Clock* clock,
TaskQueueFactory* task_queue_factory,
ProcessThread* module_process_thread,
- const MediaTransportConfig& media_transport_config,
OverheadObserver* overhead_observer,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
@@ -591,7 +477,6 @@
rtp_packet_pacer_proxy_(new RtpPacketSenderProxy()),
retransmission_rate_limiter_(
new RateLimiter(clock, kMaxRetransmissionWindowMs)),
- media_transport_config_(media_transport_config),
frame_encryptor_(frame_encryptor),
crypto_options_(crypto_options),
encoder_queue_(task_queue_factory->CreateTaskQueue(
@@ -603,17 +488,9 @@
audio_coding_.reset(AudioCodingModule::Create(AudioCodingModule::Config()));
RtpRtcp::Configuration configuration;
-
- // We gradually remove codepaths that depend on RTP when using media
- // transport. All of this logic should be moved to the future
- // RTPMediaTransport. In this case it means that overhead and bandwidth
- // observers should not be called when using media transport.
- if (!media_transport_config.media_transport) {
- configuration.overhead_observer = overhead_observer;
- configuration.bandwidth_callback = rtcp_observer_.get();
- configuration.transport_feedback_callback = feedback_observer_proxy_.get();
- }
-
+ configuration.overhead_observer = overhead_observer;
+ configuration.bandwidth_callback = rtcp_observer_.get();
+ configuration.transport_feedback_callback = feedback_observer_proxy_.get();
configuration.clock = clock;
configuration.audio = true;
configuration.clock = Clock::GetRealTimeClock();
@@ -629,10 +506,6 @@
configuration.rtcp_report_interval_ms = rtcp_report_interval_ms;
configuration.local_media_ssrc = ssrc;
- if (media_transport_config_.media_transport) {
- rtc::CritScope cs(&media_transport_lock_);
- media_transport_channel_id_ = ssrc;
- }
_rtpRtcpModule = RtpRtcp::Create(configuration);
_rtpRtcpModule->SetSendingMediaStatus(false);
@@ -640,17 +513,6 @@
rtp_sender_audio_ = std::make_unique<RTPSenderAudio>(
configuration.clock, _rtpRtcpModule->RtpSender());
- // We want to invoke the 'TargetRateObserver' and |OnOverheadChanged|
- // callbacks after the audio_coding_ is fully initialized.
- if (media_transport_config.media_transport) {
- RTC_DLOG(LS_INFO) << "Setting media_transport_ rate observers.";
- media_transport_config.media_transport->AddTargetTransferRateObserver(this);
- media_transport_config.media_transport->SetAudioOverheadObserver(
- overhead_observer);
- } else {
- RTC_DLOG(LS_INFO) << "Not setting media_transport_ rate observers.";
- }
-
_moduleProcessThreadPtr->RegisterModule(_rtpRtcpModule.get(), RTC_FROM_HERE);
// Ensure that RTCP is enabled by default for the created channel.
@@ -663,12 +525,6 @@
ChannelSend::~ChannelSend() {
RTC_DCHECK(construction_thread_.IsCurrent());
- if (media_transport_config_.media_transport) {
- media_transport_config_.media_transport->RemoveTargetTransferRateObserver(
- this);
- media_transport_config_.media_transport->SetAudioOverheadObserver(nullptr);
- }
-
StopSend();
int error = audio_coding_->RegisterTransportCallback(NULL);
RTC_DCHECK_EQ(0, error);
@@ -729,13 +585,6 @@
encoder->RtpTimestampRateHz(),
encoder->NumChannels(), 0);
- if (media_transport_config_.media_transport) {
- rtc::CritScope cs(&media_transport_lock_);
- media_transport_payload_type_ = payload_type;
- // TODO(nisse): Currently broken for G722, since timestamps passed through
- // encoder use RTP clock rather than sample count, and they differ for G722.
- media_transport_sampling_frequency_ = encoder->RtpTimestampRateHz();
- }
audio_coding_->SetEncoder(std::move(encoder));
}
@@ -785,13 +634,6 @@
}
void ChannelSend::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
- // May be called on either worker thread or network thread.
- if (media_transport_config_.media_transport) {
- // Ignore RTCP packets while media transport is used.
- // Those packets should not arrive, but we are seeing occasional packets.
- return;
- }
-
// Deliver RTCP packet to RTP/RTCP module for parsing
_rtpRtcpModule->IncomingRtcpPacket(data, length);
@@ -1064,19 +906,6 @@
}
int64_t ChannelSend::GetRTT() const {
- if (media_transport_config_.media_transport) {
- // GetRTT is generally used in the RTCP codepath, where media transport is
- // not present and so it shouldn't be needed. But it's also invoked in
- // 'GetStats' method, and for now returning media transport RTT here gives
- // us "free" rtt stats for media transport.
- auto target_rate =
- media_transport_config_.media_transport->GetLatestTargetTransferRate();
- if (target_rate.has_value()) {
- return target_rate.value().network_estimate.round_trip_time.ms();
- }
-
- return 0;
- }
std::vector<RTCPReportBlock> report_blocks;
_rtpRtcpModule->RemoteRTCPStat(&report_blocks);
@@ -1106,14 +935,6 @@
});
}
-// TODO(sukhanov): Consider moving TargetTransferRate observer to
-// AudioSendStream. Since AudioSendStream owns encoder and configures ANA, it
-// makes sense to consolidate all rate (and overhead) calculation there.
-void ChannelSend::OnTargetTransferRate(TargetTransferRate rate) {
- RTC_DCHECK(media_transport_config_.media_transport);
- OnReceivedRtt(rate.network_estimate.round_trip_time.ms());
-}
-
void ChannelSend::OnReceivedRtt(int64_t rtt_ms) {
// Invoke audio encoders OnReceivedRtt().
CallEncoder(
@@ -1126,7 +947,6 @@
Clock* clock,
TaskQueueFactory* task_queue_factory,
ProcessThread* module_process_thread,
- const MediaTransportConfig& media_transport_config,
OverheadObserver* overhead_observer,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
@@ -1137,10 +957,9 @@
int rtcp_report_interval_ms,
uint32_t ssrc) {
return std::make_unique<ChannelSend>(
- clock, task_queue_factory, module_process_thread, media_transport_config,
- overhead_observer, rtp_transport, rtcp_rtt_stats, rtc_event_log,
- frame_encryptor, crypto_options, extmap_allow_mixed,
- rtcp_report_interval_ms, ssrc);
+ clock, task_queue_factory, module_process_thread, overhead_observer,
+ rtp_transport, rtcp_rtt_stats, rtc_event_log, frame_encryptor,
+ crypto_options, extmap_allow_mixed, rtcp_report_interval_ms, ssrc);
}
} // namespace voe
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 053b69a..6f73c2b 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -20,8 +20,6 @@
#include "api/crypto/crypto_options.h"
#include "api/function_view.h"
#include "api/task_queue/task_queue_factory.h"
-#include "api/transport/media/media_transport_config.h"
-#include "api/transport/media/media_transport_interface.h"
#include "modules/rtp_rtcp/include/report_block_data.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
#include "modules/rtp_rtcp/source/rtp_sender_audio.h"
@@ -129,7 +127,6 @@
Clock* clock,
TaskQueueFactory* task_queue_factory,
ProcessThread* module_process_thread,
- const MediaTransportConfig& media_transport_config,
OverheadObserver* overhead_observer,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
diff --git a/audio/test/media_transport_test.cc b/audio/test/media_transport_test.cc
deleted file mode 100644
index bee0539..0000000
--- a/audio/test/media_transport_test.cc
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2018 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.
- */
-
-#include <memory>
-
-#include "api/audio_codecs/audio_decoder_factory_template.h"
-#include "api/audio_codecs/audio_encoder_factory_template.h"
-#include "api/audio_codecs/opus/audio_decoder_opus.h"
-#include "api/audio_codecs/opus/audio_encoder_opus.h"
-#include "api/rtc_event_log/rtc_event_log.h"
-#include "api/task_queue/default_task_queue_factory.h"
-#include "api/test/loopback_media_transport.h"
-#include "api/test/mock_audio_mixer.h"
-#include "api/transport/media/media_transport_config.h"
-#include "audio/audio_receive_stream.h"
-#include "audio/audio_send_stream.h"
-#include "call/rtp_transport_controller_send.h"
-#include "call/test/mock_bitrate_allocator.h"
-#include "modules/audio_device/include/test_audio_device.h"
-#include "modules/audio_mixer/audio_mixer_impl.h"
-#include "modules/audio_processing/include/mock_audio_processing.h"
-#include "modules/utility/include/process_thread.h"
-#include "rtc_base/time_utils.h"
-#include "test/gtest.h"
-#include "test/mock_transport.h"
-
-namespace webrtc {
-namespace test {
-
-namespace {
-using ::testing::NiceMock;
-
-constexpr int kPayloadTypeOpus = 17;
-constexpr int kSamplingFrequency = 48000;
-constexpr int kNumChannels = 2;
-constexpr int kWantedSamples = 3000;
-constexpr int kTestTimeoutMs = 2 * rtc::kNumMillisecsPerSec;
-
-class TestRenderer : public TestAudioDeviceModule::Renderer {
- public:
- TestRenderer(int sampling_frequency, int num_channels, size_t wanted_samples)
- : sampling_frequency_(sampling_frequency),
- num_channels_(num_channels),
- wanted_samples_(wanted_samples) {}
- ~TestRenderer() override = default;
-
- int SamplingFrequency() const override { return sampling_frequency_; }
- int NumChannels() const override { return num_channels_; }
-
- bool Render(rtc::ArrayView<const int16_t> data) override {
- if (data.size() >= wanted_samples_) {
- return false;
- }
- wanted_samples_ -= data.size();
- return true;
- }
-
- private:
- const int sampling_frequency_;
- const int num_channels_;
- size_t wanted_samples_;
-};
-
-} // namespace
-
-TEST(AudioWithMediaTransport, DeliversAudio) {
- std::unique_ptr<rtc::Thread> transport_thread = rtc::Thread::Create();
- transport_thread->Start();
- std::unique_ptr<TaskQueueFactory> task_queue_factory =
- CreateDefaultTaskQueueFactory();
- MediaTransportPair transport_pair(transport_thread.get());
- NiceMock<MockTransport> rtcp_send_transport;
- NiceMock<MockTransport> send_transport;
- RtcEventLogNull null_event_log;
- NiceMock<MockBitrateAllocator> bitrate_allocator;
-
- rtc::scoped_refptr<TestAudioDeviceModule> audio_device =
- TestAudioDeviceModule::Create(
- task_queue_factory.get(),
- TestAudioDeviceModule::CreatePulsedNoiseCapturer(
- /* max_amplitude= */ 10000, kSamplingFrequency, kNumChannels),
- std::make_unique<TestRenderer>(kSamplingFrequency, kNumChannels,
- kWantedSamples));
-
- AudioState::Config audio_config;
- audio_config.audio_mixer = AudioMixerImpl::Create();
- // TODO(nisse): Is a mock AudioProcessing enough?
- audio_config.audio_processing =
- new rtc::RefCountedObject<MockAudioProcessing>();
- audio_config.audio_device_module = audio_device;
- rtc::scoped_refptr<AudioState> audio_state = AudioState::Create(audio_config);
-
- // TODO(nisse): Use some lossless codec?
- const SdpAudioFormat audio_format("opus", kSamplingFrequency, kNumChannels);
-
- // Setup receive stream;
- webrtc::AudioReceiveStream::Config receive_config;
- // TODO(nisse): Update AudioReceiveStream to not require rtcp_send_transport
- // when a MediaTransport is provided.
- receive_config.rtcp_send_transport = &rtcp_send_transport;
- receive_config.media_transport_config.media_transport =
- transport_pair.first();
- receive_config.decoder_map.emplace(kPayloadTypeOpus, audio_format);
- receive_config.decoder_factory =
- CreateAudioDecoderFactory<AudioDecoderOpus>();
-
- std::unique_ptr<ProcessThread> receive_process_thread =
- ProcessThread::Create("audio recv thread");
-
- webrtc::internal::AudioReceiveStream receive_stream(
- Clock::GetRealTimeClock(),
- /*receiver_controller=*/nullptr,
- /*packet_router=*/nullptr, receive_process_thread.get(),
- /*neteq_factory=*/nullptr, receive_config, audio_state, &null_event_log);
-
- // TODO(nisse): Update AudioSendStream to not require send_transport when a
- // MediaTransport is provided.
- AudioSendStream::Config send_config(
- &send_transport, webrtc::MediaTransportConfig(transport_pair.second()));
- send_config.send_codec_spec =
- AudioSendStream::Config::SendCodecSpec(kPayloadTypeOpus, audio_format);
- send_config.encoder_factory = CreateAudioEncoderFactory<AudioEncoderOpus>();
- std::unique_ptr<ProcessThread> send_process_thread =
- ProcessThread::Create("audio send thread");
- FieldTrialBasedConfig field_trials;
- RtpTransportControllerSend rtp_transport(
- Clock::GetRealTimeClock(), &null_event_log, nullptr, nullptr,
- BitrateConstraints(), ProcessThread::Create("Pacer"),
- task_queue_factory.get(), &field_trials);
- webrtc::internal::AudioSendStream send_stream(
- Clock::GetRealTimeClock(), send_config, audio_state,
- task_queue_factory.get(), send_process_thread.get(), &rtp_transport,
- &bitrate_allocator, &null_event_log,
- /*rtcp_rtt_stats=*/nullptr, absl::optional<RtpState>());
-
- audio_device->Init(); // Starts thread.
- audio_device->RegisterAudioCallback(audio_state->audio_transport());
-
- receive_stream.Start();
- send_stream.Start();
- audio_device->StartPlayout();
- audio_device->StartRecording();
-
- EXPECT_TRUE(audio_device->WaitForPlayoutEnd(kTestTimeoutMs));
-
- audio_device->StopRecording();
- audio_device->StopPlayout();
- receive_stream.Stop();
- send_stream.Stop();
-}
-
-} // namespace test
-} // namespace webrtc