2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Copyright 2012 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-10 07:54:43 -08:00
|
|
|
* 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.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// This file contains the PeerConnection interface as defined in
|
|
|
|
|
// http://dev.w3.org/2011/webrtc/editor/webrtc.html#peer-to-peer-connections.
|
|
|
|
|
// Applications must use this interface to implement peerconnection.
|
|
|
|
|
// PeerConnectionFactory class provides factory methods to create
|
|
|
|
|
// peerconnection, mediastream and media tracks objects.
|
|
|
|
|
//
|
|
|
|
|
// The Following steps are needed to setup a typical call using Jsep.
|
|
|
|
|
// 1. Create a PeerConnectionFactoryInterface. Check constructors for more
|
|
|
|
|
// information about input parameters.
|
|
|
|
|
// 2. Create a PeerConnection object. Provide a configuration string which
|
|
|
|
|
// points either to stun or turn server to generate ICE candidates and provide
|
|
|
|
|
// an object that implements the PeerConnectionObserver interface.
|
|
|
|
|
// 3. Create local MediaStream and MediaTracks using the PeerConnectionFactory
|
|
|
|
|
// and add it to PeerConnection by calling AddStream.
|
|
|
|
|
// 4. Create an offer and serialize it and send it to the remote peer.
|
|
|
|
|
// 5. Once an ice candidate have been found PeerConnection will call the
|
|
|
|
|
// observer function OnIceCandidate. The candidates must also be serialized and
|
|
|
|
|
// sent to the remote peer.
|
|
|
|
|
// 6. Once an answer is received from the remote peer, call
|
|
|
|
|
// SetLocalSessionDescription with the offer and SetRemoteSessionDescription
|
|
|
|
|
// with the remote answer.
|
|
|
|
|
// 7. Once a remote candidate is received from the remote peer, provide it to
|
|
|
|
|
// the peerconnection by calling AddIceCandidate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The Receiver of a call can decide to accept or reject the call.
|
|
|
|
|
// This decision will be taken by the application not peerconnection.
|
|
|
|
|
// If application decides to accept the call
|
|
|
|
|
// 1. Create PeerConnectionFactoryInterface if it doesn't exist.
|
|
|
|
|
// 2. Create a new PeerConnection.
|
|
|
|
|
// 3. Provide the remote offer to the new PeerConnection object by calling
|
|
|
|
|
// SetRemoteSessionDescription.
|
|
|
|
|
// 4. Generate an answer to the remote offer by calling CreateAnswer and send it
|
|
|
|
|
// back to the remote peer.
|
|
|
|
|
// 5. Provide the local answer to the new PeerConnection by calling
|
|
|
|
|
// SetLocalSessionDescription with the answer.
|
|
|
|
|
// 6. Provide the remote ice candidates by calling AddIceCandidate.
|
|
|
|
|
// 7. Once a candidate have been found PeerConnection will call the observer
|
|
|
|
|
// function OnIceCandidate. Send these candidates to the remote peer.
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#ifndef WEBRTC_API_PEERCONNECTIONINTERFACE_H_
|
|
|
|
|
#define WEBRTC_API_PEERCONNECTIONINTERFACE_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-04-27 06:47:29 -07:00
|
|
|
#include <memory>
|
2016-12-10 11:44:26 -08:00
|
|
|
#include <ostream>
|
2013-07-10 00:45:36 +00:00
|
|
|
#include <string>
|
2015-12-17 03:04:15 -08:00
|
|
|
#include <utility>
|
2013-07-10 00:45:36 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#include "webrtc/api/datachannelinterface.h"
|
|
|
|
|
#include "webrtc/api/dtmfsenderinterface.h"
|
|
|
|
|
#include "webrtc/api/jsep.h"
|
|
|
|
|
#include "webrtc/api/mediastreaminterface.h"
|
2016-09-15 23:33:01 -07:00
|
|
|
#include "webrtc/api/rtcstatscollector.h"
|
2016-02-10 10:53:12 +01:00
|
|
|
#include "webrtc/api/rtpreceiverinterface.h"
|
|
|
|
|
#include "webrtc/api/rtpsenderinterface.h"
|
|
|
|
|
#include "webrtc/api/statstypes.h"
|
|
|
|
|
#include "webrtc/api/umametrics.h"
|
2014-07-29 17:36:52 +00:00
|
|
|
#include "webrtc/base/fileutils.h"
|
Makes libjingle_peerconnection_android_unittest run on networkless devices.
PeerConnectionTest.java currently works, but only on a device with
network interfaces up. This is not a problem for desktop, but it is a
problem when running on Android devices since the devices in the lab
generally don't have network (due to the chaotic radio environment in
the device labs, devices are simply kept in flight mode).
The test does work if one modifies this line in the file
webrtc/base/network.cc:
bool ignored = ((cursor->ifa_flags & IFF_LOOPBACK) ||
IsIgnoredNetwork(*network));
If we remove the IFF_LOOPBACK clause, the test starts working on
an Android device in flight mode. This is nice - we're running the
call and packets interact with the OS network stack, which is good
for this end-to-end test. We can't just remove the clause though since
having loopback is undesirable for everyone except the test (right)?
so we need to make this behavior configurable.
This CL takes a stab at a complete solution where we pass a boolean
all the way through the Java PeerConnectionFactory down to the
BasicNetworkManager. This comes as a heavy price in interface
changes though. It's pretty out of proportion, but fundamentally we
need some way of telling the network manager that it is on Android
and in test mode. Passing the boolean all the way through is one way.
Another way might be to put the loopback filter behind an ifdef and
link a custom libjingle_peerconnection.so with the test. That is hacky
but doesn't pollute the interfaces. Not sure how to solve that in GYP
but it could mean some duplication between the production and
test .so files.
It would have been perfect to use flags here, but then we need to
hook up gflags parsing to some main() somewhere to make sure the
flag gets parsed, and make sure to pass that flag in our tests.
I'm not sure how that can be done.
Making the loopback filtering conditional is exactly how we solved the
equivalent problem in content_browsertests in Chrome, and it worked
great.
That's all I could think of.
BUG=4181
R=perkj@webrtc.org, pthatcher@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/36769004
Cr-Commit-Position: refs/heads/master@{#8344}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8344 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-12 09:23:59 +00:00
|
|
|
#include "webrtc/base/network.h"
|
2015-08-25 09:53:21 +02:00
|
|
|
#include "webrtc/base/rtccertificate.h"
|
Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
The store was used in WebRtcSessionDescriptionFactory to generate certificates,
now a generator is used instead (new API). PeerConnection[Factory][Interface],
and WebRtcSession are updated to pass generators all the way down to the
WebRtcSessionDescriptionFactory instead of stores.
The webrtc implementation of a generator, RTCCertificateGenerator, is used as
the default generator (peerconnectionfactory.cc:189) instead of the webrtc
implementation of a store, DtlsIdentityStoreImpl.
The generator is fully parameterized and does not generate RSA-1024 unless you
ask for it (which makes sense not to do beforehand since ECDSA is now default).
The store was not fully parameterized (known filed bug).
The "top" layer, PeerConnectionFactoryInterface::CreatePeerConneciton, is
updated to take a generator instead of a store.
Many unittests still use a store, to allow them to continue to do so the
factory gets CreatePeerConnectionWithStore which uses the old function
signature (and invokes the new signature by wrapping the store in an
RTCCertificateGeneratorStoreWrapper). As soon as the FakeDtlsIdentityStore is
turned into a certificate generator instead of a store, the unittests will be
updated and we can remove CreatePeerConnectionWithStore.
This is a reupload of https://codereview.webrtc.org/2013523002/ with minor
changes.
BUG=webrtc:5707, webrtc:5708
R=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/2017943002 .
Cr-Commit-Position: refs/heads/master@{#12984}
2016-06-01 11:44:18 +02:00
|
|
|
#include "webrtc/base/rtccertificategenerator.h"
|
2014-07-29 17:36:52 +00:00
|
|
|
#include "webrtc/base/socketaddress.h"
|
Move talk/media to webrtc/media
I removed the 'libjingle' target in talk/libjingle.gyp and replaced
all users of it with base/base.gyp:rtc_base. It seems the jsoncpp
and expat dependencies were not used by it's previous references.
The files in talk/media/testdata were uploaded to Google Storage and
added .sha1 files in resources/media instead of simply moving them.
The previously disabled warnings that were inherited from
talk/build/common.gypi are now replaced by target-specific disabling
of only the failing warnings. Additional disabling was needed since the stricter
compilation warnings that applies to code in webrtc/.
License headers will be updated in a follow-up CL in order to not
break Git history.
Other modifications:
* Updated the header guards.
* Sorted the includes using chromium/src/tools/sort-headers.py
except for these files:
talk/app/webrtc/peerconnectionendtoend_unittest.cc
talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
talk/app/webrtc/java/jni/androidmediaencoder_jni.cc
webrtc/media/devices/win32devicemanager.cc.
* Unused GYP reference to libjingle_tests_additional_deps was removed.
* Removed duplicated GYP entries of
webrtc/base/testutils.cc
webrtc/base/testutils.h
The HAVE_WEBRTC_VIDEO and HAVE_WEBRTC_VOICE defines were used by only talk/media,
so they were moved to the media.gyp.
I also checked that none of
EXPAT_RELATIVE_PATH,
FEATURE_ENABLE_VOICEMAIL,
GTEST_RELATIVE_PATH,
JSONCPP_RELATIVE_PATH,
LOGGING=1,
SRTP_RELATIVE_PATH,
FEATURE_ENABLE_SSL,
FEATURE_ENABLE_VOICEMAIL,
FEATURE_ENABLE_PSTN,
HAVE_SCTP,
HAVE_SRTP,
are used by the talk/media code.
For Chromium, the following changes will need to be applied to the roll CL that updates the
DEPS for WebRTC and libjingle: https://codereview.chromium.org/1604303002/
BUG=webrtc:5420
NOPRESUBMIT=True
TBR=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1587193006
Cr-Commit-Position: refs/heads/master@{#11495}
2016-02-04 23:52:28 -08:00
|
|
|
#include "webrtc/base/sslstreamadapter.h"
|
2016-04-11 23:25:29 -07:00
|
|
|
#include "webrtc/media/base/mediachannel.h"
|
2015-12-01 15:01:24 -08:00
|
|
|
#include "webrtc/p2p/base/portallocator.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
namespace rtc {
|
2015-03-04 22:17:38 +00:00
|
|
|
class SSLIdentity;
|
2013-07-10 00:45:36 +00:00
|
|
|
class Thread;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
class WebRtcVideoDecoderFactory;
|
|
|
|
|
class WebRtcVideoEncoderFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
class AudioDeviceModule;
|
2016-12-13 14:06:26 -08:00
|
|
|
class AudioMixer;
|
2013-07-10 00:45:36 +00:00
|
|
|
class MediaConstraintsInterface;
|
|
|
|
|
|
|
|
|
|
// MediaStream container interface.
|
2014-07-29 17:36:52 +00:00
|
|
|
class StreamCollectionInterface : public rtc::RefCountInterface {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
|
|
|
|
// TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find.
|
|
|
|
|
virtual size_t count() = 0;
|
|
|
|
|
virtual MediaStreamInterface* at(size_t index) = 0;
|
|
|
|
|
virtual MediaStreamInterface* find(const std::string& label) = 0;
|
|
|
|
|
virtual MediaStreamTrackInterface* FindAudioTrack(
|
|
|
|
|
const std::string& id) = 0;
|
|
|
|
|
virtual MediaStreamTrackInterface* FindVideoTrack(
|
|
|
|
|
const std::string& id) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
// Dtor protected as objects shouldn't be deleted via this interface.
|
|
|
|
|
~StreamCollectionInterface() {}
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
class StatsObserver : public rtc::RefCountInterface {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
New method StatsObserver::OnCompleteReports, passing ownership.
The new name, OnCompleteReports rather than OnComplete, is needed
because in C++ method lookup, overriding a method hides all otherwise
inherited methods with the same name, even if they have a different
signature. And here, the intention is that each subclass should
override one or the other of the two methods, and inherit the method it
doesn't override.
This cl is a prerequisite for
https://codereview.webrtc.org/2567143003/, because the Chrome glue
code needs to retain the stats report after the OnComplete method has
returned.
Currently, Chrome makes a copy of the stats mapping (which breaks when
changing ValuePtr from an rtc::linked_ptr to an std::unique_ptr). After
this cl, Chrome can be fixed to take ownership and no longer needs to
copy anything, unblocking cl 2567143003.
BUG=webrtc:6424
Review-Url: https://codereview.webrtc.org/2584553002
Cr-Commit-Position: refs/heads/master@{#15708}
2016-12-20 03:30:00 -08:00
|
|
|
// TODO(nisse, hbos): Old version, not passing ownership. Should
|
|
|
|
|
// perhaps be deprecated, but since all of this is a legacy
|
|
|
|
|
// interface anyway, probably best to leave as is until this class
|
|
|
|
|
// can be deleted.
|
|
|
|
|
virtual void OnComplete(const StatsReports& reports) {}
|
|
|
|
|
virtual void OnCompleteReports(std::unique_ptr<StatsReports> reports) {
|
|
|
|
|
OnComplete(*reports);
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~StatsObserver() {}
|
|
|
|
|
};
|
|
|
|
|
|
2016-12-10 11:44:26 -08:00
|
|
|
// Enumeration to represent distinct classes of errors that an application
|
2017-01-11 12:28:30 -08:00
|
|
|
// may wish to act upon differently. These roughly map to DOMExceptions or
|
|
|
|
|
// RTCError "errorDetailEnum" values in the web API, as described in the
|
|
|
|
|
// comments below.
|
|
|
|
|
enum class RTCErrorType {
|
2016-12-10 11:44:26 -08:00
|
|
|
// No error.
|
|
|
|
|
NONE,
|
|
|
|
|
// A supplied parameter is valid, but currently unsupported.
|
|
|
|
|
// Maps to InvalidAccessError DOMException.
|
|
|
|
|
UNSUPPORTED_PARAMETER,
|
|
|
|
|
// General error indicating that a supplied parameter is invalid.
|
|
|
|
|
// Maps to InvalidAccessError or TypeError DOMException depending on context.
|
|
|
|
|
INVALID_PARAMETER,
|
|
|
|
|
// Slightly more specific than INVALID_PARAMETER; a parameter's value was
|
|
|
|
|
// outside the allowed range.
|
|
|
|
|
// Maps to RangeError DOMException.
|
|
|
|
|
INVALID_RANGE,
|
|
|
|
|
// Slightly more specific than INVALID_PARAMETER; an error occurred while
|
|
|
|
|
// parsing string input.
|
|
|
|
|
// Maps to SyntaxError DOMException.
|
|
|
|
|
SYNTAX_ERROR,
|
|
|
|
|
// The object does not support this operation in its current state.
|
|
|
|
|
// Maps to InvalidStateError DOMException.
|
|
|
|
|
INVALID_STATE,
|
|
|
|
|
// An attempt was made to modify the object in an invalid way.
|
|
|
|
|
// Maps to InvalidModificationError DOMException.
|
|
|
|
|
INVALID_MODIFICATION,
|
|
|
|
|
// An error occurred within an underlying network protocol.
|
|
|
|
|
// Maps to NetworkError DOMException.
|
|
|
|
|
NETWORK_ERROR,
|
|
|
|
|
// The operation failed due to an internal error.
|
|
|
|
|
// Maps to OperationError DOMException.
|
|
|
|
|
INTERNAL_ERROR,
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-11 12:28:30 -08:00
|
|
|
// Roughly corresponds to RTCError in the web api. Holds an error type and
|
|
|
|
|
// possibly additional information specific to that error.
|
|
|
|
|
//
|
|
|
|
|
// Doesn't contain anything beyond a type now, but will in the future as more
|
|
|
|
|
// errors are implemented.
|
|
|
|
|
class RTCError {
|
|
|
|
|
public:
|
|
|
|
|
RTCError() : type_(RTCErrorType::NONE) {}
|
|
|
|
|
explicit RTCError(RTCErrorType type) : type_(type) {}
|
|
|
|
|
|
|
|
|
|
RTCErrorType type() const { return type_; }
|
|
|
|
|
void set_type(RTCErrorType type) { type_ = type; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
RTCErrorType type_;
|
|
|
|
|
};
|
|
|
|
|
|
2016-12-10 11:44:26 -08:00
|
|
|
// Outputs the error as a friendly string.
|
|
|
|
|
// Update this method when adding a new error type.
|
2017-01-11 12:28:30 -08:00
|
|
|
std::ostream& operator<<(std::ostream& stream, RTCErrorType error);
|
2016-12-10 11:44:26 -08:00
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
class PeerConnectionInterface : public rtc::RefCountInterface {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
|
|
|
|
// See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions .
|
|
|
|
|
enum SignalingState {
|
|
|
|
|
kStable,
|
|
|
|
|
kHaveLocalOffer,
|
|
|
|
|
kHaveLocalPrAnswer,
|
|
|
|
|
kHaveRemoteOffer,
|
|
|
|
|
kHaveRemotePrAnswer,
|
|
|
|
|
kClosed,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum IceGatheringState {
|
|
|
|
|
kIceGatheringNew,
|
|
|
|
|
kIceGatheringGathering,
|
|
|
|
|
kIceGatheringComplete
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum IceConnectionState {
|
|
|
|
|
kIceConnectionNew,
|
|
|
|
|
kIceConnectionChecking,
|
|
|
|
|
kIceConnectionConnected,
|
|
|
|
|
kIceConnectionCompleted,
|
|
|
|
|
kIceConnectionFailed,
|
|
|
|
|
kIceConnectionDisconnected,
|
|
|
|
|
kIceConnectionClosed,
|
2015-08-19 16:51:15 -07:00
|
|
|
kIceConnectionMax,
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
2017-01-09 08:35:45 -08:00
|
|
|
// TLS certificate policy.
|
|
|
|
|
enum TlsCertPolicy {
|
|
|
|
|
// For TLS based protocols, ensure the connection is secure by not
|
|
|
|
|
// circumventing certificate validation.
|
|
|
|
|
kTlsCertPolicySecure,
|
|
|
|
|
// For TLS based protocols, disregard security completely by skipping
|
|
|
|
|
// certificate validation. This is insecure and should never be used unless
|
|
|
|
|
// security is irrelevant in that particular context.
|
|
|
|
|
kTlsCertPolicyInsecureNoCheck,
|
|
|
|
|
};
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
struct IceServer {
|
2015-05-28 23:06:30 +02:00
|
|
|
// TODO(jbauch): Remove uri when all code using it has switched to urls.
|
2013-07-10 00:45:36 +00:00
|
|
|
std::string uri;
|
2015-05-28 23:06:30 +02:00
|
|
|
std::vector<std::string> urls;
|
2013-07-10 00:45:36 +00:00
|
|
|
std::string username;
|
|
|
|
|
std::string password;
|
2017-01-09 08:35:45 -08:00
|
|
|
TlsCertPolicy tls_cert_policy = kTlsCertPolicySecure;
|
|
|
|
|
|
2016-12-10 13:15:33 -08:00
|
|
|
bool operator==(const IceServer& o) const {
|
|
|
|
|
return uri == o.uri && urls == o.urls && username == o.username &&
|
2017-01-09 08:35:45 -08:00
|
|
|
password == o.password && tls_cert_policy == o.tls_cert_policy;
|
2016-12-10 13:15:33 -08:00
|
|
|
}
|
|
|
|
|
bool operator!=(const IceServer& o) const { return !(*this == o); }
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
typedef std::vector<IceServer> IceServers;
|
|
|
|
|
|
2014-05-03 05:39:45 +00:00
|
|
|
enum IceTransportsType {
|
2015-01-14 23:19:06 +00:00
|
|
|
// TODO(pthatcher): Rename these kTransporTypeXXX, but update
|
|
|
|
|
// Chromium at the same time.
|
2014-05-03 05:39:45 +00:00
|
|
|
kNone,
|
|
|
|
|
kRelay,
|
|
|
|
|
kNoHost,
|
|
|
|
|
kAll
|
|
|
|
|
};
|
|
|
|
|
|
2015-01-14 23:19:06 +00:00
|
|
|
// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-08#section-4.1.1
|
|
|
|
|
enum BundlePolicy {
|
|
|
|
|
kBundlePolicyBalanced,
|
|
|
|
|
kBundlePolicyMaxBundle,
|
|
|
|
|
kBundlePolicyMaxCompat
|
|
|
|
|
};
|
|
|
|
|
|
2015-05-21 07:48:41 -07:00
|
|
|
// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-09#section-4.1.1
|
|
|
|
|
enum RtcpMuxPolicy {
|
|
|
|
|
kRtcpMuxPolicyNegotiate,
|
|
|
|
|
kRtcpMuxPolicyRequire,
|
|
|
|
|
};
|
|
|
|
|
|
2015-04-30 12:35:24 -07:00
|
|
|
enum TcpCandidatePolicy {
|
|
|
|
|
kTcpCandidatePolicyEnabled,
|
|
|
|
|
kTcpCandidatePolicyDisabled
|
|
|
|
|
};
|
|
|
|
|
|
2016-05-31 18:29:12 -07:00
|
|
|
enum CandidateNetworkPolicy {
|
|
|
|
|
kCandidateNetworkPolicyAll,
|
|
|
|
|
kCandidateNetworkPolicyLowCost
|
|
|
|
|
};
|
|
|
|
|
|
2015-09-28 07:57:34 -07:00
|
|
|
enum ContinualGatheringPolicy {
|
|
|
|
|
GATHER_ONCE,
|
|
|
|
|
GATHER_CONTINUALLY
|
|
|
|
|
};
|
|
|
|
|
|
2016-09-01 15:34:01 -07:00
|
|
|
enum class RTCConfigurationType {
|
|
|
|
|
// A configuration that is safer to use, despite not having the best
|
|
|
|
|
// performance. Currently this is the default configuration.
|
|
|
|
|
kSafe,
|
|
|
|
|
// An aggressive configuration that has better performance, although it
|
|
|
|
|
// may be riskier and may need extra support in the application.
|
|
|
|
|
kAggressive
|
|
|
|
|
};
|
|
|
|
|
|
2015-08-25 09:53:21 +02:00
|
|
|
// TODO(hbos): Change into class with private data and public getters.
|
2016-04-11 23:25:29 -07:00
|
|
|
// TODO(nisse): In particular, accessing fields directly from an
|
|
|
|
|
// application is brittle, since the organization mirrors the
|
|
|
|
|
// organization of the implementation, which isn't stable. So we
|
|
|
|
|
// need getters and setters at least for fields which applications
|
|
|
|
|
// are interested in.
|
2014-05-03 05:39:45 +00:00
|
|
|
struct RTCConfiguration {
|
2016-03-31 12:59:59 +02:00
|
|
|
// This struct is subject to reorganization, both for naming
|
|
|
|
|
// consistency, and to group settings to match where they are used
|
|
|
|
|
// in the implementation. To do that, we need getter and setter
|
|
|
|
|
// methods for all settings which are of interest to applications,
|
|
|
|
|
// Chrome in particular.
|
|
|
|
|
|
2016-09-01 15:34:01 -07:00
|
|
|
RTCConfiguration() = default;
|
|
|
|
|
RTCConfiguration(RTCConfigurationType type) {
|
|
|
|
|
if (type == RTCConfigurationType::kAggressive) {
|
2016-09-02 16:58:17 -07:00
|
|
|
// These parameters are also defined in Java and IOS configurations,
|
|
|
|
|
// so their values may be overwritten by the Java or IOS configuration.
|
|
|
|
|
bundle_policy = kBundlePolicyMaxBundle;
|
|
|
|
|
rtcp_mux_policy = kRtcpMuxPolicyRequire;
|
|
|
|
|
ice_connection_receiving_timeout =
|
|
|
|
|
kAggressiveIceConnectionReceivingTimeout;
|
|
|
|
|
|
|
|
|
|
// These parameters are not defined in Java or IOS configuration,
|
|
|
|
|
// so their values will not be overwritten.
|
|
|
|
|
enable_ice_renomination = true;
|
2016-09-01 15:34:01 -07:00
|
|
|
redetermine_role_on_ice_restart = false;
|
|
|
|
|
}
|
2016-08-30 22:07:42 -07:00
|
|
|
}
|
|
|
|
|
|
2017-01-11 12:28:30 -08:00
|
|
|
bool operator==(const RTCConfiguration& o) const;
|
|
|
|
|
bool operator!=(const RTCConfiguration& o) const;
|
|
|
|
|
|
2016-04-11 23:25:29 -07:00
|
|
|
bool dscp() { return media_config.enable_dscp; }
|
|
|
|
|
void set_dscp(bool enable) { media_config.enable_dscp = enable; }
|
2016-03-31 12:59:59 +02:00
|
|
|
|
|
|
|
|
// TODO(nisse): The corresponding flag in MediaConfig and
|
|
|
|
|
// elsewhere should be renamed enable_cpu_adaptation.
|
2016-04-11 23:25:29 -07:00
|
|
|
bool cpu_adaptation() {
|
|
|
|
|
return media_config.video.enable_cpu_overuse_detection;
|
|
|
|
|
}
|
2016-03-31 12:59:59 +02:00
|
|
|
void set_cpu_adaptation(bool enable) {
|
2016-04-11 23:25:29 -07:00
|
|
|
media_config.video.enable_cpu_overuse_detection = enable;
|
2016-03-31 12:59:59 +02:00
|
|
|
}
|
|
|
|
|
|
2016-04-11 23:25:29 -07:00
|
|
|
bool suspend_below_min_bitrate() {
|
|
|
|
|
return media_config.video.suspend_below_min_bitrate;
|
|
|
|
|
}
|
2016-03-31 12:59:59 +02:00
|
|
|
void set_suspend_below_min_bitrate(bool enable) {
|
2016-04-11 23:25:29 -07:00
|
|
|
media_config.video.suspend_below_min_bitrate = enable;
|
2016-03-31 12:59:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(nisse): The negation in the corresponding MediaConfig
|
|
|
|
|
// attribute is inconsistent, and it should be renamed at some
|
|
|
|
|
// point.
|
2016-04-11 23:25:29 -07:00
|
|
|
bool prerenderer_smoothing() {
|
|
|
|
|
return !media_config.video.disable_prerenderer_smoothing;
|
|
|
|
|
}
|
2016-03-31 12:59:59 +02:00
|
|
|
void set_prerenderer_smoothing(bool enable) {
|
2016-04-11 23:25:29 -07:00
|
|
|
media_config.video.disable_prerenderer_smoothing = !enable;
|
2016-03-31 12:59:59 +02:00
|
|
|
}
|
|
|
|
|
|
2015-09-01 09:53:56 -07:00
|
|
|
static const int kUndefined = -1;
|
|
|
|
|
// Default maximum number of packets in the audio jitter buffer.
|
|
|
|
|
static const int kAudioJitterBufferMaxPackets = 50;
|
2016-09-02 16:58:17 -07:00
|
|
|
// ICE connection receiving timeout for aggressive configuration.
|
|
|
|
|
static const int kAggressiveIceConnectionReceivingTimeout = 1000;
|
2015-01-14 23:19:06 +00:00
|
|
|
// TODO(pthatcher): Rename this ice_transport_type, but update
|
|
|
|
|
// Chromium at the same time.
|
2016-05-13 08:15:11 -07:00
|
|
|
IceTransportsType type = kAll;
|
2015-01-14 23:19:06 +00:00
|
|
|
// TODO(pthatcher): Rename this ice_servers, but update Chromium
|
|
|
|
|
// at the same time.
|
2014-05-03 05:39:45 +00:00
|
|
|
IceServers servers;
|
2016-05-13 08:15:11 -07:00
|
|
|
BundlePolicy bundle_policy = kBundlePolicyBalanced;
|
2016-11-23 10:30:12 -08:00
|
|
|
RtcpMuxPolicy rtcp_mux_policy = kRtcpMuxPolicyRequire;
|
2016-05-13 08:15:11 -07:00
|
|
|
TcpCandidatePolicy tcp_candidate_policy = kTcpCandidatePolicyEnabled;
|
2016-05-31 18:29:12 -07:00
|
|
|
CandidateNetworkPolicy candidate_network_policy =
|
|
|
|
|
kCandidateNetworkPolicyAll;
|
2016-05-13 08:15:11 -07:00
|
|
|
int audio_jitter_buffer_max_packets = kAudioJitterBufferMaxPackets;
|
|
|
|
|
bool audio_jitter_buffer_fast_accelerate = false;
|
|
|
|
|
int ice_connection_receiving_timeout = kUndefined; // ms
|
|
|
|
|
int ice_backup_candidate_pair_ping_interval = kUndefined; // ms
|
|
|
|
|
ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE;
|
2015-08-25 09:53:21 +02:00
|
|
|
std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates;
|
2016-05-13 08:15:11 -07:00
|
|
|
bool prioritize_most_likely_ice_candidate_pairs = false;
|
2016-04-11 23:25:29 -07:00
|
|
|
struct cricket::MediaConfig media_config;
|
2016-03-04 02:51:39 -08:00
|
|
|
// Flags corresponding to values set by constraint flags.
|
|
|
|
|
// rtc::Optional flags can be "missing", in which case the webrtc
|
|
|
|
|
// default applies.
|
2016-05-13 08:15:11 -07:00
|
|
|
bool disable_ipv6 = false;
|
|
|
|
|
bool enable_rtp_data_channel = false;
|
2016-08-05 11:14:50 -07:00
|
|
|
bool enable_quic = false;
|
2016-03-04 02:51:39 -08:00
|
|
|
rtc::Optional<int> screencast_min_bitrate;
|
|
|
|
|
rtc::Optional<bool> combined_audio_video_bwe;
|
|
|
|
|
rtc::Optional<bool> enable_dtls_srtp;
|
2016-05-13 08:15:11 -07:00
|
|
|
int ice_candidate_pool_size = 0;
|
2016-06-30 20:52:02 -07:00
|
|
|
bool prune_turn_ports = false;
|
2016-07-01 11:11:13 -07:00
|
|
|
// If set to true, this means the ICE transport should presume TURN-to-TURN
|
|
|
|
|
// candidate pairs will succeed, even before a binding response is received.
|
|
|
|
|
bool presume_writable_when_fully_relayed = false;
|
2016-08-31 08:18:11 -07:00
|
|
|
// If true, "renomination" will be added to the ice options in the transport
|
|
|
|
|
// description.
|
|
|
|
|
bool enable_ice_renomination = false;
|
2016-08-30 22:07:42 -07:00
|
|
|
// If true, ICE role is redetermined when peerconnection sets a local
|
|
|
|
|
// transport description that indicates an ICE restart.
|
|
|
|
|
bool redetermine_role_on_ice_restart = true;
|
2017-01-11 12:28:30 -08:00
|
|
|
//
|
|
|
|
|
// Don't forget to update operator== if adding something.
|
|
|
|
|
//
|
2014-05-03 05:39:45 +00:00
|
|
|
};
|
|
|
|
|
|
2014-08-04 18:34:16 +00:00
|
|
|
struct RTCOfferAnswerOptions {
|
|
|
|
|
static const int kUndefined = -1;
|
|
|
|
|
static const int kMaxOfferToReceiveMedia = 1;
|
|
|
|
|
|
|
|
|
|
// The default value for constraint offerToReceiveX:true.
|
|
|
|
|
static const int kOfferToReceiveMediaTrue = 1;
|
|
|
|
|
|
2016-08-31 08:18:11 -07:00
|
|
|
int offer_to_receive_video = kUndefined;
|
|
|
|
|
int offer_to_receive_audio = kUndefined;
|
|
|
|
|
bool voice_activity_detection = true;
|
|
|
|
|
bool ice_restart = false;
|
|
|
|
|
bool use_rtp_mux = true;
|
|
|
|
|
|
|
|
|
|
RTCOfferAnswerOptions() = default;
|
2014-08-04 18:34:16 +00:00
|
|
|
|
|
|
|
|
RTCOfferAnswerOptions(int offer_to_receive_video,
|
|
|
|
|
int offer_to_receive_audio,
|
|
|
|
|
bool voice_activity_detection,
|
|
|
|
|
bool ice_restart,
|
|
|
|
|
bool use_rtp_mux)
|
|
|
|
|
: offer_to_receive_video(offer_to_receive_video),
|
|
|
|
|
offer_to_receive_audio(offer_to_receive_audio),
|
|
|
|
|
voice_activity_detection(voice_activity_detection),
|
|
|
|
|
ice_restart(ice_restart),
|
|
|
|
|
use_rtp_mux(use_rtp_mux) {}
|
|
|
|
|
};
|
|
|
|
|
|
2014-02-13 23:18:49 +00:00
|
|
|
// Used by GetStats to decide which stats to include in the stats reports.
|
|
|
|
|
// |kStatsOutputLevelStandard| includes the standard stats for Javascript API;
|
|
|
|
|
// |kStatsOutputLevelDebug| includes both the standard stats and additional
|
|
|
|
|
// stats for debugging purposes.
|
|
|
|
|
enum StatsOutputLevel {
|
|
|
|
|
kStatsOutputLevelStandard,
|
|
|
|
|
kStatsOutputLevelDebug,
|
|
|
|
|
};
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Accessor methods to active local streams.
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<StreamCollectionInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
local_streams() = 0;
|
|
|
|
|
|
|
|
|
|
// Accessor methods to remote streams.
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<StreamCollectionInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
remote_streams() = 0;
|
|
|
|
|
|
2014-11-04 13:01:33 +00:00
|
|
|
// Add a new MediaStream to be sent on this PeerConnection.
|
|
|
|
|
// Note that a SessionDescription negotiation is needed before the
|
|
|
|
|
// remote peer can receive the stream.
|
2014-11-06 12:16:36 +00:00
|
|
|
virtual bool AddStream(MediaStreamInterface* stream) = 0;
|
2014-11-04 11:31:29 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Remove a MediaStream from this PeerConnection.
|
|
|
|
|
// Note that a SessionDescription negotiation is need before the
|
|
|
|
|
// remote peer is notified.
|
|
|
|
|
virtual void RemoveStream(MediaStreamInterface* stream) = 0;
|
|
|
|
|
|
2016-01-14 15:35:42 -08:00
|
|
|
// TODO(deadbeef): Make the following two methods pure virtual once
|
|
|
|
|
// implemented by all subclasses of PeerConnectionInterface.
|
|
|
|
|
// Add a new MediaStreamTrack to be sent on this PeerConnection.
|
|
|
|
|
// |streams| indicates which stream labels the track should be associated
|
|
|
|
|
// with.
|
|
|
|
|
virtual rtc::scoped_refptr<RtpSenderInterface> AddTrack(
|
|
|
|
|
MediaStreamTrackInterface* track,
|
|
|
|
|
std::vector<MediaStreamInterface*> streams) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove an RtpSender from this PeerConnection.
|
|
|
|
|
// Returns true on success.
|
|
|
|
|
virtual bool RemoveTrack(RtpSenderInterface* sender) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Returns pointer to the created DtmfSender on success.
|
|
|
|
|
// Otherwise returns NULL.
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
|
2013-07-10 00:45:36 +00:00
|
|
|
AudioTrackInterface* track) = 0;
|
|
|
|
|
|
2015-09-28 16:53:55 -07:00
|
|
|
// TODO(deadbeef): Make these pure virtual once all subclasses implement them.
|
2015-11-25 11:26:01 -08:00
|
|
|
// |kind| must be "audio" or "video".
|
2015-12-18 16:58:44 -08:00
|
|
|
// |stream_id| is used to populate the msid attribute; if empty, one will
|
|
|
|
|
// be generated automatically.
|
2015-11-25 11:26:01 -08:00
|
|
|
virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender(
|
2015-12-18 16:58:44 -08:00
|
|
|
const std::string& kind,
|
|
|
|
|
const std::string& stream_id) {
|
2015-11-25 11:26:01 -08:00
|
|
|
return rtc::scoped_refptr<RtpSenderInterface>();
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-28 16:53:55 -07:00
|
|
|
virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders()
|
|
|
|
|
const {
|
|
|
|
|
return std::vector<rtc::scoped_refptr<RtpSenderInterface>>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers()
|
|
|
|
|
const {
|
|
|
|
|
return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-13 23:18:49 +00:00
|
|
|
virtual bool GetStats(StatsObserver* observer,
|
|
|
|
|
MediaStreamTrackInterface* track,
|
|
|
|
|
StatsOutputLevel level) = 0;
|
2016-09-15 23:33:01 -07:00
|
|
|
// Gets stats using the new stats collection API, see webrtc/api/stats/. These
|
|
|
|
|
// will replace old stats collection API when the new API has matured enough.
|
2016-12-13 02:35:19 -08:00
|
|
|
// TODO(hbos): Default implementation that does nothing only exists as to not
|
|
|
|
|
// break third party projects. As soon as they have been updated this should
|
|
|
|
|
// be changed to "= 0;".
|
|
|
|
|
virtual void GetStats(RTCStatsCollectorCallback* callback) {}
|
2014-02-13 23:18:49 +00:00
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
|
2013-07-10 00:45:36 +00:00
|
|
|
const std::string& label,
|
|
|
|
|
const DataChannelInit* config) = 0;
|
|
|
|
|
|
|
|
|
|
virtual const SessionDescriptionInterface* local_description() const = 0;
|
|
|
|
|
virtual const SessionDescriptionInterface* remote_description() const = 0;
|
2016-12-20 17:56:17 -08:00
|
|
|
// A "current" description the one currently negotiated from a complete
|
|
|
|
|
// offer/answer exchange.
|
|
|
|
|
virtual const SessionDescriptionInterface* current_local_description() const {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
virtual const SessionDescriptionInterface* current_remote_description()
|
|
|
|
|
const {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
// A "pending" description is one that's part of an incomplete offer/answer
|
|
|
|
|
// exchange (thus, either an offer or a pranswer). Once the offer/answer
|
|
|
|
|
// exchange is finished, the "pending" description will become "current".
|
|
|
|
|
virtual const SessionDescriptionInterface* pending_local_description() const {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
virtual const SessionDescriptionInterface* pending_remote_description()
|
|
|
|
|
const {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Create a new offer.
|
|
|
|
|
// The CreateSessionDescriptionObserver callback will be called when done.
|
|
|
|
|
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
|
2014-08-04 18:34:16 +00:00
|
|
|
const MediaConstraintsInterface* constraints) {}
|
|
|
|
|
|
|
|
|
|
// TODO(jiayl): remove the default impl and the old interface when chromium
|
|
|
|
|
// code is updated.
|
|
|
|
|
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
|
|
|
|
|
const RTCOfferAnswerOptions& options) {}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Create an answer to an offer.
|
|
|
|
|
// The CreateSessionDescriptionObserver callback will be called when done.
|
|
|
|
|
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
2016-03-04 02:51:39 -08:00
|
|
|
const RTCOfferAnswerOptions& options) {}
|
|
|
|
|
// Deprecated - use version above.
|
|
|
|
|
// TODO(hta): Remove and remove default implementations when all callers
|
|
|
|
|
// are updated.
|
|
|
|
|
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
|
|
|
|
const MediaConstraintsInterface* constraints) {}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Sets the local session description.
|
|
|
|
|
// JsepInterface takes the ownership of |desc| even if it fails.
|
|
|
|
|
// The |observer| callback will be called when done.
|
|
|
|
|
virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
|
|
|
|
SessionDescriptionInterface* desc) = 0;
|
|
|
|
|
// Sets the remote session description.
|
|
|
|
|
// JsepInterface takes the ownership of |desc| even if it fails.
|
|
|
|
|
// The |observer| callback will be called when done.
|
|
|
|
|
virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer,
|
|
|
|
|
SessionDescriptionInterface* desc) = 0;
|
|
|
|
|
// Restarts or updates the ICE Agent process of gathering local candidates
|
|
|
|
|
// and pinging remote candidates.
|
2015-09-29 11:56:26 -07:00
|
|
|
// TODO(deadbeef): Remove once Chrome is moved over to SetConfiguration.
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual bool UpdateIce(const IceServers& configuration,
|
2015-09-29 11:56:26 -07:00
|
|
|
const MediaConstraintsInterface* constraints) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-03-04 02:51:39 -08:00
|
|
|
virtual bool UpdateIce(const IceServers& configuration) { return false; }
|
2016-11-16 19:42:04 -08:00
|
|
|
// TODO(deadbeef): Make this pure virtual once all Chrome subclasses of
|
|
|
|
|
// PeerConnectionInterface implement it.
|
|
|
|
|
virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() {
|
|
|
|
|
return PeerConnectionInterface::RTCConfiguration();
|
|
|
|
|
}
|
2017-01-11 12:28:30 -08:00
|
|
|
|
2015-09-29 11:56:26 -07:00
|
|
|
// Sets the PeerConnection's global configuration to |config|.
|
2017-01-11 12:28:30 -08:00
|
|
|
//
|
|
|
|
|
// The members of |config| that may be changed are |type|, |servers|,
|
|
|
|
|
// |ice_candidate_pool_size| and |prune_turn_ports| (though the candidate
|
|
|
|
|
// pool size can't be changed after the first call to SetLocalDescription).
|
|
|
|
|
// Note that this means the BUNDLE and RTCP-multiplexing policies cannot be
|
|
|
|
|
// changed with this method.
|
|
|
|
|
//
|
2015-09-29 11:56:26 -07:00
|
|
|
// Any changes to STUN/TURN servers or ICE candidate policy will affect the
|
|
|
|
|
// next gathering phase, and cause the next call to createOffer to generate
|
2017-01-11 12:28:30 -08:00
|
|
|
// new ICE credentials, as described in JSEP. This also occurs when
|
|
|
|
|
// |prune_turn_ports| changes, for the same reasoning.
|
|
|
|
|
//
|
|
|
|
|
// If an error occurs, returns false and populates |error| if non-null:
|
|
|
|
|
// - INVALID_MODIFICATION if |config| contains a modified parameter other
|
|
|
|
|
// than one of the parameters listed above.
|
|
|
|
|
// - INVALID_RANGE if |ice_candidate_pool_size| is out of range.
|
|
|
|
|
// - SYNTAX_ERROR if parsing an ICE server URL failed.
|
|
|
|
|
// - INVALID_PARAMETER if a TURN server is missing |username| or |password|.
|
|
|
|
|
// - INTERNAL_ERROR if an unexpected error occurred.
|
|
|
|
|
//
|
2015-09-29 11:56:26 -07:00
|
|
|
// TODO(deadbeef): Make this pure virtual once all Chrome subclasses of
|
|
|
|
|
// PeerConnectionInterface implement it.
|
2017-01-11 12:28:30 -08:00
|
|
|
virtual bool SetConfiguration(
|
|
|
|
|
const PeerConnectionInterface::RTCConfiguration& config,
|
|
|
|
|
RTCError* error) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Version without error output param for backwards compatibility.
|
|
|
|
|
// TODO(deadbeef): Remove once chromium is updated.
|
2015-09-29 11:56:26 -07:00
|
|
|
virtual bool SetConfiguration(
|
2016-12-24 01:43:32 -08:00
|
|
|
const PeerConnectionInterface::RTCConfiguration& config) {
|
2015-09-29 11:56:26 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
// Provides a remote candidate to the ICE Agent.
|
|
|
|
|
// A copy of the |candidate| will be created and added to the remote
|
|
|
|
|
// description. So the caller of this method still has the ownership of the
|
|
|
|
|
// |candidate|.
|
|
|
|
|
// TODO(ronghuawu): Consider to change this so that the AddIceCandidate will
|
|
|
|
|
// take the ownership of the |candidate|.
|
|
|
|
|
virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0;
|
|
|
|
|
|
2016-03-14 11:59:18 -07:00
|
|
|
// Removes a group of remote candidates from the ICE agent.
|
|
|
|
|
virtual bool RemoveIceCandidates(
|
|
|
|
|
const std::vector<cricket::Candidate>& candidates) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-08 19:54:16 +00:00
|
|
|
virtual void RegisterUMAObserver(UMAObserver* observer) = 0;
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Returns the current SignalingState.
|
|
|
|
|
virtual SignalingState signaling_state() = 0;
|
|
|
|
|
virtual IceConnectionState ice_connection_state() = 0;
|
|
|
|
|
virtual IceGatheringState ice_gathering_state() = 0;
|
|
|
|
|
|
2016-07-04 07:06:55 -07:00
|
|
|
// Starts RtcEventLog using existing file. Takes ownership of |file| and
|
|
|
|
|
// passes it on to Call, which will take the ownership. If the
|
|
|
|
|
// operation fails the file will be closed. The logging will stop
|
|
|
|
|
// automatically after 10 minutes have passed, or when the StopRtcEventLog
|
|
|
|
|
// function is called.
|
|
|
|
|
// TODO(ivoc): Make this pure virtual when Chrome is updated.
|
|
|
|
|
virtual bool StartRtcEventLog(rtc::PlatformFile file,
|
|
|
|
|
int64_t max_size_bytes) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Stops logging the RtcEventLog.
|
|
|
|
|
// TODO(ivoc): Make this pure virtual when Chrome is updated.
|
|
|
|
|
virtual void StopRtcEventLog() {}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Terminates all media and closes the transport.
|
|
|
|
|
virtual void Close() = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
// Dtor protected as objects shouldn't be deleted via this interface.
|
|
|
|
|
~PeerConnectionInterface() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// PeerConnection callback interface. Application should implement these
|
|
|
|
|
// methods.
|
|
|
|
|
class PeerConnectionObserver {
|
|
|
|
|
public:
|
|
|
|
|
enum StateType {
|
|
|
|
|
kSignalingState,
|
|
|
|
|
kIceState,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Triggered when the SignalingState changed.
|
|
|
|
|
virtual void OnSignalingChange(
|
2016-02-09 03:09:43 -08:00
|
|
|
PeerConnectionInterface::SignalingState new_state) = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-05-31 13:02:21 -07:00
|
|
|
// TODO(deadbeef): Once all subclasses override the scoped_refptr versions
|
|
|
|
|
// of the below three methods, make them pure virtual and remove the raw
|
|
|
|
|
// pointer version.
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Triggered when media is received on a new stream from remote peer.
|
2016-05-31 13:02:21 -07:00
|
|
|
virtual void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) {}
|
|
|
|
|
// Deprecated; please use the version that uses a scoped_refptr.
|
|
|
|
|
virtual void OnAddStream(MediaStreamInterface* stream) {}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Triggered when a remote peer close a stream.
|
2016-05-31 13:02:21 -07:00
|
|
|
virtual void OnRemoveStream(rtc::scoped_refptr<MediaStreamInterface> stream) {
|
|
|
|
|
}
|
|
|
|
|
// Deprecated; please use the version that uses a scoped_refptr.
|
|
|
|
|
virtual void OnRemoveStream(MediaStreamInterface* stream) {}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-05-31 13:02:21 -07:00
|
|
|
// Triggered when a remote peer opens a data channel.
|
|
|
|
|
virtual void OnDataChannel(
|
|
|
|
|
rtc::scoped_refptr<DataChannelInterface> data_channel){};
|
|
|
|
|
// Deprecated; please use the version that uses a scoped_refptr.
|
|
|
|
|
virtual void OnDataChannel(DataChannelInterface* data_channel) {}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-05-31 13:02:21 -07:00
|
|
|
// Triggered when renegotiation is needed. For example, an ICE restart
|
|
|
|
|
// has begun.
|
2014-01-13 22:04:12 +00:00
|
|
|
virtual void OnRenegotiationNeeded() = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-05-31 13:02:21 -07:00
|
|
|
// Called any time the IceConnectionState changes.
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual void OnIceConnectionChange(
|
2016-02-09 03:09:43 -08:00
|
|
|
PeerConnectionInterface::IceConnectionState new_state) = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-05-31 13:02:21 -07:00
|
|
|
// Called any time the IceGatheringState changes.
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual void OnIceGatheringChange(
|
2016-02-09 03:09:43 -08:00
|
|
|
PeerConnectionInterface::IceGatheringState new_state) = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-05-31 13:02:21 -07:00
|
|
|
// A new ICE candidate has been gathered.
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0;
|
|
|
|
|
|
2016-03-14 11:59:18 -07:00
|
|
|
// Ice candidates have been removed.
|
|
|
|
|
// TODO(honghaiz): Make this a pure virtual method when all its subclasses
|
|
|
|
|
// implement it.
|
|
|
|
|
virtual void OnIceCandidatesRemoved(
|
|
|
|
|
const std::vector<cricket::Candidate>& candidates) {}
|
|
|
|
|
|
2015-07-08 11:08:35 -07:00
|
|
|
// Called when the ICE connection receiving status changes.
|
|
|
|
|
virtual void OnIceConnectionReceivingChange(bool receiving) {}
|
|
|
|
|
|
2016-11-17 12:06:24 -08:00
|
|
|
// Called when a track is added to streams.
|
|
|
|
|
// TODO(zhihuang) Make this a pure virtual method when all its subclasses
|
|
|
|
|
// implement it.
|
|
|
|
|
virtual void OnAddTrack(
|
|
|
|
|
rtc::scoped_refptr<RtpReceiverInterface> receiver,
|
2016-12-02 15:41:10 -08:00
|
|
|
const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {}
|
2016-11-17 12:06:24 -08:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
protected:
|
|
|
|
|
// Dtor protected as objects shouldn't be deleted via this interface.
|
|
|
|
|
~PeerConnectionObserver() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// PeerConnectionFactoryInterface is the factory interface use for creating
|
|
|
|
|
// PeerConnection, MediaStream and media tracks.
|
|
|
|
|
// PeerConnectionFactoryInterface will create required libjingle threads,
|
|
|
|
|
// socket and network manager factory classes for networking.
|
|
|
|
|
// If an application decides to provide its own threads and network
|
|
|
|
|
// implementation of these classes it should use the alternate
|
|
|
|
|
// CreatePeerConnectionFactory method which accepts threads as input and use the
|
2015-12-29 14:14:52 -08:00
|
|
|
// CreatePeerConnection version that takes a PortAllocator as an
|
2013-07-10 00:45:36 +00:00
|
|
|
// argument.
|
2014-07-29 17:36:52 +00:00
|
|
|
class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
2013-10-25 21:18:33 +00:00
|
|
|
class Options {
|
|
|
|
|
public:
|
2016-01-11 15:27:03 -08:00
|
|
|
Options()
|
|
|
|
|
: disable_encryption(false),
|
|
|
|
|
disable_sctp_data_channels(false),
|
|
|
|
|
disable_network_monitor(false),
|
|
|
|
|
network_ignore_mask(rtc::kDefaultNetworkIgnoreMask),
|
2016-08-04 05:20:32 -07:00
|
|
|
ssl_max_version(rtc::SSL_PROTOCOL_DTLS_12),
|
|
|
|
|
crypto_options(rtc::CryptoOptions::NoGcm()) {}
|
2013-10-25 21:18:33 +00:00
|
|
|
bool disable_encryption;
|
|
|
|
|
bool disable_sctp_data_channels;
|
2015-10-19 09:39:32 -07:00
|
|
|
bool disable_network_monitor;
|
Makes libjingle_peerconnection_android_unittest run on networkless devices.
PeerConnectionTest.java currently works, but only on a device with
network interfaces up. This is not a problem for desktop, but it is a
problem when running on Android devices since the devices in the lab
generally don't have network (due to the chaotic radio environment in
the device labs, devices are simply kept in flight mode).
The test does work if one modifies this line in the file
webrtc/base/network.cc:
bool ignored = ((cursor->ifa_flags & IFF_LOOPBACK) ||
IsIgnoredNetwork(*network));
If we remove the IFF_LOOPBACK clause, the test starts working on
an Android device in flight mode. This is nice - we're running the
call and packets interact with the OS network stack, which is good
for this end-to-end test. We can't just remove the clause though since
having loopback is undesirable for everyone except the test (right)?
so we need to make this behavior configurable.
This CL takes a stab at a complete solution where we pass a boolean
all the way through the Java PeerConnectionFactory down to the
BasicNetworkManager. This comes as a heavy price in interface
changes though. It's pretty out of proportion, but fundamentally we
need some way of telling the network manager that it is on Android
and in test mode. Passing the boolean all the way through is one way.
Another way might be to put the loopback filter behind an ifdef and
link a custom libjingle_peerconnection.so with the test. That is hacky
but doesn't pollute the interfaces. Not sure how to solve that in GYP
but it could mean some duplication between the production and
test .so files.
It would have been perfect to use flags here, but then we need to
hook up gflags parsing to some main() somewhere to make sure the
flag gets parsed, and make sure to pass that flag in our tests.
I'm not sure how that can be done.
Making the loopback filtering conditional is exactly how we solved the
equivalent problem in content_browsertests in Chrome, and it worked
great.
That's all I could think of.
BUG=4181
R=perkj@webrtc.org, pthatcher@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/36769004
Cr-Commit-Position: refs/heads/master@{#8344}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8344 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-02-12 09:23:59 +00:00
|
|
|
|
|
|
|
|
// Sets the network types to ignore. For instance, calling this with
|
|
|
|
|
// ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and
|
|
|
|
|
// loopback interfaces.
|
|
|
|
|
int network_ignore_mask;
|
2015-05-29 09:40:39 +02:00
|
|
|
|
|
|
|
|
// Sets the maximum supported protocol version. The highest version
|
|
|
|
|
// supported by both ends will be used for the connection, i.e. if one
|
|
|
|
|
// party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used.
|
|
|
|
|
rtc::SSLProtocolVersion ssl_max_version;
|
2016-08-04 05:20:32 -07:00
|
|
|
|
|
|
|
|
// Sets crypto related options, e.g. enabled cipher suites.
|
|
|
|
|
rtc::CryptoOptions crypto_options;
|
2013-10-25 21:18:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtual void SetOptions(const Options& options) = 0;
|
2014-05-03 05:39:45 +00:00
|
|
|
|
2015-12-01 15:01:24 -08:00
|
|
|
virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
|
Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
The store was used in WebRtcSessionDescriptionFactory to generate certificates,
now a generator is used instead (new API). PeerConnection[Factory][Interface],
and WebRtcSession are updated to pass generators all the way down to the
WebRtcSessionDescriptionFactory instead of stores.
The webrtc implementation of a generator, RTCCertificateGenerator, is used as
the default generator (peerconnectionfactory.cc:189) instead of the webrtc
implementation of a store, DtlsIdentityStoreImpl.
The generator is fully parameterized and does not generate RSA-1024 unless you
ask for it (which makes sense not to do beforehand since ECDSA is now default).
The store was not fully parameterized (known filed bug).
The "top" layer, PeerConnectionFactoryInterface::CreatePeerConnection, is
updated to take a generator instead of a store. But as to not break Chromium,
the old function signature taking a store is kept. It is implemented to invoke
the generator version by wrapping the store in an
RTCCertificateGeneratorStoreWrapper. As soon as Chromium is updated to use the
new function signature we can remove the old CreatePeerConnection.
Due to having multiple CreatePeerConnection signatures, some calling places
are updated to resolve the ambiguity introduced.
BUG=webrtc:5707, webrtc:5708
R=phoglund@webrtc.org, tommi@webrtc.org
TBR=tkchin@webrc.org
Review URL: https://codereview.webrtc.org/2013523002 .
Cr-Commit-Position: refs/heads/master@{#12947}
2016-05-27 14:51:55 +02:00
|
|
|
const PeerConnectionInterface::RTCConfiguration& configuration,
|
|
|
|
|
const MediaConstraintsInterface* constraints,
|
|
|
|
|
std::unique_ptr<cricket::PortAllocator> allocator,
|
Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
The store was used in WebRtcSessionDescriptionFactory to generate certificates,
now a generator is used instead (new API). PeerConnection[Factory][Interface],
and WebRtcSession are updated to pass generators all the way down to the
WebRtcSessionDescriptionFactory instead of stores.
The webrtc implementation of a generator, RTCCertificateGenerator, is used as
the default generator (peerconnectionfactory.cc:189) instead of the webrtc
implementation of a store, DtlsIdentityStoreImpl.
The generator is fully parameterized and does not generate RSA-1024 unless you
ask for it (which makes sense not to do beforehand since ECDSA is now default).
The store was not fully parameterized (known filed bug).
The "top" layer, PeerConnectionFactoryInterface::CreatePeerConneciton, is
updated to take a generator instead of a store.
Many unittests still use a store, to allow them to continue to do so the
factory gets CreatePeerConnectionWithStore which uses the old function
signature (and invokes the new signature by wrapping the store in an
RTCCertificateGeneratorStoreWrapper). As soon as the FakeDtlsIdentityStore is
turned into a certificate generator instead of a store, the unittests will be
updated and we can remove CreatePeerConnectionWithStore.
This is a reupload of https://codereview.webrtc.org/2013523002/ with minor
changes.
BUG=webrtc:5707, webrtc:5708
R=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/2017943002 .
Cr-Commit-Position: refs/heads/master@{#12984}
2016-06-01 11:44:18 +02:00
|
|
|
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
|
Revert of Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface. (patchset #2 id:20001 of https://codereview.webrtc.org/2013523002/ )
Reason for revert:
There are more CreatePeerConnection calls than I anticipated/had found in Chromium, like remoting/protocol/webrtc_transport.cc. Reverting due to broken Chromium FYI bots.
Original issue's description:
> Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
>
> The store was used in WebRtcSessionDescriptionFactory to generate certificates,
> now a generator is used instead (new API). PeerConnection[Factory][Interface],
> and WebRtcSession are updated to pass generators all the way down to the
> WebRtcSessionDescriptionFactory instead of stores.
>
> The webrtc implementation of a generator, RTCCertificateGenerator, is used as
> the default generator (peerconnectionfactory.cc:189) instead of the webrtc
> implementation of a store, DtlsIdentityStoreImpl.
> The generator is fully parameterized and does not generate RSA-1024 unless you
> ask for it (which makes sense not to do beforehand since ECDSA is now default).
> The store was not fully parameterized (known filed bug).
>
> The "top" layer, PeerConnectionFactoryInterface::CreatePeerConnection, is
> updated to take a generator instead of a store. But as to not break Chromium,
> the old function signature taking a store is kept. It is implemented to invoke
> the generator version by wrapping the store in an
> RTCCertificateGeneratorStoreWrapper. As soon as Chromium is updated to use the
> new function signature we can remove the old CreatePeerConnection.
> Due to having multiple CreatePeerConnection signatures, some calling places
> are updated to resolve the ambiguity introduced.
>
> BUG=webrtc:5707, webrtc:5708
> R=phoglund@webrtc.org, tommi@webrtc.org
> TBR=tkchin@webrc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/400781a2091d09a725b32c6953247036b22478e8
TBR=tkchin@webrtc.org,tommi@webrtc.org,phoglund@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5707, webrtc:5708
Review-Url: https://codereview.webrtc.org/2020633002
Cr-Commit-Position: refs/heads/master@{#12948}
2016-05-27 06:08:53 -07:00
|
|
|
PeerConnectionObserver* observer) = 0;
|
2014-05-03 05:39:45 +00:00
|
|
|
|
2016-03-04 02:51:39 -08:00
|
|
|
virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
|
Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
The store was used in WebRtcSessionDescriptionFactory to generate certificates,
now a generator is used instead (new API). PeerConnection[Factory][Interface],
and WebRtcSession are updated to pass generators all the way down to the
WebRtcSessionDescriptionFactory instead of stores.
The webrtc implementation of a generator, RTCCertificateGenerator, is used as
the default generator (peerconnectionfactory.cc:189) instead of the webrtc
implementation of a store, DtlsIdentityStoreImpl.
The generator is fully parameterized and does not generate RSA-1024 unless you
ask for it (which makes sense not to do beforehand since ECDSA is now default).
The store was not fully parameterized (known filed bug).
The "top" layer, PeerConnectionFactoryInterface::CreatePeerConnection, is
updated to take a generator instead of a store. But as to not break Chromium,
the old function signature taking a store is kept. It is implemented to invoke
the generator version by wrapping the store in an
RTCCertificateGeneratorStoreWrapper. As soon as Chromium is updated to use the
new function signature we can remove the old CreatePeerConnection.
Due to having multiple CreatePeerConnection signatures, some calling places
are updated to resolve the ambiguity introduced.
BUG=webrtc:5707, webrtc:5708
R=phoglund@webrtc.org, tommi@webrtc.org
TBR=tkchin@webrc.org
Review URL: https://codereview.webrtc.org/2013523002 .
Cr-Commit-Position: refs/heads/master@{#12947}
2016-05-27 14:51:55 +02:00
|
|
|
const PeerConnectionInterface::RTCConfiguration& configuration,
|
|
|
|
|
std::unique_ptr<cricket::PortAllocator> allocator,
|
Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
The store was used in WebRtcSessionDescriptionFactory to generate certificates,
now a generator is used instead (new API). PeerConnection[Factory][Interface],
and WebRtcSession are updated to pass generators all the way down to the
WebRtcSessionDescriptionFactory instead of stores.
The webrtc implementation of a generator, RTCCertificateGenerator, is used as
the default generator (peerconnectionfactory.cc:189) instead of the webrtc
implementation of a store, DtlsIdentityStoreImpl.
The generator is fully parameterized and does not generate RSA-1024 unless you
ask for it (which makes sense not to do beforehand since ECDSA is now default).
The store was not fully parameterized (known filed bug).
The "top" layer, PeerConnectionFactoryInterface::CreatePeerConneciton, is
updated to take a generator instead of a store.
Many unittests still use a store, to allow them to continue to do so the
factory gets CreatePeerConnectionWithStore which uses the old function
signature (and invokes the new signature by wrapping the store in an
RTCCertificateGeneratorStoreWrapper). As soon as the FakeDtlsIdentityStore is
turned into a certificate generator instead of a store, the unittests will be
updated and we can remove CreatePeerConnectionWithStore.
This is a reupload of https://codereview.webrtc.org/2013523002/ with minor
changes.
BUG=webrtc:5707, webrtc:5708
R=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/2017943002 .
Cr-Commit-Position: refs/heads/master@{#12984}
2016-06-01 11:44:18 +02:00
|
|
|
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
|
Revert of Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface. (patchset #2 id:20001 of https://codereview.webrtc.org/2013523002/ )
Reason for revert:
There are more CreatePeerConnection calls than I anticipated/had found in Chromium, like remoting/protocol/webrtc_transport.cc. Reverting due to broken Chromium FYI bots.
Original issue's description:
> Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
>
> The store was used in WebRtcSessionDescriptionFactory to generate certificates,
> now a generator is used instead (new API). PeerConnection[Factory][Interface],
> and WebRtcSession are updated to pass generators all the way down to the
> WebRtcSessionDescriptionFactory instead of stores.
>
> The webrtc implementation of a generator, RTCCertificateGenerator, is used as
> the default generator (peerconnectionfactory.cc:189) instead of the webrtc
> implementation of a store, DtlsIdentityStoreImpl.
> The generator is fully parameterized and does not generate RSA-1024 unless you
> ask for it (which makes sense not to do beforehand since ECDSA is now default).
> The store was not fully parameterized (known filed bug).
>
> The "top" layer, PeerConnectionFactoryInterface::CreatePeerConnection, is
> updated to take a generator instead of a store. But as to not break Chromium,
> the old function signature taking a store is kept. It is implemented to invoke
> the generator version by wrapping the store in an
> RTCCertificateGeneratorStoreWrapper. As soon as Chromium is updated to use the
> new function signature we can remove the old CreatePeerConnection.
> Due to having multiple CreatePeerConnection signatures, some calling places
> are updated to resolve the ambiguity introduced.
>
> BUG=webrtc:5707, webrtc:5708
> R=phoglund@webrtc.org, tommi@webrtc.org
> TBR=tkchin@webrc.org
>
> Committed: https://chromium.googlesource.com/external/webrtc/+/400781a2091d09a725b32c6953247036b22478e8
TBR=tkchin@webrtc.org,tommi@webrtc.org,phoglund@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5707, webrtc:5708
Review-Url: https://codereview.webrtc.org/2020633002
Cr-Commit-Position: refs/heads/master@{#12948}
2016-05-27 06:08:53 -07:00
|
|
|
PeerConnectionObserver* observer) = 0;
|
2016-03-04 02:51:39 -08:00
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<MediaStreamInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
CreateLocalMediaStream(const std::string& label) = 0;
|
|
|
|
|
|
|
|
|
|
// Creates a AudioSourceInterface.
|
|
|
|
|
// |constraints| decides audio processing settings but can be NULL.
|
2016-03-04 02:51:39 -08:00
|
|
|
virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
|
|
|
|
|
const cricket::AudioOptions& options) = 0;
|
|
|
|
|
// Deprecated - use version above.
|
2017-01-13 11:47:56 -08:00
|
|
|
// Can use CopyConstraintsIntoAudioOptions to bridge the gap.
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
|
2013-07-10 00:45:36 +00:00
|
|
|
const MediaConstraintsInterface* constraints) = 0;
|
|
|
|
|
|
2016-03-08 01:27:48 +01:00
|
|
|
// Creates a VideoTrackSourceInterface. The new source take ownership of
|
2016-03-04 02:51:39 -08:00
|
|
|
// |capturer|.
|
2016-03-08 01:27:48 +01:00
|
|
|
virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
|
2016-03-04 02:51:39 -08:00
|
|
|
cricket::VideoCapturer* capturer) = 0;
|
|
|
|
|
// A video source creator that allows selection of resolution and frame rate.
|
|
|
|
|
// |constraints| decides video resolution and frame rate but can
|
2013-07-10 00:45:36 +00:00
|
|
|
// be NULL.
|
2016-03-04 02:51:39 -08:00
|
|
|
// In the NULL case, use the version above.
|
2016-03-08 01:27:48 +01:00
|
|
|
virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
|
2013-07-10 00:45:36 +00:00
|
|
|
cricket::VideoCapturer* capturer,
|
|
|
|
|
const MediaConstraintsInterface* constraints) = 0;
|
|
|
|
|
|
|
|
|
|
// Creates a new local VideoTrack. The same |source| can be used in several
|
|
|
|
|
// tracks.
|
2016-03-08 01:27:48 +01:00
|
|
|
virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
|
|
|
|
|
const std::string& label,
|
|
|
|
|
VideoTrackSourceInterface* source) = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Creates an new AudioTrack. At the moment |source| can be NULL.
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<AudioTrackInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
CreateAudioTrack(const std::string& label,
|
|
|
|
|
AudioSourceInterface* source) = 0;
|
|
|
|
|
|
2013-12-13 00:21:03 +00:00
|
|
|
// Starts AEC dump using existing file. Takes ownership of |file| and passes
|
|
|
|
|
// it on to VoiceEngine (via other objects) immediately, which will take
|
2014-01-23 22:12:45 +00:00
|
|
|
// the ownerhip. If the operation fails, the file will be closed.
|
2016-01-15 03:06:36 -08:00
|
|
|
// A maximum file size in bytes can be specified. When the file size limit is
|
|
|
|
|
// reached, logging is stopped automatically. If max_size_bytes is set to a
|
|
|
|
|
// value <= 0, no limit will be used, and logging will continue until the
|
|
|
|
|
// StopAecDump function is called.
|
|
|
|
|
virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) = 0;
|
2013-12-13 00:21:03 +00:00
|
|
|
|
2015-10-22 03:25:41 -07:00
|
|
|
// Stops logging the AEC dump.
|
|
|
|
|
virtual void StopAecDump() = 0;
|
|
|
|
|
|
2016-07-04 07:06:55 -07:00
|
|
|
// This function is deprecated and will be removed when Chrome is updated to
|
|
|
|
|
// use the equivalent function on PeerConnectionInterface.
|
|
|
|
|
// TODO(ivoc) Remove after Chrome is updated.
|
2016-05-13 08:30:39 -07:00
|
|
|
virtual bool StartRtcEventLog(rtc::PlatformFile file,
|
|
|
|
|
int64_t max_size_bytes) = 0;
|
2016-07-04 07:06:55 -07:00
|
|
|
// This function is deprecated and will be removed when Chrome is updated to
|
|
|
|
|
// use the equivalent function on PeerConnectionInterface.
|
|
|
|
|
// TODO(ivoc) Remove after Chrome is updated.
|
2015-10-16 02:22:18 -07:00
|
|
|
virtual bool StartRtcEventLog(rtc::PlatformFile file) = 0;
|
|
|
|
|
|
2016-07-04 07:06:55 -07:00
|
|
|
// This function is deprecated and will be removed when Chrome is updated to
|
|
|
|
|
// use the equivalent function on PeerConnectionInterface.
|
|
|
|
|
// TODO(ivoc) Remove after Chrome is updated.
|
2015-10-16 02:22:18 -07:00
|
|
|
virtual void StopRtcEventLog() = 0;
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
protected:
|
|
|
|
|
// Dtor and ctor protected as objects shouldn't be created or deleted via
|
|
|
|
|
// this interface.
|
|
|
|
|
PeerConnectionFactoryInterface() {}
|
|
|
|
|
~PeerConnectionFactoryInterface() {} // NOLINT
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Create a new instance of PeerConnectionFactoryInterface.
|
2016-03-23 10:38:07 -07:00
|
|
|
//
|
|
|
|
|
// This method relies on the thread it's called on as the "signaling thread"
|
|
|
|
|
// for the PeerConnectionFactory it creates.
|
|
|
|
|
//
|
|
|
|
|
// As such, if the current thread is not already running an rtc::Thread message
|
|
|
|
|
// loop, an application using this method must eventually either call
|
|
|
|
|
// rtc::Thread::Current()->Run(), or call
|
|
|
|
|
// rtc::Thread::Current()->ProcessMessages() within the application's own
|
|
|
|
|
// message loop.
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<PeerConnectionFactoryInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
CreatePeerConnectionFactory();
|
|
|
|
|
|
|
|
|
|
// Create a new instance of PeerConnectionFactoryInterface.
|
2016-03-23 10:38:07 -07:00
|
|
|
//
|
2016-05-17 01:52:02 -07:00
|
|
|
// |network_thread|, |worker_thread| and |signaling_thread| are
|
|
|
|
|
// the only mandatory parameters.
|
2016-03-23 10:38:07 -07:00
|
|
|
//
|
|
|
|
|
// If non-null, ownership of |default_adm|, |encoder_factory| and
|
|
|
|
|
// |decoder_factory| are transferred to the returned factory.
|
2016-05-17 01:52:02 -07:00
|
|
|
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
|
|
|
|
|
rtc::Thread* network_thread,
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::Thread* worker_thread,
|
|
|
|
|
rtc::Thread* signaling_thread,
|
2013-07-10 00:45:36 +00:00
|
|
|
AudioDeviceModule* default_adm,
|
|
|
|
|
cricket::WebRtcVideoEncoderFactory* encoder_factory,
|
|
|
|
|
cricket::WebRtcVideoDecoderFactory* decoder_factory);
|
|
|
|
|
|
2016-12-13 14:06:26 -08:00
|
|
|
// Create a new instance of PeerConnectionFactoryInterface with external audio
|
|
|
|
|
// mixer.
|
|
|
|
|
//
|
|
|
|
|
// If |audio_mixer| is null, an internal audio mixer will be created and used.
|
|
|
|
|
rtc::scoped_refptr<PeerConnectionFactoryInterface>
|
|
|
|
|
CreatePeerConnectionFactoryWithAudioMixer(
|
|
|
|
|
rtc::Thread* network_thread,
|
|
|
|
|
rtc::Thread* worker_thread,
|
|
|
|
|
rtc::Thread* signaling_thread,
|
|
|
|
|
AudioDeviceModule* default_adm,
|
|
|
|
|
cricket::WebRtcVideoEncoderFactory* encoder_factory,
|
|
|
|
|
cricket::WebRtcVideoDecoderFactory* decoder_factory,
|
|
|
|
|
rtc::scoped_refptr<AudioMixer> audio_mixer);
|
|
|
|
|
|
2016-05-17 01:52:02 -07:00
|
|
|
// Create a new instance of PeerConnectionFactoryInterface.
|
|
|
|
|
// Same thread is used as worker and network thread.
|
|
|
|
|
inline rtc::scoped_refptr<PeerConnectionFactoryInterface>
|
|
|
|
|
CreatePeerConnectionFactory(
|
|
|
|
|
rtc::Thread* worker_and_network_thread,
|
|
|
|
|
rtc::Thread* signaling_thread,
|
|
|
|
|
AudioDeviceModule* default_adm,
|
|
|
|
|
cricket::WebRtcVideoEncoderFactory* encoder_factory,
|
|
|
|
|
cricket::WebRtcVideoDecoderFactory* decoder_factory) {
|
|
|
|
|
return CreatePeerConnectionFactory(
|
|
|
|
|
worker_and_network_thread, worker_and_network_thread, signaling_thread,
|
|
|
|
|
default_adm, encoder_factory, decoder_factory);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#endif // WEBRTC_API_PEERCONNECTIONINTERFACE_H_
|