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

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: Fixing patch conflicts Created 5 years 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 virtual void OnIceComplete() {} 479 virtual void OnIceComplete() {}
480 480
481 // Called when the ICE connection receiving status changes. 481 // Called when the ICE connection receiving status changes.
482 virtual void OnIceConnectionReceivingChange(bool receiving) {} 482 virtual void OnIceConnectionReceivingChange(bool receiving) {}
483 483
484 protected: 484 protected:
485 // Dtor protected as objects shouldn't be deleted via this interface. 485 // Dtor protected as objects shouldn't be deleted via this interface.
486 ~PeerConnectionObserver() {} 486 ~PeerConnectionObserver() {}
487 }; 487 };
488 488
489 // Factory class used for creating cricket::PortAllocator that is used
490 // for ICE negotiation.
491 class PortAllocatorFactoryInterface : public rtc::RefCountInterface {
492 public:
493 struct StunConfiguration {
494 StunConfiguration(const std::string& address, int port)
495 : server(address, port) {}
496 // STUN server address and port.
497 rtc::SocketAddress server;
498 };
499
500 struct TurnConfiguration {
501 TurnConfiguration(const std::string& address,
502 int port,
503 const std::string& username,
504 const std::string& password,
505 const std::string& transport_type,
506 bool secure)
507 : server(address, port),
508 username(username),
509 password(password),
510 transport_type(transport_type),
511 secure(secure) {}
512 rtc::SocketAddress server;
513 std::string username;
514 std::string password;
515 std::string transport_type;
516 bool secure;
517 };
518
519 virtual cricket::PortAllocator* CreatePortAllocator(
520 const std::vector<StunConfiguration>& stun_servers,
521 const std::vector<TurnConfiguration>& turn_configurations) = 0;
522
523 // TODO(phoglund): Make pure virtual when Chrome's factory implements this.
524 // After this method is called, the port allocator should consider loopback
525 // network interfaces as well.
526 virtual void SetNetworkIgnoreMask(int network_ignore_mask) {
527 }
528
529 protected:
530 PortAllocatorFactoryInterface() {}
531 ~PortAllocatorFactoryInterface() {}
532 };
533
534 // PeerConnectionFactoryInterface is the factory interface use for creating 489 // PeerConnectionFactoryInterface is the factory interface use for creating
535 // PeerConnection, MediaStream and media tracks. 490 // PeerConnection, MediaStream and media tracks.
536 // PeerConnectionFactoryInterface will create required libjingle threads, 491 // PeerConnectionFactoryInterface will create required libjingle threads,
537 // socket and network manager factory classes for networking. 492 // socket and network manager factory classes for networking.
538 // If an application decides to provide its own threads and network 493 // If an application decides to provide its own threads and network
539 // implementation of these classes it should use the alternate 494 // implementation of these classes it should use the alternate
540 // CreatePeerConnectionFactory method which accepts threads as input and use the 495 // CreatePeerConnectionFactory method which accepts threads as input and use the
541 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as 496 // CreatePeerConnection version that takes a PortAllocator as an
542 // argument. 497 // argument.
543 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { 498 class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
544 public: 499 public:
545 class Options { 500 class Options {
546 public: 501 public:
547 Options() : 502 Options() :
548 disable_encryption(false), 503 disable_encryption(false),
549 disable_sctp_data_channels(false), 504 disable_sctp_data_channels(false),
550 disable_network_monitor(false), 505 disable_network_monitor(false),
551 network_ignore_mask(rtc::kDefaultNetworkIgnoreMask), 506 network_ignore_mask(rtc::kDefaultNetworkIgnoreMask),
552 ssl_max_version(rtc::SSL_PROTOCOL_DTLS_10) { 507 ssl_max_version(rtc::SSL_PROTOCOL_DTLS_10) {
553 } 508 }
554 bool disable_encryption; 509 bool disable_encryption;
555 bool disable_sctp_data_channels; 510 bool disable_sctp_data_channels;
556 bool disable_network_monitor; 511 bool disable_network_monitor;
557 512
558 // Sets the network types to ignore. For instance, calling this with 513 // Sets the network types to ignore. For instance, calling this with
559 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and 514 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and
560 // loopback interfaces. 515 // loopback interfaces.
561 int network_ignore_mask; 516 int network_ignore_mask;
562 517
563 // Sets the maximum supported protocol version. The highest version 518 // Sets the maximum supported protocol version. The highest version
564 // supported by both ends will be used for the connection, i.e. if one 519 // supported by both ends will be used for the connection, i.e. if one
565 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. 520 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used.
566 rtc::SSLProtocolVersion ssl_max_version; 521 rtc::SSLProtocolVersion ssl_max_version;
567 }; 522 };
568 523
569 virtual void SetOptions(const Options& options) = 0; 524 virtual void SetOptions(const Options& options) = 0;
570 525
571 // TODO(deadbeef): Remove this overload of CreatePeerConnection once clients
572 // are moved to the new version.
573 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
574 const PeerConnectionInterface::RTCConfiguration& configuration,
575 const MediaConstraintsInterface* constraints,
576 PortAllocatorFactoryInterface* allocator_factory,
577 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
578 PeerConnectionObserver* observer) {
579 return nullptr;
580 }
581
582 // TODO(deadbeef): Make this pure virtual once it's implemented by all
583 // subclasses.
584 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( 526 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
585 const PeerConnectionInterface::RTCConfiguration& configuration, 527 const PeerConnectionInterface::RTCConfiguration& configuration,
586 const MediaConstraintsInterface* constraints, 528 const MediaConstraintsInterface* constraints,
587 rtc::scoped_ptr<cricket::PortAllocator> allocator, 529 rtc::scoped_ptr<cricket::PortAllocator> allocator,
588 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 530 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
589 PeerConnectionObserver* observer) { 531 PeerConnectionObserver* observer) = 0;
590 return nullptr;
591 }
592
593 // TODO(hbos): Remove below version after clients are updated to above method.
594 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration,
595 // and not IceServers. RTCConfiguration is made up of ice servers and
596 // ice transport type.
597 // http://dev.w3.org/2011/webrtc/editor/webrtc.html
598 inline rtc::scoped_refptr<PeerConnectionInterface>
599 CreatePeerConnection(
600 const PeerConnectionInterface::IceServers& servers,
601 const MediaConstraintsInterface* constraints,
602 PortAllocatorFactoryInterface* allocator_factory,
603 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
604 PeerConnectionObserver* observer) {
605 PeerConnectionInterface::RTCConfiguration rtc_config;
606 rtc_config.servers = servers;
607 return CreatePeerConnection(rtc_config, constraints, allocator_factory,
608 std::move(dtls_identity_store), observer);
609 }
610 532
611 virtual rtc::scoped_refptr<MediaStreamInterface> 533 virtual rtc::scoped_refptr<MediaStreamInterface>
612 CreateLocalMediaStream(const std::string& label) = 0; 534 CreateLocalMediaStream(const std::string& label) = 0;
613 535
614 // Creates a AudioSourceInterface. 536 // Creates a AudioSourceInterface.
615 // |constraints| decides audio processing settings but can be NULL. 537 // |constraints| decides audio processing settings but can be NULL.
616 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( 538 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
617 const MediaConstraintsInterface* constraints) = 0; 539 const MediaConstraintsInterface* constraints) = 0;
618 540
619 // Creates a VideoSourceInterface. The new source take ownership of 541 // Creates a VideoSourceInterface. The new source take ownership of
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 CreatePeerConnectionFactory( 600 CreatePeerConnectionFactory(
679 rtc::Thread* worker_thread, 601 rtc::Thread* worker_thread,
680 rtc::Thread* signaling_thread, 602 rtc::Thread* signaling_thread,
681 AudioDeviceModule* default_adm, 603 AudioDeviceModule* default_adm,
682 cricket::WebRtcVideoEncoderFactory* encoder_factory, 604 cricket::WebRtcVideoEncoderFactory* encoder_factory,
683 cricket::WebRtcVideoDecoderFactory* decoder_factory); 605 cricket::WebRtcVideoDecoderFactory* decoder_factory);
684 606
685 } // namespace webrtc 607 } // namespace webrtc
686 608
687 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ 609 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698