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

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

Powered by Google App Engine
This is Rietveld 408576698