Introduce MediaTransportConfig
Currently we pass media_transport from PeerConnection to media layers. The goal of this change is to replace media_transport with struct MediaTransportCondif, which will enable adding different transports (i.e. we plan to add DatagramTransport) as well as other media-transport related settings without changing 100s of files.
TODO: In the future we should consider also adding rtp_transport in the same config, but it will require a bit more work, so I did not include it in the same change.
Bug: webrtc:9719
Change-Id: Ie31e1faa3ed9e6beefe30a3da208130509ce00cd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/137181
Commit-Queue: Anton Sukhanov <sukhanov@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Bjorn Mellem <mellem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28016}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index b9c3229..6700a95 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -108,6 +108,8 @@
"media_stream_interface.h",
"media_stream_proxy.h",
"media_stream_track_proxy.h",
+ "media_transport_config.cc",
+ "media_transport_config.h",
"media_transport_interface.cc",
"media_transport_interface.h",
"media_types.cc",
diff --git a/api/media_transport_config.cc b/api/media_transport_config.cc
new file mode 100644
index 0000000..7eb4cd4
--- /dev/null
+++ b/api/media_transport_config.cc
@@ -0,0 +1,20 @@
+/*
+ * Copyright 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 "api/media_transport_config.h"
+
+namespace webrtc {
+
+std::string MediaTransportConfig::DebugString() const {
+ return (media_transport != nullptr ? "{media_transport: (Transport)}"
+ : "{media_transport: null}");
+}
+
+} // namespace webrtc
diff --git a/api/media_transport_config.h b/api/media_transport_config.h
new file mode 100644
index 0000000..d5de42a
--- /dev/null
+++ b/api/media_transport_config.h
@@ -0,0 +1,42 @@
+/* Copyright 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.
+ */
+#ifndef API_MEDIA_TRANSPORT_CONFIG_H_
+#define API_MEDIA_TRANSPORT_CONFIG_H_
+
+#include <memory>
+#include <string>
+#include <utility>
+
+namespace webrtc {
+
+class MediaTransportInterface;
+
+// MediaTransportConfig contains meida transport (if provided) and passed from
+// PeerConnection to call obeject and media layers that require access to media
+// transport. In the future we can add other transport (for example, datagram
+// transport) and related configuration.
+struct MediaTransportConfig {
+ // Default constructor for no-media transport scenarios.
+ MediaTransportConfig() = default;
+
+ // TODO(sukhanov): Consider adding RtpTransport* to MediaTransportConfig,
+ // because it's almost always passes along with media_transport.
+ // Does not own media_transport.
+ explicit MediaTransportConfig(MediaTransportInterface* media_transport)
+ : media_transport(media_transport) {}
+
+ std::string DebugString() const;
+
+ // If provided, all media is sent through media_transport.
+ MediaTransportInterface* media_transport = nullptr;
+};
+
+} // namespace webrtc
+
+#endif // API_MEDIA_TRANSPORT_CONFIG_H_
diff --git a/audio/BUILD.gn b/audio/BUILD.gn
index 4646eb1..7539f37 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -123,6 +123,7 @@
deps = [
":audio",
":audio_end_to_end_test",
+ "../api:libjingle_peerconnection_api",
"../api:loopback_media_transport",
"../api:mock_audio_mixer",
"../api:mock_frame_decryptor",
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index b98c213..32617aa 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -56,7 +56,7 @@
ss << "{rtp: " << rtp.ToString();
ss << ", rtcp_send_transport: "
<< (rtcp_send_transport ? "(Transport)" : "null");
- ss << ", media_transport: " << (media_transport ? "(Transport)" : "null");
+ ss << ", media_transport_config: " << media_transport_config.DebugString();
if (!sync_group.empty()) {
ss << ", sync_group: " << sync_group;
}
@@ -77,7 +77,7 @@
static_cast<internal::AudioState*>(audio_state);
return voe::CreateChannelReceive(
clock, module_process_thread, internal_audio_state->audio_device_module(),
- config.media_transport, config.rtcp_send_transport, event_log,
+ config.media_transport_config, config.rtcp_send_transport, event_log,
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,
@@ -122,7 +122,7 @@
module_process_thread_checker_.Detach();
- if (!config.media_transport) {
+ if (!config.media_transport_config.media_transport) {
RTC_DCHECK(receiver_controller);
RTC_DCHECK(packet_router);
// Configure bandwidth estimation.
@@ -140,7 +140,7 @@
RTC_LOG(LS_INFO) << "~AudioReceiveStream: " << config_.rtp.remote_ssrc;
Stop();
channel_receive_->SetAssociatedSendChannel(nullptr);
- if (!config_.media_transport) {
+ if (!config_.media_transport_config.media_transport) {
channel_receive_->ResetReceiverCongestionControlObjects();
}
}
diff --git a/audio/audio_receive_stream_unittest.cc b/audio/audio_receive_stream_unittest.cc
index 303e0e8..b97217c 100644
--- a/audio/audio_receive_stream_unittest.cc
+++ b/audio/audio_receive_stream_unittest.cc
@@ -220,7 +220,8 @@
"{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: null}",
+ "rtcp_send_transport: null, media_transport_config: {media_transport: "
+ "null}}",
config.ToString());
}
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index a72292d..942551b 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -21,6 +21,7 @@
#include "api/call/transport.h"
#include "api/crypto/frame_encryptor_interface.h"
#include "api/function_view.h"
+#include "api/media_transport_config.h"
#include "audio/audio_state.h"
#include "audio/channel_send.h"
#include "audio/conversion.h"
@@ -104,7 +105,7 @@
voe::CreateChannelSend(clock,
task_queue_factory,
module_process_thread,
- config.media_transport,
+ config.media_transport_config,
/*overhead_observer=*/this,
config.send_transport,
rtcp_rtt_stats,
@@ -127,8 +128,7 @@
std::unique_ptr<voe::ChannelSendInterface> channel_send)
: clock_(clock),
worker_queue_(rtp_transport->GetWorkerQueue()),
- config_(Config(/*send_transport=*/nullptr,
- /*media_transport=*/nullptr)),
+ config_(Config(/*send_transport=*/nullptr, MediaTransportConfig())),
audio_state_(audio_state),
channel_send_(std::move(channel_send)),
event_log_(event_log),
@@ -151,15 +151,15 @@
// 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);
- if (config.media_transport) {
+ 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->GetAudioPacketOverhead();
+ 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 5ddc5e1..4531755 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -136,7 +136,7 @@
ConfigHelper(bool audio_bwe_enabled, bool expect_set_encoder_call)
: clock_(1000000),
task_queue_factory_(CreateDefaultTaskQueueFactory()),
- stream_config_(/*send_transport=*/nullptr, /*media_transport=*/nullptr),
+ stream_config_(/*send_transport=*/nullptr, MediaTransportConfig()),
audio_processing_(new rtc::RefCountedObject<MockAudioProcessing>()),
bitrate_allocator_(&clock_, &limit_observer_),
worker_queue_(task_queue_factory_->CreateTaskQueue(
@@ -321,7 +321,7 @@
TEST(AudioSendStreamTest, ConfigToString) {
AudioSendStream::Config config(/*send_transport=*/nullptr,
- /*media_transport=*/nullptr);
+ MediaTransportConfig());
config.rtp.ssrc = kSsrc;
config.rtp.c_name = kCName;
config.min_bitrate_bps = 12000;
@@ -340,7 +340,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: null, "
+ "send_transport: null, media_transport_config: {media_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 f65d125..85a029d 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -79,7 +79,7 @@
ChannelReceive(Clock* clock,
ProcessThread* module_process_thread,
AudioDeviceModule* audio_device_module,
- MediaTransportInterface* media_transport,
+ const MediaTransportConfig& media_transport_config,
Transport* rtcp_send_transport,
RtcEventLog* rtc_event_log,
uint32_t remote_ssrc,
@@ -157,6 +157,12 @@
std::vector<RtpSource> GetSources() const 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:
bool ReceivePacket(const uint8_t* packet,
size_t packet_length,
@@ -254,7 +260,7 @@
rtc::ThreadChecker construction_thread_;
- MediaTransportInterface* const media_transport_;
+ MediaTransportConfig media_transport_config_;
// E2EE Audio Frame Decryption
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor_;
@@ -265,7 +271,7 @@
size_t payloadSize,
const RTPHeader& rtp_header) {
// We should not be receiving any RTP packets if media_transport is set.
- RTC_CHECK(!media_transport_);
+ RTC_CHECK(!media_transport());
if (!Playing()) {
// Avoid inserting into NetEQ when we are not playing. Count the
@@ -296,7 +302,7 @@
// MediaTransportAudioSinkInterface override.
void ChannelReceive::OnData(uint64_t channel_id,
MediaTransportEncodedAudioFrame frame) {
- RTC_CHECK(media_transport_);
+ RTC_CHECK(media_transport());
if (!Playing()) {
// Avoid inserting into NetEQ when we are not playing. Count the
@@ -432,7 +438,7 @@
Clock* clock,
ProcessThread* module_process_thread,
AudioDeviceModule* audio_device_module,
- MediaTransportInterface* media_transport,
+ const MediaTransportConfig& media_transport_config,
Transport* rtcp_send_transport,
RtcEventLog* rtc_event_log,
uint32_t remote_ssrc,
@@ -458,7 +464,7 @@
_audioDeviceModulePtr(audio_device_module),
_outputGain(1.0f),
associated_send_channel_(nullptr),
- media_transport_(media_transport),
+ media_transport_config_(media_transport_config),
frame_decryptor_(frame_decryptor),
crypto_options_(crypto_options) {
// TODO(nisse): Use _moduleProcessThreadPtr instead?
@@ -503,16 +509,16 @@
// RTCP is enabled by default.
_rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound);
- if (media_transport_) {
- media_transport_->SetReceiveAudioSink(this);
+ if (media_transport()) {
+ media_transport()->SetReceiveAudioSink(this);
}
}
ChannelReceive::~ChannelReceive() {
RTC_DCHECK(construction_thread_.IsCurrent());
- if (media_transport_) {
- media_transport_->SetReceiveAudioSink(nullptr);
+ if (media_transport()) {
+ media_transport()->SetReceiveAudioSink(nullptr);
}
StopPlayout();
@@ -921,8 +927,8 @@
}
int64_t ChannelReceive::GetRTT() const {
- if (media_transport_) {
- auto target_rate = media_transport_->GetLatestTargetTransferRate();
+ if (media_transport()) {
+ auto target_rate = media_transport()->GetLatestTargetTransferRate();
if (target_rate.has_value()) {
return target_rate->network_estimate.round_trip_time.ms();
}
@@ -966,7 +972,7 @@
Clock* clock,
ProcessThread* module_process_thread,
AudioDeviceModule* audio_device_module,
- MediaTransportInterface* media_transport,
+ const MediaTransportConfig& media_transport_config,
Transport* rtcp_send_transport,
RtcEventLog* rtc_event_log,
uint32_t remote_ssrc,
@@ -979,7 +985,7 @@
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
const webrtc::CryptoOptions& crypto_options) {
return absl::make_unique<ChannelReceive>(
- clock, module_process_thread, audio_device_module, media_transport,
+ clock, module_process_thread, audio_device_module, media_transport_config,
rtcp_send_transport, rtc_event_log, remote_ssrc,
jitter_buffer_max_packets, jitter_buffer_fast_playout,
jitter_buffer_min_delay_ms, jitter_buffer_enable_rtx_handling,
diff --git a/audio/channel_receive.h b/audio/channel_receive.h
index 1f78874..d29f624 100644
--- a/audio/channel_receive.h
+++ b/audio/channel_receive.h
@@ -22,6 +22,7 @@
#include "api/call/audio_sink.h"
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
+#include "api/media_transport_config.h"
#include "api/media_transport_interface.h"
#include "api/rtp_receiver_interface.h"
#include "call/rtp_packet_sink_interface.h"
@@ -143,7 +144,7 @@
Clock* clock,
ProcessThread* module_process_thread,
AudioDeviceModule* audio_device_module,
- MediaTransportInterface* media_transport,
+ const MediaTransportConfig& media_transport_config,
Transport* rtcp_send_transport,
RtcEventLog* rtc_event_log,
uint32_t remote_ssrc,
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index e8360cb..38e89d8 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -89,7 +89,7 @@
ChannelSend(Clock* clock,
TaskQueueFactory* task_queue_factory,
ProcessThread* module_process_thread,
- MediaTransportInterface* media_transport,
+ const MediaTransportConfig& media_transport_config,
OverheadObserver* overhead_observer,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
@@ -205,7 +205,9 @@
RTC_RUN_ON(encoder_queue_);
// Return media transport or nullptr if using RTP.
- MediaTransportInterface* media_transport() { return media_transport_; }
+ MediaTransportInterface* media_transport() {
+ return media_transport_config_.media_transport;
+ }
// Called on the encoder task queue when a new input audio frame is ready
// for encoding.
@@ -266,7 +268,7 @@
bool encoder_queue_is_active_ RTC_GUARDED_BY(encoder_queue_) = false;
- MediaTransportInterface* const media_transport_;
+ MediaTransportConfig media_transport_config_;
int media_transport_sequence_number_ RTC_GUARDED_BY(encoder_queue_) = 0;
rtc::CriticalSection media_transport_lock_;
@@ -618,7 +620,7 @@
ChannelSend::ChannelSend(Clock* clock,
TaskQueueFactory* task_queue_factory,
ProcessThread* module_process_thread,
- MediaTransportInterface* media_transport,
+ const MediaTransportConfig& media_transport_config,
OverheadObserver* overhead_observer,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
@@ -642,7 +644,7 @@
new RateLimiter(clock, kMaxRetransmissionWindowMs)),
use_twcc_plr_for_ana_(
webrtc::field_trial::FindFullName("UseTwccPlrForAna") == "Enabled"),
- media_transport_(media_transport),
+ media_transport_config_(media_transport_config),
frame_encryptor_(frame_encryptor),
crypto_options_(crypto_options),
encoder_queue_(task_queue_factory->CreateTaskQueue(
@@ -659,7 +661,7 @@
// 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_) {
+ 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();
@@ -689,10 +691,11 @@
// We want to invoke the 'TargetRateObserver' and |OnOverheadChanged|
// callbacks after the audio_coding_ is fully initialized.
- if (media_transport_) {
+ if (media_transport_config.media_transport) {
RTC_DLOG(LS_INFO) << "Setting media_transport_ rate observers.";
- media_transport_->AddTargetTransferRateObserver(this);
- media_transport_->SetAudioOverheadObserver(overhead_observer);
+ 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.";
}
@@ -714,9 +717,10 @@
ChannelSend::~ChannelSend() {
RTC_DCHECK(construction_thread_.IsCurrent());
- if (media_transport_) {
- media_transport_->RemoveTargetTransferRateObserver(this);
- media_transport_->SetAudioOverheadObserver(nullptr);
+ if (media_transport_config_.media_transport) {
+ media_transport_config_.media_transport->RemoveTargetTransferRateObserver(
+ this);
+ media_transport_config_.media_transport->SetAudioOverheadObserver(nullptr);
}
StopSend();
@@ -779,7 +783,7 @@
encoder->RtpTimestampRateHz(),
encoder->NumChannels(), 0);
- if (media_transport_) {
+ 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
@@ -856,7 +860,7 @@
void ChannelSend::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
// May be called on either worker thread or network thread.
- if (media_transport_) {
+ 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;
@@ -931,7 +935,7 @@
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
RTC_DCHECK(!sending_);
- if (media_transport_) {
+ if (media_transport_config_.media_transport) {
rtc::CritScope cs(&media_transport_lock_);
media_transport_channel_id_ = ssrc;
}
@@ -1165,12 +1169,13 @@
}
int64_t ChannelSend::GetRTT() const {
- if (media_transport_) {
+ 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_->GetLatestTargetTransferRate();
+ auto target_rate =
+ media_transport_config_.media_transport->GetLatestTargetTransferRate();
if (target_rate.has_value()) {
return target_rate.value().network_estimate.round_trip_time.ms();
}
@@ -1214,7 +1219,7 @@
// 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_);
+ RTC_DCHECK(media_transport_config_.media_transport);
OnReceivedRtt(rate.network_estimate.round_trip_time.ms());
}
@@ -1230,7 +1235,7 @@
Clock* clock,
TaskQueueFactory* task_queue_factory,
ProcessThread* module_process_thread,
- MediaTransportInterface* media_transport,
+ const MediaTransportConfig& media_transport_config,
OverheadObserver* overhead_observer,
Transport* rtp_transport,
RtcpRttStats* rtcp_rtt_stats,
@@ -1240,7 +1245,7 @@
bool extmap_allow_mixed,
int rtcp_report_interval_ms) {
return absl::make_unique<ChannelSend>(
- clock, task_queue_factory, module_process_thread, media_transport,
+ 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);
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 45f7b1e..fb98be3 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -19,6 +19,7 @@
#include "api/audio_codecs/audio_encoder.h"
#include "api/crypto/crypto_options.h"
#include "api/function_view.h"
+#include "api/media_transport_config.h"
#include "api/media_transport_interface.h"
#include "api/task_queue/task_queue_factory.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
@@ -125,7 +126,7 @@
Clock* clock,
TaskQueueFactory* task_queue_factory,
ProcessThread* module_process_thread,
- MediaTransportInterface* media_transport,
+ 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
index 7794b43..4594c3e 100644
--- a/audio/test/media_transport_test.cc
+++ b/audio/test/media_transport_test.cc
@@ -13,6 +13,7 @@
#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/media_transport_config.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/test/loopback_media_transport.h"
#include "api/test/mock_audio_mixer.h"
@@ -100,7 +101,8 @@
// 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 = transport_pair.first();
+ receive_config.media_transport_config.media_transport =
+ transport_pair.first();
receive_config.decoder_map.emplace(kPayloadTypeOpus, audio_format);
receive_config.decoder_factory =
CreateAudioDecoderFactory<AudioDecoderOpus>();
@@ -116,7 +118,8 @@
// TODO(nisse): Update AudioSendStream to not require send_transport when a
// MediaTransport is provided.
- AudioSendStream::Config send_config(&send_transport, transport_pair.second());
+ 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>();
diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h
index 35c6ef7..911b38e 100644
--- a/call/audio_receive_stream.h
+++ b/call/audio_receive_stream.h
@@ -20,7 +20,7 @@
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
-#include "api/media_transport_interface.h"
+#include "api/media_transport_config.h"
#include "api/rtp_parameters.h"
#include "api/rtp_receiver_interface.h"
#include "api/scoped_refptr.h"
@@ -122,7 +122,7 @@
Transport* rtcp_send_transport = nullptr;
- MediaTransportInterface* media_transport = nullptr;
+ MediaTransportConfig media_transport_config;
// NetEq settings.
size_t jitter_buffer_max_packets = 200;
diff --git a/call/audio_send_stream.cc b/call/audio_send_stream.cc
index 0a3555b..6fdb39c 100644
--- a/call/audio_send_stream.cc
+++ b/call/audio_send_stream.cc
@@ -21,12 +21,14 @@
AudioSendStream::Stats::Stats() = default;
AudioSendStream::Stats::~Stats() = default;
-AudioSendStream::Config::Config(Transport* send_transport,
- MediaTransportInterface* media_transport)
- : send_transport(send_transport), media_transport(media_transport) {}
+AudioSendStream::Config::Config(
+ Transport* send_transport,
+ const MediaTransportConfig& media_transport_config)
+ : send_transport(send_transport),
+ media_transport_config(media_transport_config) {}
AudioSendStream::Config::Config(Transport* send_transport)
- : Config(send_transport, nullptr) {}
+ : Config(send_transport, MediaTransportConfig()) {}
AudioSendStream::Config::~Config() = default;
@@ -36,7 +38,7 @@
ss << "{rtp: " << rtp.ToString();
ss << ", rtcp_report_interval_ms: " << rtcp_report_interval_ms;
ss << ", send_transport: " << (send_transport ? "(Transport)" : "null");
- ss << ", media_transport: " << (media_transport ? "(Transport)" : "null");
+ ss << ", media_transport_config: " << media_transport_config.DebugString();
ss << ", min_bitrate_bps: " << min_bitrate_bps;
ss << ", max_bitrate_bps: " << max_bitrate_bps;
ss << ", send_codec_spec: "
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index 7e17b7c..b21b2ef 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -23,6 +23,7 @@
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
#include "api/crypto/frame_encryptor_interface.h"
+#include "api/media_transport_config.h"
#include "api/media_transport_interface.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
@@ -69,7 +70,8 @@
struct Config {
Config() = delete;
- Config(Transport* send_transport, MediaTransportInterface* media_transport);
+ Config(Transport* send_transport,
+ const MediaTransportConfig& media_transport_config);
explicit Config(Transport* send_transport);
~Config();
std::string ToString() const;
@@ -108,7 +110,7 @@
// the entire life of the AudioSendStream and is owned by the API client.
Transport* send_transport = nullptr;
- MediaTransportInterface* media_transport = nullptr;
+ MediaTransportConfig media_transport_config;
// Bitrate limits used for variable audio bitrate streams. Set both to -1 to
// disable audio bitrate adaptation.
diff --git a/call/call.cc b/call/call.cc
index ee6cbc6..fb60558 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -708,7 +708,8 @@
TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream");
RTC_DCHECK_RUN_ON(&configuration_sequence_checker_);
- RTC_DCHECK(media_transport() == config.media_transport);
+ RTC_DCHECK_EQ(media_transport(),
+ config.media_transport_config.media_transport);
RegisterRateObserver();
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 4a686ed..0bbf034 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -244,7 +244,7 @@
CreateMatchingReceiveConfigs(receive_transport.get());
AudioSendStream::Config audio_send_config(audio_send_transport.get(),
- /*media_transport=*/nullptr);
+ MediaTransportConfig());
audio_send_config.rtp.ssrc = kAudioSendSsrc;
audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
kAudioSendPayloadType, {"ISAC", 16000, 1});
diff --git a/call/call_unittest.cc b/call/call_unittest.cc
index 1739036..4c78413 100644
--- a/call/call_unittest.cc
+++ b/call/call_unittest.cc
@@ -64,8 +64,7 @@
TEST(CallTest, CreateDestroy_AudioSendStream) {
CallHelper call;
MockTransport send_transport;
- AudioSendStream::Config config(&send_transport,
- /*media_transport=*/nullptr);
+ AudioSendStream::Config config(&send_transport, MediaTransportConfig());
config.rtp.ssrc = 42;
AudioSendStream* stream = call->CreateAudioSendStream(config);
EXPECT_NE(stream, nullptr);
@@ -88,8 +87,7 @@
TEST(CallTest, CreateDestroy_AudioSendStreams) {
CallHelper call;
MockTransport send_transport;
- AudioSendStream::Config config(&send_transport,
- /*media_transport=*/nullptr);
+ AudioSendStream::Config config(&send_transport, MediaTransportConfig());
std::list<AudioSendStream*> streams;
for (int i = 0; i < 2; ++i) {
for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) {
@@ -148,8 +146,7 @@
EXPECT_NE(recv_stream, nullptr);
MockTransport send_transport;
- AudioSendStream::Config send_config(&send_transport,
- /*media_transport=*/nullptr);
+ AudioSendStream::Config send_config(&send_transport, MediaTransportConfig());
send_config.rtp.ssrc = 777;
AudioSendStream* send_stream = call->CreateAudioSendStream(send_config);
EXPECT_NE(send_stream, nullptr);
@@ -168,8 +165,7 @@
TEST(CallTest, CreateDestroy_AssociateAudioSendReceiveStreams_SendFirst) {
CallHelper call;
MockTransport send_transport;
- AudioSendStream::Config send_config(&send_transport,
- /*media_transport=*/nullptr);
+ AudioSendStream::Config send_config(&send_transport, MediaTransportConfig());
send_config.rtp.ssrc = 777;
AudioSendStream* send_stream = call->CreateAudioSendStream(send_config);
EXPECT_NE(send_stream, nullptr);
@@ -273,8 +269,7 @@
auto create_stream_and_get_rtp_state = [&](uint32_t ssrc) {
MockTransport send_transport;
- AudioSendStream::Config config(&send_transport,
- /*media_transport=*/nullptr);
+ AudioSendStream::Config config(&send_transport, MediaTransportConfig());
config.rtp.ssrc = ssrc;
AudioSendStream* stream = call->CreateAudioSendStream(config);
const RtpState rtp_state =
@@ -305,7 +300,7 @@
// RTCPSender requires one.
MockTransport send_transport;
AudioSendStream::Config config(&send_transport,
- /*media_transport=*/&fake_media_transport);
+ MediaTransportConfig(&fake_media_transport));
call->MediaTransportChange(&fake_media_transport);
AudioSendStream* stream = call->CreateAudioSendStream(config);
diff --git a/call/video_receive_stream.cc b/call/video_receive_stream.cc
index 86ef88a..92787cc 100644
--- a/call/video_receive_stream.cc
+++ b/call/video_receive_stream.cc
@@ -67,11 +67,11 @@
VideoReceiveStream::Config::Config(const Config&) = default;
VideoReceiveStream::Config::Config(Config&&) = default;
VideoReceiveStream::Config::Config(Transport* rtcp_send_transport,
- MediaTransportInterface* media_transport)
+ MediaTransportConfig media_transport_config)
: rtcp_send_transport(rtcp_send_transport),
- media_transport(media_transport) {}
+ media_transport_config(media_transport_config) {}
VideoReceiveStream::Config::Config(Transport* rtcp_send_transport)
- : Config(rtcp_send_transport, nullptr) {}
+ : Config(rtcp_send_transport, MediaTransportConfig()) {}
VideoReceiveStream::Config& VideoReceiveStream::Config::operator=(Config&&) =
default;
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index affc256..a1fa86d 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -18,6 +18,7 @@
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
+#include "api/media_transport_config.h"
#include "api/media_transport_interface.h"
#include "api/rtp_headers.h"
#include "api/rtp_parameters.h"
@@ -121,7 +122,7 @@
Config() = delete;
Config(Config&&);
Config(Transport* rtcp_send_transport,
- MediaTransportInterface* media_transport);
+ MediaTransportConfig media_transport_config);
explicit Config(Transport* rtcp_send_transport);
Config& operator=(Config&&);
Config& operator=(const Config&) = delete;
@@ -132,6 +133,10 @@
std::string ToString() const;
+ MediaTransportInterface* media_transport() const {
+ return media_transport_config.media_transport;
+ }
+
// Decoders for every payload that we can receive.
std::vector<Decoder> decoders;
@@ -197,7 +202,7 @@
// Transport for outgoing packets (RTCP).
Transport* rtcp_send_transport = nullptr;
- MediaTransportInterface* media_transport = nullptr;
+ MediaTransportConfig media_transport_config;
// Must always be set.
rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr;
diff --git a/media/base/media_channel.cc b/media/base/media_channel.cc
index c512efd..1bd20dc 100644
--- a/media/base/media_channel.cc
+++ b/media/base/media_channel.cc
@@ -24,10 +24,10 @@
void MediaChannel::SetInterface(
NetworkInterface* iface,
- webrtc::MediaTransportInterface* media_transport) {
+ const webrtc::MediaTransportConfig& media_transport_config) {
rtc::CritScope cs(&network_interface_crit_);
network_interface_ = iface;
- media_transport_ = media_transport;
+ media_transport_config_ = media_transport_config;
UpdateDscp();
}
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index 4930d41..04edd9c 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -22,7 +22,7 @@
#include "api/audio_options.h"
#include "api/crypto/frame_decryptor_interface.h"
#include "api/crypto/frame_encryptor_interface.h"
-#include "api/media_transport_interface.h"
+#include "api/media_transport_config.h"
#include "api/rtc_error.h"
#include "api/rtp_parameters.h"
#include "api/rtp_receiver_interface.h"
@@ -193,8 +193,9 @@
// TODO(sukhanov): Currently media transport can co-exist with RTP/RTCP, but
// in the future we will refactor code to send all frames with media
// transport.
- virtual void SetInterface(NetworkInterface* iface,
- webrtc::MediaTransportInterface* media_transport);
+ virtual void SetInterface(
+ NetworkInterface* iface,
+ const webrtc::MediaTransportConfig& media_transport_config);
// Called when a RTP packet is received.
virtual void OnPacketReceived(rtc::CopyOnWriteBuffer packet,
int64_t packet_time_us) = 0;
@@ -261,8 +262,12 @@
return network_interface_->SetOption(type, opt, option);
}
+ const webrtc::MediaTransportConfig& media_transport_config() const {
+ return media_transport_config_;
+ }
+
webrtc::MediaTransportInterface* media_transport() {
- return media_transport_;
+ return media_transport_config_.media_transport;
}
// Corresponds to the SDP attribute extmap-allow-mixed, see RFC8285.
@@ -331,7 +336,7 @@
nullptr;
rtc::DiffServCodePoint preferred_dscp_
RTC_GUARDED_BY(network_interface_crit_) = rtc::DSCP_DEFAULT;
- webrtc::MediaTransportInterface* media_transport_ = nullptr;
+ webrtc::MediaTransportConfig media_transport_config_;
bool extmap_allow_mixed_ = false;
};
diff --git a/media/base/rtp_data_engine_unittest.cc b/media/base/rtp_data_engine_unittest.cc
index ffb91d7..df0f904 100644
--- a/media/base/rtp_data_engine_unittest.cc
+++ b/media/base/rtp_data_engine_unittest.cc
@@ -12,6 +12,7 @@
#include <memory>
#include <string>
+#include "api/media_transport_config.h"
#include "media/base/fake_network_interface.h"
#include "media/base/media_constants.h"
#include "media/base/rtp_data_engine.h"
@@ -73,7 +74,8 @@
cricket::MediaConfig config;
cricket::RtpDataMediaChannel* channel =
static_cast<cricket::RtpDataMediaChannel*>(dme->CreateChannel(config));
- channel->SetInterface(iface_.get(), /*media_transport=*/nullptr);
+ channel->SetInterface(iface_.get(), webrtc::MediaTransportConfig(
+ /*media_transport=*/nullptr));
channel->SignalDataReceived.connect(receiver_.get(),
&FakeDataReceiver::OnDataReceived);
return channel;
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc
index 580b0a7..d79dc3f 100644
--- a/media/engine/webrtc_video_engine.cc
+++ b/media/engine/webrtc_video_engine.cc
@@ -1209,7 +1209,7 @@
for (uint32_t used_ssrc : sp.ssrcs)
receive_ssrcs_.insert(used_ssrc);
- webrtc::VideoReceiveStream::Config config(this, media_transport());
+ webrtc::VideoReceiveStream::Config config(this, media_transport_config());
webrtc::FlexfecReceiveStream::Config flexfec_config(this);
ConfigureReceiverRtp(&config, &flexfec_config, sp);
@@ -1540,9 +1540,9 @@
void WebRtcVideoChannel::SetInterface(
NetworkInterface* iface,
- webrtc::MediaTransportInterface* media_transport) {
+ const webrtc::MediaTransportConfig& media_transport_config) {
RTC_DCHECK_RUN_ON(&thread_checker_);
- MediaChannel::SetInterface(iface, media_transport);
+ MediaChannel::SetInterface(iface, media_transport_config);
// Set the RTP recv/send buffer to a bigger size.
// The group should be a positive integer with an explicit size, in
@@ -1723,7 +1723,11 @@
parameters_(std::move(config), options, max_bitrate_bps, codec_settings),
rtp_parameters_(CreateRtpParametersWithEncodings(sp)),
sending_(false) {
- parameters_.config.rtp.max_packet_size = kVideoMtu;
+ // Maximum packet size may come in RtpConfig from external transport, for
+ // example from QuicTransportInterface implementation, so do not exceed
+ // given max_packet_size.
+ parameters_.config.rtp.max_packet_size =
+ std::min<size_t>(parameters_.config.rtp.max_packet_size, kVideoMtu);
parameters_.conference_mode = send_params.conference_mode;
sp.GetPrimarySsrcs(¶meters_.config.rtp.ssrcs);
diff --git a/media/engine/webrtc_video_engine.h b/media/engine/webrtc_video_engine.h
index 44d0613..ccec8cc 100644
--- a/media/engine/webrtc_video_engine.h
+++ b/media/engine/webrtc_video_engine.h
@@ -152,8 +152,9 @@
void OnReadyToSend(bool ready) override;
void OnNetworkRouteChanged(const std::string& transport_name,
const rtc::NetworkRoute& network_route) override;
- void SetInterface(NetworkInterface* iface,
- webrtc::MediaTransportInterface* media_transport) override;
+ void SetInterface(
+ NetworkInterface* iface,
+ const webrtc::MediaTransportConfig& media_transport_config) override;
// E2E Encrypted Video Frame API
// Set a frame decryptor to a particular ssrc that will intercept all
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc
index 4e7a8b6..8381b01 100644
--- a/media/engine/webrtc_video_engine_unittest.cc
+++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -16,6 +16,7 @@
#include "absl/algorithm/container.h"
#include "absl/memory/memory.h"
#include "absl/strings/match.h"
+#include "api/media_transport_config.h"
#include "api/rtp_parameters.h"
#include "api/test/fake_media_transport.h"
#include "api/test/mock_video_bitrate_allocator.h"
@@ -1292,7 +1293,7 @@
channel_->OnReadyToSend(true);
EXPECT_TRUE(channel_.get() != NULL);
network_interface_.SetDestination(channel_.get());
- channel_->SetInterface(&network_interface_, /*media_transport=*/nullptr);
+ channel_->SetInterface(&network_interface_, webrtc::MediaTransportConfig());
cricket::VideoRecvParameters parameters;
parameters.codecs = engine_.codecs();
channel_->SetRecvParameters(parameters);
@@ -4017,7 +4018,8 @@
webrtc::FakeMediaTransport fake_media_transport(settings);
std::unique_ptr<cricket::FakeNetworkInterface> network_interface(
new cricket::FakeNetworkInterface);
- channel_->SetInterface(network_interface.get(), &fake_media_transport);
+ channel_->SetInterface(network_interface.get(),
+ webrtc::MediaTransportConfig(&fake_media_transport));
send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "100";
send_parameters_.codecs[0].params[kCodecParamStartBitrate] = "200";
@@ -4624,7 +4626,8 @@
static_cast<cricket::WebRtcVideoChannel*>(engine_.CreateMediaChannel(
call_.get(), config, VideoOptions(), webrtc::CryptoOptions(),
video_bitrate_allocator_factory_.get())));
- channel->SetInterface(network_interface.get(), /*media_transport=*/nullptr);
+ channel->SetInterface(network_interface.get(),
+ webrtc::MediaTransportConfig());
// Default value when DSCP is disabled should be DSCP_DEFAULT.
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
@@ -4635,7 +4638,8 @@
static_cast<cricket::WebRtcVideoChannel*>(engine_.CreateMediaChannel(
call_.get(), config, VideoOptions(), webrtc::CryptoOptions(),
video_bitrate_allocator_factory_.get())));
- channel->SetInterface(network_interface.get(), /*media_transport=*/nullptr);
+ channel->SetInterface(network_interface.get(),
+ webrtc::MediaTransportConfig());
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
// Create a send stream to configure
@@ -4669,7 +4673,8 @@
static_cast<cricket::WebRtcVideoChannel*>(engine_.CreateMediaChannel(
call_.get(), config, VideoOptions(), webrtc::CryptoOptions(),
video_bitrate_allocator_factory_.get())));
- channel->SetInterface(network_interface.get(), /*media_transport=*/nullptr);
+ channel->SetInterface(network_interface.get(),
+ webrtc::MediaTransportConfig());
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
}
diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc
index 7f62a55..435b3ab 100644
--- a/media/engine/webrtc_voice_engine.cc
+++ b/media/engine/webrtc_voice_engine.cc
@@ -699,13 +699,13 @@
const absl::optional<std::string>& audio_network_adaptor_config,
webrtc::Call* call,
webrtc::Transport* send_transport,
- webrtc::MediaTransportInterface* media_transport,
+ const webrtc::MediaTransportConfig& media_transport_config,
const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory,
const absl::optional<webrtc::AudioCodecPairId> codec_pair_id,
rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor,
const webrtc::CryptoOptions& crypto_options)
: call_(call),
- config_(send_transport, media_transport),
+ config_(send_transport, media_transport_config),
max_send_bitrate_bps_(max_send_bitrate_bps),
rtp_parameters_(CreateRtpParametersWithOneEncoding()) {
RTC_DCHECK(call);
@@ -1055,7 +1055,7 @@
const std::vector<webrtc::RtpExtension>& extensions,
webrtc::Call* call,
webrtc::Transport* rtcp_send_transport,
- webrtc::MediaTransportInterface* media_transport,
+ const webrtc::MediaTransportConfig& media_transport_config,
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
const std::map<int, webrtc::SdpAudioFormat>& decoder_map,
absl::optional<webrtc::AudioCodecPairId> codec_pair_id,
@@ -1073,7 +1073,7 @@
config_.rtp.nack.rtp_history_ms = use_nack ? kNackRtpHistoryMs : 0;
config_.rtp.extensions = extensions;
config_.rtcp_send_transport = rtcp_send_transport;
- config_.media_transport = media_transport;
+ config_.media_transport_config = media_transport_config;
config_.jitter_buffer_max_packets = jitter_buffer_max_packets;
config_.jitter_buffer_fast_accelerate = jitter_buffer_fast_accelerate;
config_.jitter_buffer_min_delay_ms = jitter_buffer_min_delay_ms;
@@ -1804,7 +1804,7 @@
ssrc, mid_, sp.cname, sp.id, send_codec_spec_, ExtmapAllowMixed(),
send_rtp_extensions_, max_send_bitrate_bps_,
audio_config_.rtcp_report_interval_ms, audio_network_adaptor_config,
- call_, this, media_transport(), engine()->encoder_factory_,
+ call_, this, media_transport_config(), engine()->encoder_factory_,
codec_pair_id_, nullptr, crypto_options_);
send_streams_.insert(std::make_pair(ssrc, stream));
@@ -1886,16 +1886,16 @@
// Create a new channel for receiving audio data.
recv_streams_.insert(std::make_pair(
- ssrc,
- new WebRtcAudioReceiveStream(
- ssrc, receiver_reports_ssrc_, recv_transport_cc_enabled_,
- recv_nack_enabled_, sp.stream_ids(), recv_rtp_extensions_, call_,
- this, media_transport(), engine()->decoder_factory_, decoder_map_,
- codec_pair_id_, engine()->audio_jitter_buffer_max_packets_,
- engine()->audio_jitter_buffer_fast_accelerate_,
- engine()->audio_jitter_buffer_min_delay_ms_,
- engine()->audio_jitter_buffer_enable_rtx_handling_,
- unsignaled_frame_decryptor_, crypto_options_)));
+ ssrc, new WebRtcAudioReceiveStream(
+ ssrc, receiver_reports_ssrc_, recv_transport_cc_enabled_,
+ recv_nack_enabled_, sp.stream_ids(), recv_rtp_extensions_,
+ call_, this, media_transport_config(),
+ engine()->decoder_factory_, decoder_map_, codec_pair_id_,
+ engine()->audio_jitter_buffer_max_packets_,
+ engine()->audio_jitter_buffer_fast_accelerate_,
+ engine()->audio_jitter_buffer_min_delay_ms_,
+ engine()->audio_jitter_buffer_enable_rtx_handling_,
+ unsignaled_frame_decryptor_, crypto_options_)));
recv_streams_[ssrc]->SetPlayout(playout_);
return true;
diff --git a/media/engine/webrtc_voice_engine_unittest.cc b/media/engine/webrtc_voice_engine_unittest.cc
index a76186d..65f3c7b 100644
--- a/media/engine/webrtc_voice_engine_unittest.cc
+++ b/media/engine/webrtc_voice_engine_unittest.cc
@@ -14,6 +14,7 @@
#include "absl/strings/match.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
+#include "api/media_transport_config.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/default_task_queue_factory.h"
@@ -3031,7 +3032,7 @@
channel.reset(static_cast<cricket::WebRtcVoiceMediaChannel*>(
engine_->CreateMediaChannel(&call_, config, cricket::AudioOptions(),
webrtc::CryptoOptions())));
- channel->SetInterface(&network_interface, /*media_transport=*/nullptr);
+ channel->SetInterface(&network_interface, webrtc::MediaTransportConfig());
// Default value when DSCP is disabled should be DSCP_DEFAULT.
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp());
@@ -3039,7 +3040,7 @@
channel.reset(static_cast<cricket::WebRtcVoiceMediaChannel*>(
engine_->CreateMediaChannel(&call_, config, cricket::AudioOptions(),
webrtc::CryptoOptions())));
- channel->SetInterface(&network_interface, /*media_transport=*/nullptr);
+ channel->SetInterface(&network_interface, webrtc::MediaTransportConfig());
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp());
// Create a send stream to configure
@@ -3072,11 +3073,11 @@
channel.reset(static_cast<cricket::WebRtcVoiceMediaChannel*>(
engine_->CreateMediaChannel(&call_, config, cricket::AudioOptions(),
webrtc::CryptoOptions())));
- channel->SetInterface(&network_interface, /*media_transport=*/nullptr);
+ channel->SetInterface(&network_interface, webrtc::MediaTransportConfig());
// Default value when DSCP is disabled should be DSCP_DEFAULT.
EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp());
- channel->SetInterface(nullptr, nullptr);
+ channel->SetInterface(nullptr, webrtc::MediaTransportConfig());
}
TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolume) {
diff --git a/pc/channel.cc b/pc/channel.cc
index 82de7de..be40a7e 100644
--- a/pc/channel.cc
+++ b/pc/channel.cc
@@ -8,17 +8,21 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "pc/channel.h"
+
#include <iterator>
#include <utility>
-#include "pc/channel.h"
-
#include "absl/algorithm/container.h"
#include "absl/memory/memory.h"
#include "api/call/audio_sink.h"
+#include "api/media_transport_config.h"
#include "media/base/media_constants.h"
#include "media/base/rtp_utils.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
+#include "p2p/base/packet_transport_internal.h"
+#include "pc/channel_manager.h"
+#include "pc/rtp_media_utils.h"
#include "rtc_base/bind.h"
#include "rtc_base/byte_order.h"
#include "rtc_base/checks.h"
@@ -28,9 +32,6 @@
#include "rtc_base/network_route.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/trace_event.h"
-#include "p2p/base/packet_transport_internal.h"
-#include "pc/channel_manager.h"
-#include "pc/rtp_media_utils.h"
namespace cricket {
using rtc::Bind;
@@ -148,8 +149,8 @@
TRACE_EVENT0("webrtc", "BaseChannel::~BaseChannel");
RTC_DCHECK_RUN_ON(worker_thread_);
- if (media_transport_) {
- media_transport_->RemoveNetworkChangeCallback(this);
+ if (media_transport_config_.media_transport) {
+ media_transport_config_.media_transport->RemoveNetworkChangeCallback(this);
}
// Eats any outstanding messages or packets.
@@ -174,7 +175,7 @@
// If media transport is used, it's responsible for providing network
// route changed callbacks.
- if (!media_transport_) {
+ if (!media_transport_config_.media_transport) {
rtp_transport_->SignalNetworkRouteChanged.connect(
this, &BaseChannel::OnNetworkRouteChanged);
}
@@ -197,29 +198,30 @@
rtp_transport_->SignalSentPacket.disconnect(this);
}
-void BaseChannel::Init_w(webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport) {
+void BaseChannel::Init_w(
+ webrtc::RtpTransportInternal* rtp_transport,
+ const webrtc::MediaTransportConfig& media_transport_config) {
RTC_DCHECK_RUN_ON(worker_thread_);
- media_transport_ = media_transport;
+ media_transport_config_ = media_transport_config;
network_thread_->Invoke<void>(
RTC_FROM_HERE, [this, rtp_transport] { SetRtpTransport(rtp_transport); });
// Both RTP and RTCP channels should be set, we can call SetInterface on
// the media channel and it can set network options.
- media_channel_->SetInterface(this, media_transport);
+ media_channel_->SetInterface(this, media_transport_config);
- RTC_LOG(LS_INFO) << "BaseChannel::Init_w, media_transport="
- << (media_transport_ != nullptr);
- if (media_transport_) {
- media_transport_->AddNetworkChangeCallback(this);
+ RTC_LOG(LS_INFO) << "BaseChannel::Init_w, media_transport_config="
+ << media_transport_config.DebugString();
+ if (media_transport_config_.media_transport) {
+ media_transport_config_.media_transport->AddNetworkChangeCallback(this);
}
}
void BaseChannel::Deinit() {
RTC_DCHECK(worker_thread_->IsCurrent());
media_channel_->SetInterface(/*iface=*/nullptr,
- /*media_transport=*/nullptr);
+ webrtc::MediaTransportConfig());
// Packets arrive on the network thread, processing packets calls virtual
// functions, so need to stop this process in Deinit that is called in
// derived classes destructor.
@@ -836,11 +838,13 @@
OnNetworkRouteChanged(absl::make_optional(network_route));
}
-void VoiceChannel::Init_w(webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport) {
- BaseChannel::Init_w(rtp_transport, media_transport);
- if (BaseChannel::media_transport()) {
- this->media_transport()->SetFirstAudioPacketReceivedObserver(this);
+void VoiceChannel::Init_w(
+ webrtc::RtpTransportInternal* rtp_transport,
+ const webrtc::MediaTransportConfig& media_transport_config) {
+ BaseChannel::Init_w(rtp_transport, media_transport_config);
+ if (media_transport_config.media_transport) {
+ media_transport_config.media_transport->SetFirstAudioPacketReceivedObserver(
+ this);
}
}
@@ -1125,9 +1129,10 @@
Deinit();
}
-void RtpDataChannel::Init_w(webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport) {
- BaseChannel::Init_w(rtp_transport, /*media_transport=*/nullptr);
+void RtpDataChannel::Init_w(
+ webrtc::RtpTransportInternal* rtp_transport,
+ const webrtc::MediaTransportConfig& media_transport_config) {
+ BaseChannel::Init_w(rtp_transport, media_transport_config);
media_channel()->SignalDataReceived.connect(this,
&RtpDataChannel::OnDataReceived);
media_channel()->SignalReadyToSend.connect(
diff --git a/pc/channel.h b/pc/channel.h
index 9747ec2..9d41419 100644
--- a/pc/channel.h
+++ b/pc/channel.h
@@ -20,7 +20,7 @@
#include "api/call/audio_sink.h"
#include "api/jsep.h"
-#include "api/media_transport_interface.h"
+#include "api/media_transport_config.h"
#include "api/rtp_receiver_interface.h"
#include "api/video/video_sink_interface.h"
#include "api/video/video_source_interface.h"
@@ -92,8 +92,9 @@
webrtc::CryptoOptions crypto_options,
rtc::UniqueRandomIdGenerator* ssrc_generator);
virtual ~BaseChannel();
- virtual void Init_w(webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport);
+ virtual void Init_w(
+ webrtc::RtpTransportInternal* rtp_transport,
+ const webrtc::MediaTransportConfig& media_transport_config);
// Deinit may be called multiple times and is simply ignored if it's already
// done.
@@ -169,7 +170,7 @@
// Returns media transport, can be null if media transport is not available.
webrtc::MediaTransportInterface* media_transport() {
- return media_transport_;
+ return media_transport_config_.media_transport;
}
// From RtpTransport - public for testing only
@@ -322,10 +323,8 @@
webrtc::RtpTransportInternal* rtp_transport_ = nullptr;
- // Optional media transport (experimental).
- // If provided, audio and video will be sent through media_transport instead
- // of RTP/RTCP. Currently media_transport can co-exist with rtp_transport.
- webrtc::MediaTransportInterface* media_transport_ = nullptr;
+ // Optional media transport configuration (experimental).
+ webrtc::MediaTransportConfig media_transport_config_;
std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_;
@@ -379,8 +378,9 @@
cricket::MediaType media_type() const override {
return cricket::MEDIA_TYPE_AUDIO;
}
- void Init_w(webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport) override;
+ void Init_w(
+ webrtc::RtpTransportInternal* rtp_transport,
+ const webrtc::MediaTransportConfig& media_transport_config) override;
private:
// overrides from BaseChannel
@@ -464,7 +464,7 @@
rtc::PacketTransportInternal* rtcp_packet_transport);
void Init_w(
webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport = nullptr) override;
+ const webrtc::MediaTransportConfig& media_transport_config) override;
virtual bool SendData(const SendDataParams& params,
const rtc::CopyOnWriteBuffer& payload,
diff --git a/pc/channel_manager.cc b/pc/channel_manager.cc
index 525dc52..55f5268 100644
--- a/pc/channel_manager.cc
+++ b/pc/channel_manager.cc
@@ -158,7 +158,7 @@
webrtc::Call* call,
const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport,
+ const webrtc::MediaTransportConfig& media_transport_config,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
@@ -167,9 +167,10 @@
const AudioOptions& options) {
if (!worker_thread_->IsCurrent()) {
return worker_thread_->Invoke<VoiceChannel*>(RTC_FROM_HERE, [&] {
- return CreateVoiceChannel(
- call, media_config, rtp_transport, media_transport, signaling_thread,
- content_name, srtp_required, crypto_options, ssrc_generator, options);
+ return CreateVoiceChannel(call, media_config, rtp_transport,
+ media_transport_config, signaling_thread,
+ content_name, srtp_required, crypto_options,
+ ssrc_generator, options);
});
}
@@ -191,7 +192,7 @@
absl::WrapUnique(media_channel), content_name, srtp_required,
crypto_options, ssrc_generator);
- voice_channel->Init_w(rtp_transport, media_transport);
+ voice_channel->Init_w(rtp_transport, media_transport_config);
VoiceChannel* voice_channel_ptr = voice_channel.get();
voice_channels_.push_back(std::move(voice_channel));
@@ -227,7 +228,7 @@
webrtc::Call* call,
const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport,
+ const webrtc::MediaTransportConfig& media_transport_config,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
@@ -237,10 +238,10 @@
webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory) {
if (!worker_thread_->IsCurrent()) {
return worker_thread_->Invoke<VideoChannel*>(RTC_FROM_HERE, [&] {
- return CreateVideoChannel(call, media_config, rtp_transport,
- media_transport, signaling_thread, content_name,
- srtp_required, crypto_options, ssrc_generator,
- options, video_bitrate_allocator_factory);
+ return CreateVideoChannel(
+ call, media_config, rtp_transport, media_transport_config,
+ signaling_thread, content_name, srtp_required, crypto_options,
+ ssrc_generator, options, video_bitrate_allocator_factory);
});
}
@@ -263,7 +264,7 @@
absl::WrapUnique(media_channel), content_name, srtp_required,
crypto_options, ssrc_generator);
- video_channel->Init_w(rtp_transport, media_transport);
+ video_channel->Init_w(rtp_transport, media_transport_config);
VideoChannel* video_channel_ptr = video_channel.get();
video_channels_.push_back(std::move(video_channel));
@@ -323,7 +324,9 @@
worker_thread_, network_thread_, signaling_thread,
absl::WrapUnique(media_channel), content_name, srtp_required,
crypto_options, ssrc_generator);
- data_channel->Init_w(rtp_transport);
+
+ // Media Transports are not supported with Rtp Data Channel.
+ data_channel->Init_w(rtp_transport, webrtc::MediaTransportConfig());
RtpDataChannel* data_channel_ptr = data_channel.get();
data_channels_.push_back(std::move(data_channel));
diff --git a/pc/channel_manager.h b/pc/channel_manager.h
index a749b7f..34f9013 100644
--- a/pc/channel_manager.h
+++ b/pc/channel_manager.h
@@ -12,13 +12,14 @@
#define PC_CHANNEL_MANAGER_H_
#include <stdint.h>
+
#include <memory>
#include <string>
#include <vector>
#include "api/audio_options.h"
#include "api/crypto/crypto_options.h"
-#include "api/media_transport_interface.h"
+#include "api/media_transport_config.h"
#include "call/call.h"
#include "media/base/codec.h"
#include "media/base/media_channel.h"
@@ -95,7 +96,7 @@
webrtc::Call* call,
const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport,
+ const webrtc::MediaTransportConfig& media_transport_config,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
@@ -112,7 +113,7 @@
webrtc::Call* call,
const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport,
+ const webrtc::MediaTransportConfig& media_transport_config,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
diff --git a/pc/channel_manager_unittest.cc b/pc/channel_manager_unittest.cc
index 6410319..91cd0c7 100644
--- a/pc/channel_manager_unittest.cc
+++ b/pc/channel_manager_unittest.cc
@@ -8,9 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "pc/channel_manager.h"
+
#include <memory>
#include "absl/memory/memory.h"
+#include "api/media_transport_config.h"
#include "api/rtc_error.h"
#include "api/test/fake_media_transport.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
@@ -21,7 +24,6 @@
#include "p2p/base/fake_dtls_transport.h"
#include "p2p/base/p2p_constants.h"
#include "p2p/base/packet_transport_internal.h"
-#include "pc/channel_manager.h"
#include "pc/dtls_srtp_transport.h"
#include "rtc_base/checks.h"
#include "rtc_base/thread.h"
@@ -84,17 +86,18 @@
void TestCreateDestroyChannels(
webrtc::RtpTransportInternal* rtp_transport,
- webrtc::MediaTransportInterface* media_transport) {
+ webrtc::MediaTransportConfig media_transport_config) {
cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel(
- &fake_call_, cricket::MediaConfig(), rtp_transport, media_transport,
- rtc::Thread::Current(), cricket::CN_AUDIO, kDefaultSrtpRequired,
- webrtc::CryptoOptions(), &ssrc_generator_, AudioOptions());
+ &fake_call_, cricket::MediaConfig(), rtp_transport,
+ media_transport_config, rtc::Thread::Current(), cricket::CN_AUDIO,
+ kDefaultSrtpRequired, webrtc::CryptoOptions(), &ssrc_generator_,
+ AudioOptions());
EXPECT_TRUE(voice_channel != nullptr);
cricket::VideoChannel* video_channel = cm_->CreateVideoChannel(
- &fake_call_, cricket::MediaConfig(), rtp_transport, media_transport,
- rtc::Thread::Current(), cricket::CN_VIDEO, kDefaultSrtpRequired,
- webrtc::CryptoOptions(), &ssrc_generator_, VideoOptions(),
- video_bitrate_allocator_factory_.get());
+ &fake_call_, cricket::MediaConfig(), rtp_transport,
+ media_transport_config, rtc::Thread::Current(), cricket::CN_VIDEO,
+ kDefaultSrtpRequired, webrtc::CryptoOptions(), &ssrc_generator_,
+ VideoOptions(), video_bitrate_allocator_factory_.get());
EXPECT_TRUE(video_channel != nullptr);
cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel(
cricket::MediaConfig(), rtp_transport, rtc::Thread::Current(),
@@ -183,7 +186,8 @@
TEST_F(ChannelManagerTest, CreateDestroyChannels) {
EXPECT_TRUE(cm_->Init());
auto rtp_transport = CreateDtlsSrtpTransport();
- TestCreateDestroyChannels(rtp_transport.get(), /*media_transport=*/nullptr);
+ TestCreateDestroyChannels(rtp_transport.get(),
+ webrtc::MediaTransportConfig());
}
TEST_F(ChannelManagerTest, CreateDestroyChannelsWithMediaTransport) {
@@ -191,7 +195,8 @@
auto rtp_transport = CreateDtlsSrtpTransport();
auto media_transport =
CreateMediaTransport(rtp_transport->rtcp_packet_transport());
- TestCreateDestroyChannels(rtp_transport.get(), media_transport.get());
+ TestCreateDestroyChannels(
+ rtp_transport.get(), webrtc::MediaTransportConfig(media_transport.get()));
}
TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) {
@@ -201,7 +206,8 @@
EXPECT_TRUE(cm_->set_network_thread(network_.get()));
EXPECT_TRUE(cm_->Init());
auto rtp_transport = CreateDtlsSrtpTransport();
- TestCreateDestroyChannels(rtp_transport.get(), /*media_transport=*/nullptr);
+ TestCreateDestroyChannels(rtp_transport.get(),
+ webrtc::MediaTransportConfig());
}
} // namespace cricket
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc
index e31ab53..4a64f7a 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "pc/channel.h"
+
#include <cstdint>
#include <memory>
#include <utility>
@@ -15,6 +17,7 @@
#include "absl/memory/memory.h"
#include "api/array_view.h"
#include "api/audio_options.h"
+#include "api/media_transport_config.h"
#include "api/rtp_parameters.h"
#include "media/base/codec.h"
#include "media/base/fake_media_engine.h"
@@ -25,7 +28,6 @@
#include "p2p/base/fake_packet_transport.h"
#include "p2p/base/ice_transport_internal.h"
#include "p2p/base/p2p_constants.h"
-#include "pc/channel.h"
#include "pc/dtls_srtp_transport.h"
#include "pc/jsep_transport.h"
#include "pc/rtp_transport.h"
@@ -263,7 +265,7 @@
worker_thread, network_thread, signaling_thread, std::move(ch),
cricket::CN_AUDIO, (flags & DTLS) != 0, webrtc::CryptoOptions(),
&ssrc_generator_);
- channel->Init_w(rtp_transport, /*media_transport=*/nullptr);
+ channel->Init_w(rtp_transport, webrtc::MediaTransportConfig());
return channel;
}
@@ -1626,7 +1628,7 @@
worker_thread, network_thread, signaling_thread, std::move(ch),
cricket::CN_VIDEO, (flags & DTLS) != 0, webrtc::CryptoOptions(),
&ssrc_generator_);
- channel->Init_w(rtp_transport, /*media_transport=*/nullptr);
+ channel->Init_w(rtp_transport, webrtc::MediaTransportConfig());
return channel;
}
@@ -2299,7 +2301,7 @@
worker_thread, network_thread, signaling_thread, std::move(ch),
cricket::CN_DATA, (flags & DTLS) != 0, webrtc::CryptoOptions(),
&ssrc_generator_);
- channel->Init_w(rtp_transport);
+ channel->Init_w(rtp_transport, webrtc::MediaTransportConfig());
return channel;
}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index 9902d84..deaff5d 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -6290,9 +6290,9 @@
}
cricket::VoiceChannel* voice_channel = channel_manager()->CreateVoiceChannel(
- call_ptr_, configuration_.media_config, rtp_transport, media_transport,
- signaling_thread(), mid, SrtpRequired(), GetCryptoOptions(),
- &ssrc_generator_, audio_options_);
+ call_ptr_, configuration_.media_config, rtp_transport,
+ MediaTransportConfig(media_transport), signaling_thread(), mid,
+ SrtpRequired(), GetCryptoOptions(), &ssrc_generator_, audio_options_);
if (!voice_channel) {
return nullptr;
}
@@ -6315,9 +6315,10 @@
}
cricket::VideoChannel* video_channel = channel_manager()->CreateVideoChannel(
- call_ptr_, configuration_.media_config, rtp_transport, media_transport,
- signaling_thread(), mid, SrtpRequired(), GetCryptoOptions(),
- &ssrc_generator_, video_options_, video_bitrate_allocator_factory_.get());
+ call_ptr_, configuration_.media_config, rtp_transport,
+ MediaTransportConfig(media_transport), signaling_thread(), mid,
+ SrtpRequired(), GetCryptoOptions(), &ssrc_generator_, video_options_,
+ video_bitrate_allocator_factory_.get());
if (!video_channel) {
return nullptr;
}
diff --git a/pc/rtp_sender_receiver_unittest.cc b/pc/rtp_sender_receiver_unittest.cc
index d602a1d..a303d6f 100644
--- a/pc/rtp_sender_receiver_unittest.cc
+++ b/pc/rtp_sender_receiver_unittest.cc
@@ -122,12 +122,12 @@
voice_channel_ = channel_manager_.CreateVoiceChannel(
&fake_call_, cricket::MediaConfig(), rtp_transport_.get(),
- /*media_transport=*/nullptr, rtc::Thread::Current(), cricket::CN_AUDIO,
+ MediaTransportConfig(), rtc::Thread::Current(), cricket::CN_AUDIO,
srtp_required, webrtc::CryptoOptions(), &ssrc_generator_,
cricket::AudioOptions());
video_channel_ = channel_manager_.CreateVideoChannel(
&fake_call_, cricket::MediaConfig(), rtp_transport_.get(),
- /*media_transport=*/nullptr, rtc::Thread::Current(), cricket::CN_VIDEO,
+ MediaTransportConfig(), rtc::Thread::Current(), cricket::CN_VIDEO,
srtp_required, webrtc::CryptoOptions(), &ssrc_generator_,
cricket::VideoOptions(), video_bitrate_allocator_factory_.get());
voice_channel_->Enable(true);
diff --git a/test/call_test.cc b/test/call_test.cc
index 52d3b23..ffb7305 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -34,8 +34,7 @@
task_queue_factory_(CreateDefaultTaskQueueFactory()),
send_event_log_(RtcEventLog::CreateNull()),
recv_event_log_(RtcEventLog::CreateNull()),
- audio_send_config_(/*send_transport=*/nullptr,
- /*media_transport=*/nullptr),
+ audio_send_config_(/*send_transport=*/nullptr, MediaTransportConfig()),
audio_send_stream_(nullptr),
frame_generator_capturer_(nullptr),
fake_encoder_factory_([this]() {
@@ -273,7 +272,7 @@
RTC_DCHECK_LE(num_flexfec_streams, 1);
if (num_audio_streams > 0) {
AudioSendStream::Config audio_send_config(send_transport,
- /*media_transport=*/nullptr);
+ MediaTransportConfig());
audio_send_config.rtp.ssrc = kAudioSendSsrc;
audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
kAudioSendPayloadType, {"opus", 48000, 2, {{"stereo", "1"}}});
diff --git a/test/scenario/audio_stream.cc b/test/scenario/audio_stream.cc
index c93b949..d9f0dd9 100644
--- a/test/scenario/audio_stream.cc
+++ b/test/scenario/audio_stream.cc
@@ -70,7 +70,7 @@
Transport* send_transport)
: sender_(sender), config_(config) {
AudioSendStream::Config send_config(send_transport,
- /*media_transport=*/nullptr);
+ webrtc::MediaTransportConfig());
ssrc_ = sender->GetNextAudioSsrc();
send_config.rtp.ssrc = ssrc_;
SdpAudioFormat::Parameters sdp_params;
diff --git a/video/BUILD.gn b/video/BUILD.gn
index 37b8917..32e0966 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -247,6 +247,7 @@
deps = [
":frame_dumping_decoder",
"../api:fec_controller_api",
+ "../api:libjingle_peerconnection_api",
"../api:rtc_event_log_output_file",
"../api:test_dependency_factory",
"../api:video_quality_test_fixture_api",
diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc
index 525650e..be29714 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -17,6 +17,7 @@
#include <vector>
#include "absl/memory/memory.h"
+#include "api/media_transport_config.h"
#include "api/rtc_event_log_output_file.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
@@ -1380,7 +1381,7 @@
void VideoQualityTest::SetupAudio(Transport* transport) {
AudioSendStream::Config audio_send_config(transport,
- /*media_transport=*/nullptr);
+ webrtc::MediaTransportConfig());
audio_send_config.rtp.ssrc = kAudioSendSsrc;
// Add extension to enable audio send side BWE, and allow audio bit rate
diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc
index b7ddfb6..20a1967 100644
--- a/video/video_receive_stream.cc
+++ b/video/video_receive_stream.cc
@@ -244,10 +244,9 @@
new video_coding::FrameBuffer(clock_, timing_.get(), &stats_proxy_));
process_thread_->RegisterModule(&rtp_stream_sync_, RTC_FROM_HERE);
-
- if (config_.media_transport) {
- config_.media_transport->SetReceiveVideoSink(this);
- config_.media_transport->AddRttObserver(this);
+ if (config_.media_transport()) {
+ config_.media_transport()->SetReceiveVideoSink(this);
+ config_.media_transport()->AddRttObserver(this);
} else {
// Register with RtpStreamReceiverController.
media_receiver_ = receiver_controller->CreateReceiver(
@@ -288,9 +287,9 @@
RTC_DCHECK_RUN_ON(&worker_sequence_checker_);
RTC_LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString();
Stop();
- if (config_.media_transport) {
- config_.media_transport->SetReceiveVideoSink(nullptr);
- config_.media_transport->RemoveRttObserver(this);
+ if (config_.media_transport()) {
+ config_.media_transport()->SetReceiveVideoSink(nullptr);
+ config_.media_transport()->RemoveRttObserver(this);
}
process_thread_->DeRegisterModule(&rtp_stream_sync_);
}
@@ -512,8 +511,8 @@
}
void VideoReceiveStream::RequestKeyFrame() {
- if (config_.media_transport) {
- config_.media_transport->RequestKeyFrame(config_.rtp.remote_ssrc);
+ if (config_.media_transport()) {
+ config_.media_transport()->RequestKeyFrame(config_.rtp.remote_ssrc);
} else {
rtp_video_stream_receiver_.RequestKeyFrame();
}