Datagram Transport Integration

- Implement datagram transport adaptor, which wraps datagram transport in DtlsTransportInternal. Datagram adaptor owns both ICE and Datagram Transports.
- Implement setup of datagram transport based on RTCConfiguration flag use_datagram_transport. This is very similar to MediaTransport setup with the exception that we create DTLS datagram adaptor.
- Propagate maximum datagram size to video encoder via MediaTransportConfig.

TODO: Currently this CL can only be tested in downstream projects. Once we add fake datagram transport, we will be able to implement unit tests similar to loopback media transport.

Bug: webrtc:9719
Change-Id: I4fa4a5725598dfee5da4f0f374269a7e289d48ed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138100
Commit-Queue: Anton Sukhanov <sukhanov@webrtc.org>
Reviewed-by: Bjorn Mellem <mellem@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28047}
This commit is contained in:
Anton Sukhanov
2019-05-23 15:50:38 -07:00
committed by Commit Bot
parent c1c0d6d8ad
commit 316f3ac13b
17 changed files with 917 additions and 98 deletions

View File

@ -10,11 +10,30 @@
#include "api/media_transport_config.h"
#include "rtc_base/checks.h"
#include "rtc_base/string_utils.h"
#include "rtc_base/strings/string_builder.h"
namespace webrtc {
std::string MediaTransportConfig::DebugString() const {
return (media_transport != nullptr ? "{media_transport: (Transport)}"
: "{media_transport: null}");
MediaTransportConfig::MediaTransportConfig(
MediaTransportInterface* media_transport)
: media_transport(media_transport) {
RTC_DCHECK(media_transport != nullptr);
}
MediaTransportConfig::MediaTransportConfig(size_t rtp_max_packet_size)
: rtp_max_packet_size(rtp_max_packet_size) {
RTC_DCHECK_GT(rtp_max_packet_size, 0);
}
std::string MediaTransportConfig::DebugString()
const { // TODO(sukhanov): Add rtp_max_packet_size (requires fixing
// audio_send/receive_stream_unittest.cc).
rtc::StringBuilder result;
result << "{media_transport: "
<< (media_transport != nullptr ? "(Transport)" : "null") << "}";
return result.Release();
}
} // namespace webrtc

View File

@ -13,28 +13,33 @@
#include <string>
#include <utility>
#include "absl/types/optional.h"
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.
// Media transport config is made available to both transport and audio / video
// layers, but access to individual interfaces should not be open without
// necessity.
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) {}
// Constructor for media transport scenarios.
// Note that |media_transport| may not be nullptr.
explicit MediaTransportConfig(MediaTransportInterface* media_transport);
// Constructor for datagram transport scenarios.
explicit MediaTransportConfig(size_t rtp_max_packet_size);
std::string DebugString() const;
// If provided, all media is sent through media_transport.
MediaTransportInterface* media_transport = nullptr;
// If provided, limits RTP packet size (excludes ICE, IP or network overhead).
absl::optional<size_t> rtp_max_packet_size;
};
} // namespace webrtc