12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523 |
- #ifndef API_PEER_CONNECTION_INTERFACE_H_
- #define API_PEER_CONNECTION_INTERFACE_H_
- #include <stdio.h>
- #include <memory>
- #include <string>
- #include <vector>
- #include "api/adaptation/resource.h"
- #include "api/async_resolver_factory.h"
- #include "api/audio/audio_mixer.h"
- #include "api/audio_codecs/audio_decoder_factory.h"
- #include "api/audio_codecs/audio_encoder_factory.h"
- #include "api/audio_options.h"
- #include "api/call/call_factory_interface.h"
- #include "api/crypto/crypto_options.h"
- #include "api/data_channel_interface.h"
- #include "api/dtls_transport_interface.h"
- #include "api/fec_controller.h"
- #include "api/ice_transport_interface.h"
- #include "api/jsep.h"
- #include "api/media_stream_interface.h"
- #include "api/neteq/neteq_factory.h"
- #include "api/network_state_predictor.h"
- #include "api/packet_socket_factory.h"
- #include "api/rtc_error.h"
- #include "api/rtc_event_log/rtc_event_log_factory_interface.h"
- #include "api/rtc_event_log_output.h"
- #include "api/rtp_receiver_interface.h"
- #include "api/rtp_sender_interface.h"
- #include "api/rtp_transceiver_interface.h"
- #include "api/sctp_transport_interface.h"
- #include "api/set_local_description_observer_interface.h"
- #include "api/set_remote_description_observer_interface.h"
- #include "api/stats/rtc_stats_collector_callback.h"
- #include "api/stats_types.h"
- #include "api/task_queue/task_queue_factory.h"
- #include "api/transport/bitrate_settings.h"
- #include "api/transport/enums.h"
- #include "api/transport/network_control.h"
- #include "api/transport/sctp_transport_factory_interface.h"
- #include "api/transport/webrtc_key_value_config.h"
- #include "api/turn_customizer.h"
- #include "media/base/media_config.h"
- #include "media/base/media_engine.h"
- #include "p2p/base/port_allocator.h"
- #include "rtc_base/network_monitor_factory.h"
- #include "rtc_base/rtc_certificate.h"
- #include "rtc_base/rtc_certificate_generator.h"
- #include "rtc_base/socket_address.h"
- #include "rtc_base/ssl_certificate.h"
- #include "rtc_base/ssl_stream_adapter.h"
- #include "rtc_base/system/rtc_export.h"
- namespace rtc {
- class Thread;
- }
- namespace webrtc {
- class StreamCollectionInterface : public rtc::RefCountInterface {
- public:
-
- 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:
-
- ~StreamCollectionInterface() override = default;
- };
- class StatsObserver : public rtc::RefCountInterface {
- public:
- virtual void OnComplete(const StatsReports& reports) = 0;
- protected:
- ~StatsObserver() override = default;
- };
- enum class SdpSemantics { kPlanB, kUnifiedPlan };
- class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
- public:
-
- enum SignalingState {
- kStable,
- kHaveLocalOffer,
- kHaveLocalPrAnswer,
- kHaveRemoteOffer,
- kHaveRemotePrAnswer,
- kClosed,
- };
-
- enum IceGatheringState {
- kIceGatheringNew,
- kIceGatheringGathering,
- kIceGatheringComplete
- };
-
- enum class PeerConnectionState {
- kNew,
- kConnecting,
- kConnected,
- kDisconnected,
- kFailed,
- kClosed,
- };
-
- enum IceConnectionState {
- kIceConnectionNew,
- kIceConnectionChecking,
- kIceConnectionConnected,
- kIceConnectionCompleted,
- kIceConnectionFailed,
- kIceConnectionDisconnected,
- kIceConnectionClosed,
- kIceConnectionMax,
- };
-
- enum TlsCertPolicy {
-
-
- kTlsCertPolicySecure,
-
-
-
- kTlsCertPolicyInsecureNoCheck,
- };
- struct RTC_EXPORT IceServer {
- IceServer();
- IceServer(const IceServer&);
- ~IceServer();
-
-
-
-
- std::string uri;
- std::vector<std::string> urls;
- std::string username;
- std::string password;
- TlsCertPolicy tls_cert_policy = kTlsCertPolicySecure;
-
-
-
-
- std::string hostname;
-
- std::vector<std::string> tls_alpn_protocols;
-
- std::vector<std::string> tls_elliptic_curves;
- bool operator==(const IceServer& o) const {
- return uri == o.uri && urls == o.urls && username == o.username &&
- password == o.password && tls_cert_policy == o.tls_cert_policy &&
- hostname == o.hostname &&
- tls_alpn_protocols == o.tls_alpn_protocols &&
- tls_elliptic_curves == o.tls_elliptic_curves;
- }
- bool operator!=(const IceServer& o) const { return !(*this == o); }
- };
- typedef std::vector<IceServer> IceServers;
- enum IceTransportsType {
-
-
- kNone,
- kRelay,
- kNoHost,
- kAll
- };
-
- enum BundlePolicy {
- kBundlePolicyBalanced,
- kBundlePolicyMaxBundle,
- kBundlePolicyMaxCompat
- };
-
- enum RtcpMuxPolicy {
- kRtcpMuxPolicyNegotiate,
- kRtcpMuxPolicyRequire,
- };
- enum TcpCandidatePolicy {
- kTcpCandidatePolicyEnabled,
- kTcpCandidatePolicyDisabled
- };
- enum CandidateNetworkPolicy {
- kCandidateNetworkPolicyAll,
- kCandidateNetworkPolicyLowCost
- };
- enum ContinualGatheringPolicy { GATHER_ONCE, GATHER_CONTINUALLY };
- enum class RTCConfigurationType {
-
-
- kSafe,
-
-
- kAggressive
- };
-
-
-
-
-
-
- struct RTC_EXPORT RTCConfiguration {
-
-
-
-
-
- RTCConfiguration();
- RTCConfiguration(const RTCConfiguration&);
- explicit RTCConfiguration(RTCConfigurationType type);
- ~RTCConfiguration();
- bool operator==(const RTCConfiguration& o) const;
- bool operator!=(const RTCConfiguration& o) const;
- bool dscp() const { return media_config.enable_dscp; }
- void set_dscp(bool enable) { media_config.enable_dscp = enable; }
- bool cpu_adaptation() const {
- return media_config.video.enable_cpu_adaptation;
- }
- void set_cpu_adaptation(bool enable) {
- media_config.video.enable_cpu_adaptation = enable;
- }
- bool suspend_below_min_bitrate() const {
- return media_config.video.suspend_below_min_bitrate;
- }
- void set_suspend_below_min_bitrate(bool enable) {
- media_config.video.suspend_below_min_bitrate = enable;
- }
- bool prerenderer_smoothing() const {
- return media_config.video.enable_prerenderer_smoothing;
- }
- void set_prerenderer_smoothing(bool enable) {
- media_config.video.enable_prerenderer_smoothing = enable;
- }
- bool experiment_cpu_load_estimator() const {
- return media_config.video.experiment_cpu_load_estimator;
- }
- void set_experiment_cpu_load_estimator(bool enable) {
- media_config.video.experiment_cpu_load_estimator = enable;
- }
- int audio_rtcp_report_interval_ms() const {
- return media_config.audio.rtcp_report_interval_ms;
- }
- void set_audio_rtcp_report_interval_ms(int audio_rtcp_report_interval_ms) {
- media_config.audio.rtcp_report_interval_ms =
- audio_rtcp_report_interval_ms;
- }
- int video_rtcp_report_interval_ms() const {
- return media_config.video.rtcp_report_interval_ms;
- }
- void set_video_rtcp_report_interval_ms(int video_rtcp_report_interval_ms) {
- media_config.video.rtcp_report_interval_ms =
- video_rtcp_report_interval_ms;
- }
- static const int kUndefined = -1;
-
- static const int kAudioJitterBufferMaxPackets = 200;
-
- static const int kAggressiveIceConnectionReceivingTimeout = 1000;
-
-
-
-
-
-
- IceServers servers;
-
-
- IceTransportsType type = kAll;
- BundlePolicy bundle_policy = kBundlePolicyBalanced;
- RtcpMuxPolicy rtcp_mux_policy = kRtcpMuxPolicyRequire;
- std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates;
- int ice_candidate_pool_size = 0;
-
-
-
-
-
-
-
-
-
-
- bool disable_ipv6 = false;
-
-
-
-
- bool disable_ipv6_on_wifi = false;
-
-
-
-
-
- int max_ipv6_networks = cricket::kDefaultMaxIPv6Networks;
-
-
- bool disable_link_local_networks = false;
-
-
-
-
- bool enable_rtp_data_channel = false;
-
-
-
- absl::optional<int> screencast_min_bitrate;
-
- absl::optional<bool> combined_audio_video_bwe;
-
-
-
-
- absl::optional<bool> enable_dtls_srtp;
-
-
-
-
- TcpCandidatePolicy tcp_candidate_policy = kTcpCandidatePolicyEnabled;
-
-
-
-
- CandidateNetworkPolicy candidate_network_policy =
- kCandidateNetworkPolicyAll;
-
-
- int audio_jitter_buffer_max_packets = kAudioJitterBufferMaxPackets;
-
-
- bool audio_jitter_buffer_fast_accelerate = false;
-
- int audio_jitter_buffer_min_delay_ms = 0;
-
-
- bool audio_jitter_buffer_enable_rtx_handling = false;
-
-
-
- int ice_connection_receiving_timeout = kUndefined;
-
-
-
-
-
-
-
- int ice_backup_candidate_pair_ping_interval = kUndefined;
-
-
-
-
- ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE;
-
-
-
- bool prioritize_most_likely_ice_candidate_pairs = false;
-
-
-
- struct cricket::MediaConfig media_config;
-
-
-
-
-
- bool prune_turn_ports = false;
-
- PortPrunePolicy turn_port_prune_policy = NO_PRUNE;
- PortPrunePolicy GetTurnPortPrunePolicy() const {
- return prune_turn_ports ? PRUNE_BASED_ON_PRIORITY
- : turn_port_prune_policy;
- }
-
-
-
-
- bool presume_writable_when_fully_relayed = false;
-
-
-
- bool enable_ice_renomination = false;
-
-
-
-
-
-
- bool redetermine_role_on_ice_restart = true;
-
-
-
-
-
-
-
-
-
- bool surface_ice_candidates_on_ice_transport_type_changed = false;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- absl::optional<int> ice_check_interval_strong_connectivity;
- absl::optional<int> ice_check_interval_weak_connectivity;
- absl::optional<int> ice_check_min_interval;
-
-
-
- absl::optional<int> ice_unwritable_timeout;
-
-
-
- absl::optional<int> ice_unwritable_min_checks;
-
-
-
- absl::optional<int> ice_inactive_timeout;
-
-
- absl::optional<int> stun_candidate_keepalive_interval;
-
-
-
-
- webrtc::TurnCustomizer* turn_customizer = nullptr;
-
-
-
-
- absl::optional<rtc::AdapterType> network_preference;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SdpSemantics sdp_semantics = SdpSemantics::kPlanB;
-
-
-
-
-
-
- bool active_reset_srtp_params = false;
-
-
-
- absl::optional<CryptoOptions> crypto_options;
-
-
-
-
-
-
- bool offer_extmap_allow_mixed = false;
-
-
-
-
- std::string turn_logging_id;
-
- bool enable_implicit_rollback = false;
-
- absl::optional<bool> allow_codec_switching;
-
-
-
- };
-
- struct RTCOfferAnswerOptions {
- static const int kUndefined = -1;
- static const int kMaxOfferToReceiveMedia = 1;
-
- static const int kOfferToReceiveMediaTrue = 1;
-
-
-
-
-
-
-
-
-
-
- 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;
-
-
- bool raw_packetization_for_video = false;
-
- int num_simulcast_layers = 1;
-
-
- bool use_obsolete_sctp_sdp = false;
- RTCOfferAnswerOptions() = default;
- 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) {}
- };
-
-
-
-
- enum StatsOutputLevel {
- kStatsOutputLevelStandard,
- kStatsOutputLevelDebug,
- };
-
-
-
- virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams() = 0;
-
-
-
- virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams() = 0;
-
-
-
-
-
-
-
-
-
-
-
-
- virtual bool AddStream(MediaStreamInterface* stream) = 0;
-
-
-
-
-
-
- virtual void RemoveStream(MediaStreamInterface* stream) = 0;
-
-
-
-
-
-
-
-
- virtual RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrack(
- rtc::scoped_refptr<MediaStreamTrackInterface> track,
- const std::vector<std::string>& stream_ids) = 0;
-
-
-
- virtual bool RemoveTrack(RtpSenderInterface* sender) = 0;
-
-
-
-
-
-
-
-
-
-
- virtual RTCError RemoveTrackNew(
- rtc::scoped_refptr<RtpSenderInterface> sender);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
- AddTransceiver(rtc::scoped_refptr<MediaStreamTrackInterface> track) = 0;
- virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
- AddTransceiver(rtc::scoped_refptr<MediaStreamTrackInterface> track,
- const RtpTransceiverInit& init) = 0;
-
-
-
-
-
- virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
- AddTransceiver(cricket::MediaType media_type) = 0;
- virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
- AddTransceiver(cricket::MediaType media_type,
- const RtpTransceiverInit& init) = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual rtc::scoped_refptr<RtpSenderInterface> CreateSender(
- const std::string& kind,
- const std::string& stream_id) = 0;
-
-
-
-
-
-
- virtual std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders()
- const = 0;
-
-
-
-
-
-
-
-
- virtual std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers()
- const = 0;
-
-
-
-
-
- virtual std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>
- GetTransceivers() const = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual bool GetStats(StatsObserver* observer,
- MediaStreamTrackInterface* track,
- StatsOutputLevel level) = 0;
-
-
-
-
-
-
-
-
- virtual void GetStats(RTCStatsCollectorCallback* callback) = 0;
-
-
- virtual void GetStats(
- rtc::scoped_refptr<RtpSenderInterface> selector,
- rtc::scoped_refptr<RTCStatsCollectorCallback> callback) = 0;
-
-
- virtual void GetStats(
- rtc::scoped_refptr<RtpReceiverInterface> selector,
- rtc::scoped_refptr<RTCStatsCollectorCallback> callback) = 0;
-
-
-
- virtual void ClearStatsCache() {}
-
-
-
-
-
-
-
- virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
- const std::string& label,
- const DataChannelInit* config) = 0;
-
-
-
-
-
- virtual const SessionDescriptionInterface* local_description() const = 0;
- virtual const SessionDescriptionInterface* remote_description() const = 0;
-
-
- virtual const SessionDescriptionInterface* current_local_description()
- const = 0;
- virtual const SessionDescriptionInterface* current_remote_description()
- const = 0;
-
-
-
- virtual const SessionDescriptionInterface* pending_local_description()
- const = 0;
- virtual const SessionDescriptionInterface* pending_remote_description()
- const = 0;
-
-
-
-
-
-
- virtual void RestartIce() = 0;
-
-
- virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
- const RTCOfferAnswerOptions& options) = 0;
-
-
- virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
- const RTCOfferAnswerOptions& options) = 0;
-
-
-
-
-
-
-
-
-
-
-
- virtual void SetLocalDescription(
- std::unique_ptr<SessionDescriptionInterface> desc,
- rtc::scoped_refptr<SetLocalDescriptionObserverInterface> observer) {}
-
-
-
-
-
- virtual void SetLocalDescription(
- rtc::scoped_refptr<SetLocalDescriptionObserverInterface> observer) {}
-
-
-
-
-
-
-
- virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
- SessionDescriptionInterface* desc) = 0;
- virtual void SetLocalDescription(SetSessionDescriptionObserver* observer) {}
-
-
-
-
-
-
-
- virtual void SetRemoteDescription(
- std::unique_ptr<SessionDescriptionInterface> desc,
- rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer) = 0;
-
-
-
-
-
-
-
- virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer,
- SessionDescriptionInterface* desc) {}
-
-
-
-
-
-
- virtual bool ShouldFireNegotiationNeededEvent(uint32_t event_id) {
- return true;
- }
- virtual PeerConnectionInterface::RTCConfiguration GetConfiguration() = 0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual RTCError SetConfiguration(
- const PeerConnectionInterface::RTCConfiguration& config);
-
-
-
-
-
-
-
- virtual bool AddIceCandidate(const IceCandidateInterface* candidate) = 0;
-
-
- virtual void AddIceCandidate(std::unique_ptr<IceCandidateInterface> candidate,
- std::function<void(RTCError)> callback) {}
-
-
-
- virtual bool RemoveIceCandidates(
- const std::vector<cricket::Candidate>& candidates) = 0;
-
-
-
-
-
-
- virtual RTCError SetBitrate(const BitrateSettings& bitrate) = 0;
-
-
-
-
-
-
-
- virtual void SetAudioPlayout(bool playout) {}
-
-
-
-
- virtual void SetAudioRecording(bool recording) {}
-
-
-
-
- virtual rtc::scoped_refptr<DtlsTransportInterface> LookupDtlsTransportByMid(
- const std::string& mid) = 0;
-
- virtual rtc::scoped_refptr<SctpTransportInterface> GetSctpTransport()
- const = 0;
-
- virtual SignalingState signaling_state() = 0;
-
-
-
-
- virtual IceConnectionState ice_connection_state() = 0;
-
- virtual IceConnectionState standardized_ice_connection_state() = 0;
-
- virtual PeerConnectionState peer_connection_state() = 0;
- virtual IceGatheringState ice_gathering_state() = 0;
-
-
- virtual absl::optional<bool> can_trickle_ice_candidates() {
-
- return absl::nullopt;
- }
-
-
-
-
-
-
- virtual void AddAdaptationResource(rtc::scoped_refptr<Resource> resource) {}
-
-
-
-
-
-
-
-
-
- virtual bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output,
- int64_t output_period_ms) = 0;
- virtual bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output) = 0;
-
- virtual void StopRtcEventLog() = 0;
-
-
-
-
-
-
- virtual void Close() = 0;
-
-
-
-
-
-
- virtual rtc::Thread* signaling_thread() const { return nullptr; }
- protected:
-
- ~PeerConnectionInterface() override = default;
- };
- class PeerConnectionObserver {
- public:
- virtual ~PeerConnectionObserver() = default;
-
- virtual void OnSignalingChange(
- PeerConnectionInterface::SignalingState new_state) = 0;
-
- virtual void OnAddStream(rtc::scoped_refptr<MediaStreamInterface> stream) {}
-
- virtual void OnRemoveStream(rtc::scoped_refptr<MediaStreamInterface> stream) {
- }
-
- virtual void OnDataChannel(
- rtc::scoped_refptr<DataChannelInterface> data_channel) = 0;
-
-
-
-
- virtual void OnRenegotiationNeeded() {}
-
-
-
-
-
-
-
- virtual void OnNegotiationNeededEvent(uint32_t event_id) {}
-
-
-
-
-
-
-
-
- virtual void OnIceConnectionChange(
- PeerConnectionInterface::IceConnectionState new_state) {}
-
- virtual void OnStandardizedIceConnectionChange(
- PeerConnectionInterface::IceConnectionState new_state) {}
-
- virtual void OnConnectionChange(
- PeerConnectionInterface::PeerConnectionState new_state) {}
-
- virtual void OnIceGatheringChange(
- PeerConnectionInterface::IceGatheringState new_state) = 0;
-
- virtual void OnIceCandidate(const IceCandidateInterface* candidate) = 0;
-
-
-
- virtual void OnIceCandidateError(const std::string& host_candidate,
- const std::string& url,
- int error_code,
- const std::string& error_text) {}
-
-
- virtual void OnIceCandidateError(const std::string& address,
- int port,
- const std::string& url,
- int error_code,
- const std::string& error_text) {}
-
-
-
- virtual void OnIceCandidatesRemoved(
- const std::vector<cricket::Candidate>& candidates) {}
-
- virtual void OnIceConnectionReceivingChange(bool receiving) {}
-
- virtual void OnIceSelectedCandidatePairChanged(
- const cricket::CandidatePairChangeEvent& event) {}
-
-
-
-
-
- virtual void OnAddTrack(
- rtc::scoped_refptr<RtpReceiverInterface> receiver,
- const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) {}
-
-
-
-
-
-
-
-
-
- virtual void OnTrack(
- rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {}
-
-
-
-
-
-
-
-
- virtual void OnRemoveTrack(
- rtc::scoped_refptr<RtpReceiverInterface> receiver) {}
-
-
-
-
-
-
- virtual void OnInterestingUsage(int usage_pattern) {}
- };
- struct RTC_EXPORT PeerConnectionDependencies final {
- explicit PeerConnectionDependencies(PeerConnectionObserver* observer_in);
-
- PeerConnectionDependencies(const PeerConnectionDependencies&) = delete;
- PeerConnectionDependencies& operator=(const PeerConnectionDependencies&) =
- delete;
-
- PeerConnectionDependencies(PeerConnectionDependencies&&);
- PeerConnectionDependencies& operator=(PeerConnectionDependencies&&) = default;
- ~PeerConnectionDependencies();
-
- PeerConnectionObserver* observer = nullptr;
-
-
-
-
- std::unique_ptr<cricket::PortAllocator> allocator;
- std::unique_ptr<rtc::PacketSocketFactory> packet_socket_factory;
- std::unique_ptr<webrtc::AsyncResolverFactory> async_resolver_factory;
- std::unique_ptr<webrtc::IceTransportFactory> ice_transport_factory;
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator;
- std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier;
- std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
- video_bitrate_allocator_factory;
- };
- struct RTC_EXPORT PeerConnectionFactoryDependencies final {
- PeerConnectionFactoryDependencies();
-
- PeerConnectionFactoryDependencies(const PeerConnectionFactoryDependencies&) =
- delete;
- PeerConnectionFactoryDependencies& operator=(
- const PeerConnectionFactoryDependencies&) = delete;
-
- PeerConnectionFactoryDependencies(PeerConnectionFactoryDependencies&&);
- PeerConnectionFactoryDependencies& operator=(
- PeerConnectionFactoryDependencies&&) = default;
- ~PeerConnectionFactoryDependencies();
-
- rtc::Thread* network_thread = nullptr;
- rtc::Thread* worker_thread = nullptr;
- rtc::Thread* signaling_thread = nullptr;
- std::unique_ptr<TaskQueueFactory> task_queue_factory;
- std::unique_ptr<cricket::MediaEngineInterface> media_engine;
- std::unique_ptr<CallFactoryInterface> call_factory;
- std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory;
- std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory;
- std::unique_ptr<NetworkStatePredictorFactoryInterface>
- network_state_predictor_factory;
- std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory;
-
-
-
- std::unique_ptr<rtc::NetworkMonitorFactory> network_monitor_factory;
- std::unique_ptr<NetEqFactory> neteq_factory;
- std::unique_ptr<SctpTransportFactoryInterface> sctp_factory;
- std::unique_ptr<WebRtcKeyValueConfig> trials;
- };
- class RTC_EXPORT PeerConnectionFactoryInterface
- : public rtc::RefCountInterface {
- public:
- class Options {
- public:
- Options() {}
-
-
-
- bool disable_encryption = false;
-
-
- bool disable_sctp_data_channels = false;
-
-
-
-
-
- bool disable_network_monitor = false;
-
-
-
- int network_ignore_mask = rtc::kDefaultNetworkIgnoreMask;
-
-
-
- rtc::SSLProtocolVersion ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12;
-
- CryptoOptions crypto_options = CryptoOptions::NoGcm();
- };
-
- virtual void SetOptions(const Options& options) = 0;
-
-
-
-
- virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
- const PeerConnectionInterface::RTCConfiguration& configuration,
- PeerConnectionDependencies dependencies);
-
-
-
-
-
-
-
-
-
- virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
- const PeerConnectionInterface::RTCConfiguration& configuration,
- std::unique_ptr<cricket::PortAllocator> allocator,
- std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
- PeerConnectionObserver* observer);
-
-
-
- virtual RtpCapabilities GetRtpSenderCapabilities(
- cricket::MediaType kind) const;
-
-
-
- virtual RtpCapabilities GetRtpReceiverCapabilities(
- cricket::MediaType kind) const;
- virtual rtc::scoped_refptr<MediaStreamInterface> CreateLocalMediaStream(
- const std::string& stream_id) = 0;
-
-
- virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
- const cricket::AudioOptions& options) = 0;
-
-
- virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
- const std::string& label,
- VideoTrackSourceInterface* source) = 0;
-
- virtual rtc::scoped_refptr<AudioTrackInterface> CreateAudioTrack(
- const std::string& label,
- AudioSourceInterface* source) = 0;
-
-
-
-
-
-
-
-
-
- virtual bool StartAecDump(FILE* file, int64_t max_size_bytes) {
- return false;
- }
-
- virtual void StopAecDump() = 0;
- protected:
-
-
- PeerConnectionFactoryInterface() {}
- ~PeerConnectionFactoryInterface() override = default;
- };
- RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
- CreateModularPeerConnectionFactory(
- PeerConnectionFactoryDependencies dependencies);
- }
- #endif
|