Remove most of api/ortc/.

It's not currently used or maintained, so it shouldn't be a part of out API.

Bug: webrtc:9824
Change-Id: Ic44c5ea3a9eab8fb75e87a5005cbf6cdd4b1d4ad
Reviewed-on: https://webrtc-review.googlesource.com/c/107645
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25593}
This commit is contained in:
Jonas Olsson
2018-11-12 10:12:47 +01:00
committed by Commit Bot
parent 8584667583
commit cfe3b6afd9
16 changed files with 13 additions and 710 deletions

View File

@ -209,34 +209,16 @@ rtc_source_set("libjingle_logging_api") {
rtc_source_set("ortc_api") {
visibility = [ "*" ]
sources = [
"ortc/mediadescription.cc",
"ortc/mediadescription.h",
"ortc/ortcfactoryinterface.h",
"ortc/ortcrtpreceiverinterface.h",
"ortc/ortcrtpsenderinterface.h",
"ortc/packettransportinterface.h",
"ortc/rtptransportcontrollerinterface.h",
"ortc/rtptransportinterface.h",
"ortc/sessiondescription.cc",
"ortc/sessiondescription.h",
"ortc/srtptransportinterface.h",
"ortc/udptransportinterface.h",
]
# For mediastreaminterface.h, etc.
# TODO(deadbeef): Create a separate target for the common things ORTC and
# PeerConnection code shares, so that ortc_api can depend on that instead of
# libjingle_peerconnection_api.
deps = [
":libjingle_peerconnection_api",
"..:webrtc_common",
"../rtc_base:rtc_base",
"//third_party/abseil-cpp/absl/types:optional",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("rtc_stats_api") {
@ -633,8 +615,6 @@ if (rtc_include_tests) {
sources = [
"array_view_unittest.cc",
"ortc/mediadescription_unittest.cc",
"ortc/sessiondescription_unittest.cc",
"rtcerror_unittest.cc",
"rtpparameters_unittest.cc",
"test/loopback_media_transport_unittest.cc",
@ -649,7 +629,6 @@ if (rtc_include_tests) {
":array_view",
":libjingle_peerconnection_api",
":loopback_media_transport",
":ortc_api",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_base_tests_utils",

View File

@ -1,13 +0,0 @@
/*
* Copyright 2017 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/ortc/mediadescription.h"
namespace webrtc {}

View File

@ -1,53 +0,0 @@
/*
* Copyright 2017 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_ORTC_MEDIADESCRIPTION_H_
#define API_ORTC_MEDIADESCRIPTION_H_
#include <string>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/cryptoparams.h"
namespace webrtc {
// A structured representation of a media description within an SDP session
// description.
class MediaDescription {
public:
explicit MediaDescription(std::string mid) : mid_(std::move(mid)) {}
~MediaDescription() {}
// The mid(media stream identification) is used for identifying media streams
// within a session description.
// https://tools.ietf.org/html/rfc5888#section-6
absl::optional<std::string> mid() const { return mid_; }
void set_mid(std::string mid) { mid_.emplace(std::move(mid)); }
// Security keys and parameters for this media stream. Can be used to
// negotiate parameters for SRTP.
// https://tools.ietf.org/html/rfc4568#page-5
std::vector<cricket::CryptoParams>& sdes_params() { return sdes_params_; }
const std::vector<cricket::CryptoParams>& sdes_params() const {
return sdes_params_;
}
private:
absl::optional<std::string> mid_;
std::vector<cricket::CryptoParams> sdes_params_;
};
} // namespace webrtc
#endif // API_ORTC_MEDIADESCRIPTION_H_

View File

@ -1,30 +0,0 @@
/*
* Copyright 2017 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/ortc/mediadescription.h"
#include "test/gtest.h"
namespace webrtc {
class MediaDescriptionTest : public testing::Test {};
TEST_F(MediaDescriptionTest, CreateMediaDescription) {
MediaDescription m("a");
EXPECT_EQ("a", m.mid());
}
TEST_F(MediaDescriptionTest, AddSdesParam) {
MediaDescription m("a");
m.sdes_params().push_back(cricket::CryptoParams());
const std::vector<cricket::CryptoParams>& params = m.sdes_params();
EXPECT_EQ(1u, params.size());
}
} // namespace webrtc

View File

@ -1,232 +0,0 @@
/*
* Copyright 2017 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_ORTC_ORTCFACTORYINTERFACE_H_
#define API_ORTC_ORTCFACTORYINTERFACE_H_
#include <memory>
#include <string>
#include <utility> // For std::move.
#include "api/mediastreaminterface.h"
#include "api/mediatypes.h"
#include "api/ortc/ortcrtpreceiverinterface.h"
#include "api/ortc/ortcrtpsenderinterface.h"
#include "api/ortc/packettransportinterface.h"
#include "api/ortc/rtptransportcontrollerinterface.h"
#include "api/ortc/rtptransportinterface.h"
#include "api/ortc/srtptransportinterface.h"
#include "api/ortc/udptransportinterface.h"
#include "api/peerconnectioninterface.h"
#include "api/rtcerror.h"
#include "api/rtpparameters.h"
#include "rtc_base/network.h"
#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/thread.h"
namespace webrtc {
// TODO(deadbeef): This should be part of /api/, but currently it's not and
// including its header violates checkdeps rules.
class AudioDeviceModule;
// WARNING: This is experimental/under development, so use at your own risk; no
// guarantee about API stability is guaranteed here yet.
//
// This class is the ORTC analog of PeerConnectionFactory. It acts as a factory
// for ORTC objects that can be connected to each other.
//
// Some of these objects may not be represented by the ORTC specification, but
// follow the same general principles.
//
// If one of the factory methods takes another object as an argument, it MUST
// have been created by the same OrtcFactory.
//
// On object lifetimes: objects should be destroyed in this order:
// 1. Objects created by the factory.
// 2. The factory itself.
// 3. Objects passed into OrtcFactoryInterface::Create.
class OrtcFactoryInterface {
public:
// |network_thread| is the thread on which packets are sent and received.
// If null, a new rtc::Thread with a default socket server is created.
//
// |signaling_thread| is used for callbacks to the consumer of the API. If
// null, the current thread will be used, which assumes that the API consumer
// is running a message loop on this thread (either using an existing
// rtc::Thread, or by calling rtc::Thread::Current()->ProcessMessages).
//
// |network_manager| is used to determine which network interfaces are
// available. This is used for ICE, for example. If null, a default
// implementation will be used. Only accessed on |network_thread|.
//
// |socket_factory| is used (on the network thread) for creating sockets. If
// it's null, a default implementation will be used, which assumes
// |network_thread| is a normal rtc::Thread.
//
// |adm| is optional, and allows a different audio device implementation to
// be injected; otherwise a platform-specific module will be used that will
// use the default audio input.
//
// |audio_encoder_factory| and |audio_decoder_factory| are used to
// instantiate audio codecs; they determine what codecs are supported.
//
// Note that the OrtcFactoryInterface does not take ownership of any of the
// objects passed in by raw pointer, and as previously stated, these objects
// can't be destroyed before the factory is.
static RTCErrorOr<std::unique_ptr<OrtcFactoryInterface>> Create(
rtc::Thread* network_thread,
rtc::Thread* signaling_thread,
rtc::NetworkManager* network_manager,
rtc::PacketSocketFactory* socket_factory,
AudioDeviceModule* adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory);
// Constructor for convenience which uses default implementations where
// possible (though does still require that the current thread runs a message
// loop; see above).
static RTCErrorOr<std::unique_ptr<OrtcFactoryInterface>> Create(
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory) {
return Create(nullptr, nullptr, nullptr, nullptr, nullptr,
audio_encoder_factory, audio_decoder_factory);
}
virtual ~OrtcFactoryInterface() {}
// Creates an RTP transport controller, which is used in calls to
// CreateRtpTransport methods. If your application has some notion of a
// "call", you should create one transport controller per call.
//
// However, if you only are using one RtpTransport object, this doesn't need
// to be called explicitly; CreateRtpTransport will create one automatically
// if |rtp_transport_controller| is null. See below.
//
// TODO(deadbeef): Add MediaConfig and RtcEventLog arguments?
virtual RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>>
CreateRtpTransportController() = 0;
// Creates an RTP transport using the provided packet transports and
// transport controller.
//
// |rtp| will be used for sending RTP packets, and |rtcp| for RTCP packets.
//
// |rtp| can't be null. |rtcp| must be non-null if and only if
// |rtp_parameters.rtcp.mux| is false, indicating that RTCP muxing isn't used.
// Note that if RTCP muxing isn't enabled initially, it can still enabled
// later through SetParameters.
//
// If |transport_controller| is null, one will automatically be created, and
// its lifetime managed by the returned RtpTransport. This should only be
// done if a single RtpTransport is being used to communicate with the remote
// endpoint.
virtual RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateRtpTransport(
const RtpTransportParameters& rtp_parameters,
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp,
RtpTransportControllerInterface* transport_controller) = 0;
// Creates an SrtpTransport which is an RTP transport that uses SRTP.
virtual RTCErrorOr<std::unique_ptr<SrtpTransportInterface>>
CreateSrtpTransport(
const RtpTransportParameters& rtp_parameters,
PacketTransportInterface* rtp,
PacketTransportInterface* rtcp,
RtpTransportControllerInterface* transport_controller) = 0;
// Returns the capabilities of an RTP sender of type |kind|. These
// capabilities can be used to determine what RtpParameters to use to create
// an RtpSender.
//
// If for some reason you pass in MEDIA_TYPE_DATA, returns an empty structure.
virtual RtpCapabilities GetRtpSenderCapabilities(
cricket::MediaType kind) const = 0;
// Creates an RTP sender with |track|. Will not start sending until Send is
// called. This is provided as a convenience; it's equivalent to calling
// CreateRtpSender with a kind (see below), followed by SetTrack.
//
// |track| and |transport| must not be null.
virtual RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender(
rtc::scoped_refptr<MediaStreamTrackInterface> track,
RtpTransportInterface* transport) = 0;
// Overload of CreateRtpSender allows creating the sender without a track.
//
// |kind| must be MEDIA_TYPE_AUDIO or MEDIA_TYPE_VIDEO.
virtual RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender(
cricket::MediaType kind,
RtpTransportInterface* transport) = 0;
// Returns the capabilities of an RTP receiver of type |kind|. These
// capabilities can be used to determine what RtpParameters to use to create
// an RtpReceiver.
//
// If for some reason you pass in MEDIA_TYPE_DATA, returns an empty structure.
virtual RtpCapabilities GetRtpReceiverCapabilities(
cricket::MediaType kind) const = 0;
// Creates an RTP receiver of type |kind|. Will not start receiving media
// until Receive is called.
//
// |kind| must be MEDIA_TYPE_AUDIO or MEDIA_TYPE_VIDEO.
//
// |transport| must not be null.
virtual RTCErrorOr<std::unique_ptr<OrtcRtpReceiverInterface>>
CreateRtpReceiver(cricket::MediaType kind,
RtpTransportInterface* transport) = 0;
// Create a UDP transport with IP address family |family|, using a port
// within the specified range.
//
// |family| must be AF_INET or AF_INET6.
//
// |min_port|/|max_port| values of 0 indicate no range restriction.
//
// Returns an error if the transport wasn't successfully created.
virtual RTCErrorOr<std::unique_ptr<UdpTransportInterface>>
CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) = 0;
// Method for convenience that has no port range restrictions.
RTCErrorOr<std::unique_ptr<UdpTransportInterface>> CreateUdpTransport(
int family) {
return CreateUdpTransport(family, 0, 0);
}
// NOTE: The methods below to create tracks/sources return scoped_refptrs
// rather than unique_ptrs, because these interfaces are also used with
// PeerConnection, where everything is ref-counted.
// Creates a audio source representing the default microphone input.
// |options| decides audio processing settings.
virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
const cricket::AudioOptions& options) = 0;
// Version of the above method that uses default options.
rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource() {
return CreateAudioSource(cricket::AudioOptions());
}
// Creates a new local video track wrapping |source|. The same |source| can
// be used in several tracks.
virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
const std::string& id,
VideoTrackSourceInterface* source) = 0;
// Creates an new local audio track wrapping |source|.
virtual rtc::scoped_refptr<AudioTrackInterface> CreateAudioTrack(
const std::string& id,
AudioSourceInterface* source) = 0;
};
} // namespace webrtc
#endif // API_ORTC_ORTCFACTORYINTERFACE_H_

View File

@ -1,84 +0,0 @@
/*
* Copyright 2017 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.
*/
// This file contains interfaces for RtpReceivers:
// http://publications.ortc.org/2016/20161202/#rtcrtpreceiver*
//
// However, underneath the RtpReceiver is an RtpTransport, rather than a
// DtlsTransport. This is to allow different types of RTP transports (besides
// DTLS-SRTP) to be used.
#ifndef API_ORTC_ORTCRTPRECEIVERINTERFACE_H_
#define API_ORTC_ORTCRTPRECEIVERINTERFACE_H_
#include "api/mediastreaminterface.h"
#include "api/mediatypes.h"
#include "api/ortc/rtptransportinterface.h"
#include "api/rtcerror.h"
#include "api/rtpparameters.h"
namespace webrtc {
// Note: Since receiver capabilities may depend on how the OrtcFactory was
// created, instead of a static "GetCapabilities" method on this interface,
// there is a "GetRtpReceiverCapabilities" method on the OrtcFactory.
class OrtcRtpReceiverInterface {
public:
virtual ~OrtcRtpReceiverInterface() {}
// Returns a track representing the media received by this receiver.
//
// Currently, this will return null until Receive has been successfully
// called. Also, a new track will be created every time the primary SSRC
// changes.
//
// If encodings are removed, GetTrack will return null. Though deactivating
// an encoding (setting |active| to false) will not do this.
//
// In the future, these limitations will be fixed, and GetTrack will return
// the same track for the lifetime of the RtpReceiver. So it's not
// recommended to write code that depends on this non-standard behavior.
virtual rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const = 0;
// Once supported, will switch to receiving media on a new transport.
// However, this is not currently supported and will always return an error.
virtual RTCError SetTransport(RtpTransportInterface* transport) = 0;
// Returns previously set (or constructed-with) transport.
virtual RtpTransportInterface* GetTransport() const = 0;
// Start receiving media with |parameters| (if |parameters| contains an
// active encoding).
//
// There are no limitations to how the parameters can be changed after the
// initial call to Receive, as long as they're valid (for example, they can't
// use the same payload type for two codecs).
virtual RTCError Receive(const RtpParameters& parameters) = 0;
// Returns parameters that were last successfully passed into Receive, or
// empty parameters if that hasn't yet occurred.
//
// Note that for parameters that are described as having an "implementation
// default" value chosen, GetParameters() will return those chosen defaults,
// with the exception of SSRCs which have special behavior. See
// rtpparameters.h for more details.
virtual RtpParameters GetParameters() const = 0;
// Audio or video receiver?
//
// Once GetTrack() starts always returning a track, this method will be
// redundant, as one can call "GetTrack()->kind()". However, it's still a
// nice convenience, and is symmetric with OrtcRtpSenderInterface::GetKind.
virtual cricket::MediaType GetKind() const = 0;
// TODO(deadbeef): GetContributingSources
};
} // namespace webrtc
#endif // API_ORTC_ORTCRTPRECEIVERINTERFACE_H_

View File

@ -1,77 +0,0 @@
/*
* Copyright 2017 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.
*/
// This file contains interfaces for RtpSenders:
// http://publications.ortc.org/2016/20161202/#rtcrtpsender*
//
// However, underneath the RtpSender is an RtpTransport, rather than a
// DtlsTransport. This is to allow different types of RTP transports (besides
// DTLS-SRTP) to be used.
#ifndef API_ORTC_ORTCRTPSENDERINTERFACE_H_
#define API_ORTC_ORTCRTPSENDERINTERFACE_H_
#include "api/mediastreaminterface.h"
#include "api/mediatypes.h"
#include "api/ortc/rtptransportinterface.h"
#include "api/rtcerror.h"
#include "api/rtpparameters.h"
namespace webrtc {
// Note: Since sender capabilities may depend on how the OrtcFactory was
// created, instead of a static "GetCapabilities" method on this interface,
// there is a "GetRtpSenderCapabilities" method on the OrtcFactory.
class OrtcRtpSenderInterface {
public:
virtual ~OrtcRtpSenderInterface() {}
// Sets the source of media that will be sent by this sender.
//
// If Send has already been called, will immediately switch to sending this
// track. If |track| is null, will stop sending media.
//
// Returns INVALID_PARAMETER error if an audio track is set on a video
// RtpSender, or vice-versa.
virtual RTCError SetTrack(MediaStreamTrackInterface* track) = 0;
// Returns previously set (or constructed-with) track.
virtual rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const = 0;
// Once supported, will switch to sending media on a new transport. However,
// this is not currently supported and will always return an error.
virtual RTCError SetTransport(RtpTransportInterface* transport) = 0;
// Returns previously set (or constructed-with) transport.
virtual RtpTransportInterface* GetTransport() const = 0;
// Start sending media with |parameters| (if |parameters| contains an active
// encoding).
//
// There are no limitations to how the parameters can be changed after the
// initial call to Send, as long as they're valid (for example, they can't
// use the same payload type for two codecs).
virtual RTCError Send(const RtpParameters& parameters) = 0;
// Returns parameters that were last successfully passed into Send, or empty
// parameters if that hasn't yet occurred.
//
// Note that for parameters that are described as having an "implementation
// default" value chosen, GetParameters() will return those chosen defaults,
// with the exception of SSRCs which have special behavior. See
// rtpparameters.h for more details.
virtual RtpParameters GetParameters() const = 0;
// Audio or video sender?
virtual cricket::MediaType GetKind() const = 0;
// TODO(deadbeef): SSRC conflict signal.
};
} // namespace webrtc
#endif // API_ORTC_ORTCRTPSENDERINTERFACE_H_

View File

@ -1,57 +0,0 @@
/*
* Copyright 2017 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_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_
#define API_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_
#include <vector>
#include "api/ortc/rtptransportinterface.h"
namespace webrtc {
class RtpTransportControllerAdapter;
// Used to group RTP transports between a local endpoint and the same remote
// endpoint, for the purpose of sharing bandwidth estimation and other things.
//
// Comparing this to the PeerConnection model, non-budled audio/video would use
// two RtpTransports with a single RtpTransportController, whereas bundled
// media would use a single RtpTransport, and two PeerConnections would use
// independent RtpTransportControllers.
//
// RtpTransports are associated with this controller when they're created, by
// passing the controller into OrtcFactory's relevant "CreateRtpTransport"
// method. When a transport is destroyed, it's automatically disassociated.
// GetTransports returns all currently associated transports.
//
// This is the RTP equivalent of "IceTransportController" in ORTC; RtpTransport
// is to RtpTransportController as IceTransport is to IceTransportController.
class RtpTransportControllerInterface {
public:
virtual ~RtpTransportControllerInterface() {}
// Returns all transports associated with this controller (see explanation
// above). No ordering is guaranteed.
virtual std::vector<RtpTransportInterface*> GetTransports() const = 0;
protected:
// Only for internal use. Returns a pointer to an internal interface, for use
// by the implementation.
virtual RtpTransportControllerAdapter* GetInternal() = 0;
// Classes that can use this internal interface.
friend class OrtcFactory;
friend class RtpTransportAdapter;
};
} // namespace webrtc
#endif // API_ORTC_RTPTRANSPORTCONTROLLERINTERFACE_H_

View File

@ -1,13 +0,0 @@
/*
* Copyright 2017 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/ortc/sessiondescription.h"
namespace webrtc {}

View File

@ -1,45 +0,0 @@
/*
* Copyright 2017 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_ORTC_SESSIONDESCRIPTION_H_
#define API_ORTC_SESSIONDESCRIPTION_H_
#include <string>
#include <utility>
namespace webrtc {
// A structured representation of an SDP session description.
class SessionDescription {
public:
SessionDescription(int64_t session_id, std::string session_version)
: session_id_(session_id), session_version_(std::move(session_version)) {}
// https://tools.ietf.org/html/rfc4566#section-5.2
// o=<username> <sess-id> <sess-version> <nettype> <addrtype>
// <unicast-address>
// session_id_ is the "sess-id" field.
// session_version_ is the "sess-version" field.
int64_t session_id() { return session_id_; }
void set_session_id(int64_t session_id) { session_id_ = session_id; }
const std::string& session_version() const { return session_version_; }
void set_session_version(std::string session_version) {
session_version_ = std::move(session_version);
}
private:
int64_t session_id_;
std::string session_version_;
};
} // namespace webrtc
#endif // API_ORTC_SESSIONDESCRIPTION_H_

View File

@ -1,23 +0,0 @@
/*
* Copyright 2017 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/ortc/sessiondescription.h"
#include "test/gtest.h"
namespace webrtc {
class SessionDescriptionTest : public testing::Test {};
TEST_F(SessionDescriptionTest, CreateSessionDescription) {
SessionDescription s(-1, "0");
EXPECT_EQ(-1, s.session_id());
EXPECT_EQ("0", s.session_version());
}
} // namespace webrtc

View File

@ -1,49 +0,0 @@
/*
* Copyright 2017 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_ORTC_UDPTRANSPORTINTERFACE_H_
#define API_ORTC_UDPTRANSPORTINTERFACE_H_
#include "api/ortc/packettransportinterface.h"
#include "api/proxy.h"
#include "rtc_base/socketaddress.h"
namespace webrtc {
// Interface for a raw UDP transport (not using ICE), meaning a combination of
// a local/remote IP address/port.
//
// An instance can be instantiated using OrtcFactory.
//
// Each instance reserves a UDP port, which will be freed when the
// UdpTransportInterface destructor is called.
//
// Calling SetRemoteAddress sets the destination of outgoing packets; without a
// destination, packets can't be sent, but they can be received.
class UdpTransportInterface : public virtual PacketTransportInterface {
public:
// Get the address of the socket allocated for this transport.
virtual rtc::SocketAddress GetLocalAddress() const = 0;
// Sets the address to which packets will be delivered.
//
// Calling with a "nil" (default-constructed) address is legal, and unsets
// any previously set destination.
//
// However, calling with an incomplete address (port or IP not set) will
// fail.
virtual bool SetRemoteAddress(const rtc::SocketAddress& dest) = 0;
// Simple getter. If never set, returns nil address.
virtual rtc::SocketAddress GetRemoteAddress() const = 0;
};
} // namespace webrtc
#endif // API_ORTC_UDPTRANSPORTINTERFACE_H_

View File

@ -76,8 +76,6 @@ rtc_static_library("rtc_p2p") {
"base/turnport.cc",
"base/turnport.h",
"base/udpport.h",
"base/udptransport.cc",
"base/udptransport.h",
"client/basicportallocator.cc",
"client/basicportallocator.h",
"client/relayportfactoryinterface.h",
@ -176,7 +174,6 @@ if (rtc_include_tests) {
"base/transportdescriptionfactory_unittest.cc",
"base/turnport_unittest.cc",
"base/turnserver_unittest.cc",
"base/udptransport_unittest.cc",
"client/basicportallocator_unittest.cc",
]
deps = [

View File

@ -44,6 +44,7 @@ if (rtc_enable_protobuf) {
"../../p2p",
"../../rtc_base:checks",
"../../rtc_base:protobuf_utils",
"../../rtc_base:rtc_base",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_task_queue",
"../../rtc_base:sequenced_task_checker",

View File

@ -10,6 +10,9 @@
#include "rtc_tools/network_tester/test_controller.h"
#include "absl/types/optional.h"
#include "rtc_base/thread.h"
namespace webrtc {
TestController::TestController(int min_port,
@ -24,17 +27,15 @@ TestController::TestController(int min_port,
RTC_DCHECK_RUN_ON(&test_controller_thread_checker_);
packet_sender_checker_.Detach();
send_data_.fill(42);
auto socket =
udp_socket_ =
std::unique_ptr<rtc::AsyncPacketSocket>(socket_factory_.CreateUdpSocket(
rtc::SocketAddress(rtc::GetAnyIP(AF_INET), 0), min_port, max_port));
socket->SignalReadPacket.connect(this, &TestController::OnReadPacket);
udp_transport_.reset(
new cricket::UdpTransport("network tester transport", std::move(socket)));
udp_socket_->SignalReadPacket.connect(this, &TestController::OnReadPacket);
}
void TestController::SendConnectTo(const std::string& hostname, int port) {
RTC_DCHECK_RUN_ON(&test_controller_thread_checker_);
udp_transport_->SetRemoteAddress(rtc::SocketAddress(hostname, port));
remote_address_ = rtc::SocketAddress(hostname, port);
NetworkTesterPacket packet;
packet.set_type(NetworkTesterPacket::HAND_SHAKING);
SendData(packet, absl::nullopt);
@ -57,8 +58,8 @@ void TestController::SendData(const NetworkTesterPacket& packet,
packet.SerializeToArray(&send_data_[1], std::numeric_limits<char>::max());
if (data_size && *data_size > packet_size)
packet_size = *data_size;
udp_transport_->SendPacket(send_data_.data(), packet_size,
rtc::PacketOptions(), 0);
udp_socket_->SendTo((const void*)send_data_.data(), packet_size,
remote_address_, rtc::PacketOptions());
}
void TestController::OnTestDone() {
@ -91,7 +92,7 @@ void TestController::OnReadPacket(rtc::AsyncPacketSocket* socket,
case NetworkTesterPacket::HAND_SHAKING: {
NetworkTesterPacket packet;
packet.set_type(NetworkTesterPacket::TEST_START);
udp_transport_->SetRemoteAddress(remote_addr);
remote_address_ = remote_addr;
SendData(packet, absl::nullopt);
packet_sender_.reset(new PacketSender(this, config_file_path_));
packet_sender_->StartSending();

View File

@ -18,7 +18,7 @@
#include <utility>
#include "p2p/base/basicpacketsocketfactory.h"
#include "p2p/base/udptransport.h"
#include "rtc_base/asyncpacketsocket.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/ignore_wundef.h"
#include "rtc_tools/network_tester/packet_logger.h"
@ -70,7 +70,8 @@ class TestController : public sigslot::has_slots<> {
bool local_test_done_ RTC_GUARDED_BY(local_test_done_lock_);
bool remote_test_done_;
std::array<char, kEthernetMtu> send_data_;
std::unique_ptr<cricket::UdpTransport> udp_transport_;
std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_;
rtc::SocketAddress remote_address_;
std::unique_ptr<PacketSender> packet_sender_;
RTC_DISALLOW_COPY_AND_ASSIGN(TestController);