Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: talk/app/webrtc/peerconnectioninterface.h

Issue 1520963002: Removing webrtc::PortAllocatorFactoryInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Trying to fix presubmit warning Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 virtual void OnIceComplete() {} 482 virtual void OnIceComplete() {}
483 483
484 // Called when the ICE connection receiving status changes. 484 // Called when the ICE connection receiving status changes.
485 virtual void OnIceConnectionReceivingChange(bool receiving) {} 485 virtual void OnIceConnectionReceivingChange(bool receiving) {}
486 486
487 protected: 487 protected:
488 // Dtor protected as objects shouldn't be deleted via this interface. 488 // Dtor protected as objects shouldn't be deleted via this interface.
489 ~PeerConnectionObserver() {} 489 ~PeerConnectionObserver() {}
490 }; 490 };
491 491
492 // Factory class used for creating cricket::PortAllocator that is used
493 // for ICE negotiation.
494 class PortAllocatorFactoryInterface : public rtc::RefCountInterface {
495 public:
496 struct StunConfiguration {
497 StunConfiguration(const std::string& address, int port)
498 : server(address, port) {}
499 // STUN server address and port.
500 rtc::SocketAddress server;
501 };
502
503 struct TurnConfiguration {
504 TurnConfiguration(const std::string& address,
505 int port,
506 const std::string& username,
507 const std::string& password,
508 const std::string& transport_type,
509 bool secure)
510 : server(address, port),
511 username(username),
512 password(password),
513 transport_type(transport_type),
514 secure(secure) {}
515 rtc::SocketAddress server;
516 std::string username;
517 std::string password;
518 std::string transport_type;
519 bool secure;
520 };
521
522 virtual cricket::PortAllocator* CreatePortAllocator(
523 const std::vector<StunConfiguration>& stun_servers,
524 const std::vector<TurnConfiguration>& turn_configurations) = 0;
525
526 // TODO(phoglund): Make pure virtual when Chrome's factory implements this.
527 // After this method is called, the port allocator should consider loopback
528 // network interfaces as well.
529 virtual void SetNetworkIgnoreMask(int network_ignore_mask) {
530 }
531
532 protected:
533 PortAllocatorFactoryInterface() {}
534 ~PortAllocatorFactoryInterface() {}
535 };
536
537 // PeerConnectionFactoryInterface is the factory interface use for creating 492 // PeerConnectionFactoryInterface is the factory interface use for creating
538 // PeerConnection, MediaStream and media tracks. 493 // PeerConnection, MediaStream and media tracks.
539 // PeerConnectionFactoryInterface will create required libjingle threads, 494 // PeerConnectionFactoryInterface will create required libjingle threads,
540 // socket and network manager factory classes for networking. 495 // socket and network manager factory classes for networking.
541 // If an application decides to provide its own threads and network 496 // If an application decides to provide its own threads and network
542 // implementation of these classes it should use the alternate 497 // implementation of these classes it should use the alternate
543 // CreatePeerConnectionFactory method which accepts threads as input and use the 498 // CreatePeerConnectionFactory method which accepts threads as input and use the
544 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as 499 // CreatePeerConnection version that takes a PortAllocator as an
545 // argument. 500 // argument.
546 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { 501 class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
547 public: 502 public:
548 class Options { 503 class Options {
549 public: 504 public:
550 Options() : 505 Options() :
551 disable_encryption(false), 506 disable_encryption(false),
552 disable_sctp_data_channels(false), 507 disable_sctp_data_channels(false),
553 disable_network_monitor(false), 508 disable_network_monitor(false),
554 network_ignore_mask(rtc::kDefaultNetworkIgnoreMask), 509 network_ignore_mask(rtc::kDefaultNetworkIgnoreMask),
555 ssl_max_version(rtc::SSL_PROTOCOL_DTLS_10) { 510 ssl_max_version(rtc::SSL_PROTOCOL_DTLS_10) {
556 } 511 }
557 bool disable_encryption; 512 bool disable_encryption;
558 bool disable_sctp_data_channels; 513 bool disable_sctp_data_channels;
559 bool disable_network_monitor; 514 bool disable_network_monitor;
560 515
561 // Sets the network types to ignore. For instance, calling this with 516 // Sets the network types to ignore. For instance, calling this with
562 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and 517 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and
563 // loopback interfaces. 518 // loopback interfaces.
564 int network_ignore_mask; 519 int network_ignore_mask;
565 520
566 // Sets the maximum supported protocol version. The highest version 521 // Sets the maximum supported protocol version. The highest version
567 // supported by both ends will be used for the connection, i.e. if one 522 // supported by both ends will be used for the connection, i.e. if one
568 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. 523 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used.
569 rtc::SSLProtocolVersion ssl_max_version; 524 rtc::SSLProtocolVersion ssl_max_version;
570 }; 525 };
571 526
572 virtual void SetOptions(const Options& options) = 0; 527 virtual void SetOptions(const Options& options) = 0;
573 528
574 // TODO(deadbeef): Remove this overload of CreatePeerConnection once clients
575 // are moved to the new version.
576 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
577 const PeerConnectionInterface::RTCConfiguration& configuration,
578 const MediaConstraintsInterface* constraints,
579 PortAllocatorFactoryInterface* allocator_factory,
580 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
581 PeerConnectionObserver* observer) {
582 return nullptr;
583 }
584
585 // TODO(deadbeef): Make this pure virtual once it's implemented by all
586 // subclasses.
587 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( 529 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
588 const PeerConnectionInterface::RTCConfiguration& configuration, 530 const PeerConnectionInterface::RTCConfiguration& configuration,
589 const MediaConstraintsInterface* constraints, 531 const MediaConstraintsInterface* constraints,
590 rtc::scoped_ptr<cricket::PortAllocator> allocator, 532 rtc::scoped_ptr<cricket::PortAllocator> allocator,
591 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 533 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
592 PeerConnectionObserver* observer) { 534 PeerConnectionObserver* observer) = 0;
593 return nullptr;
594 }
595
596 // TODO(hbos): Remove below version after clients are updated to above method.
597 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration,
598 // and not IceServers. RTCConfiguration is made up of ice servers and
599 // ice transport type.
600 // http://dev.w3.org/2011/webrtc/editor/webrtc.html
601 inline rtc::scoped_refptr<PeerConnectionInterface>
602 CreatePeerConnection(
603 const PeerConnectionInterface::IceServers& servers,
604 const MediaConstraintsInterface* constraints,
605 PortAllocatorFactoryInterface* allocator_factory,
606 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
607 PeerConnectionObserver* observer) {
608 PeerConnectionInterface::RTCConfiguration rtc_config;
609 rtc_config.servers = servers;
610 return CreatePeerConnection(rtc_config, constraints, allocator_factory,
611 std::move(dtls_identity_store), observer);
612 }
613 535
614 virtual rtc::scoped_refptr<MediaStreamInterface> 536 virtual rtc::scoped_refptr<MediaStreamInterface>
615 CreateLocalMediaStream(const std::string& label) = 0; 537 CreateLocalMediaStream(const std::string& label) = 0;
616 538
617 // Creates a AudioSourceInterface. 539 // Creates a AudioSourceInterface.
618 // |constraints| decides audio processing settings but can be NULL. 540 // |constraints| decides audio processing settings but can be NULL.
619 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( 541 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
620 const MediaConstraintsInterface* constraints) = 0; 542 const MediaConstraintsInterface* constraints) = 0;
621 543
622 // Creates a VideoSourceInterface. The new source take ownership of 544 // Creates a VideoSourceInterface. The new source take ownership of
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 CreatePeerConnectionFactory( 603 CreatePeerConnectionFactory(
682 rtc::Thread* worker_thread, 604 rtc::Thread* worker_thread,
683 rtc::Thread* signaling_thread, 605 rtc::Thread* signaling_thread,
684 AudioDeviceModule* default_adm, 606 AudioDeviceModule* default_adm,
685 cricket::WebRtcVideoEncoderFactory* encoder_factory, 607 cricket::WebRtcVideoEncoderFactory* encoder_factory,
686 cricket::WebRtcVideoDecoderFactory* decoder_factory); 608 cricket::WebRtcVideoDecoderFactory* decoder_factory);
687 609
688 } // namespace webrtc 610 } // namespace webrtc
689 611
690 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ 612 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/peerconnectionfactoryproxy.h ('k') | talk/app/webrtc/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698