Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 // function OnIceCandidate. Send these candidates to the remote peer. | 66 // function OnIceCandidate. Send these candidates to the remote peer. |
| 67 | 67 |
| 68 #ifndef TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ | 68 #ifndef TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ |
| 69 #define TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ | 69 #define TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ |
| 70 | 70 |
| 71 #include <string> | 71 #include <string> |
| 72 #include <vector> | 72 #include <vector> |
| 73 | 73 |
| 74 #include "talk/app/webrtc/datachannelinterface.h" | 74 #include "talk/app/webrtc/datachannelinterface.h" |
| 75 #include "talk/app/webrtc/dtmfsenderinterface.h" | 75 #include "talk/app/webrtc/dtmfsenderinterface.h" |
| 76 #include "talk/app/webrtc/dtlsidentitystore.h" | |
| 76 #include "talk/app/webrtc/jsep.h" | 77 #include "talk/app/webrtc/jsep.h" |
| 77 #include "talk/app/webrtc/mediastreaminterface.h" | 78 #include "talk/app/webrtc/mediastreaminterface.h" |
| 78 #include "talk/app/webrtc/statstypes.h" | 79 #include "talk/app/webrtc/statstypes.h" |
| 79 #include "talk/app/webrtc/umametrics.h" | 80 #include "talk/app/webrtc/umametrics.h" |
| 80 #include "webrtc/base/fileutils.h" | 81 #include "webrtc/base/fileutils.h" |
| 81 #include "webrtc/base/network.h" | 82 #include "webrtc/base/network.h" |
| 82 #include "webrtc/base/sslstreamadapter.h" | 83 #include "webrtc/base/sslstreamadapter.h" |
| 83 #include "webrtc/base/socketaddress.h" | 84 #include "webrtc/base/socketaddress.h" |
| 84 | 85 |
| 85 namespace rtc { | 86 namespace rtc { |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 // After this method is called, the port allocator should consider loopback | 452 // After this method is called, the port allocator should consider loopback |
| 452 // network interfaces as well. | 453 // network interfaces as well. |
| 453 virtual void SetNetworkIgnoreMask(int network_ignore_mask) { | 454 virtual void SetNetworkIgnoreMask(int network_ignore_mask) { |
| 454 } | 455 } |
| 455 | 456 |
| 456 protected: | 457 protected: |
| 457 PortAllocatorFactoryInterface() {} | 458 PortAllocatorFactoryInterface() {} |
| 458 ~PortAllocatorFactoryInterface() {} | 459 ~PortAllocatorFactoryInterface() {} |
| 459 }; | 460 }; |
| 460 | 461 |
| 461 // Used to receive callbacks of DTLS identity requests. | |
| 462 class DTLSIdentityRequestObserver : public rtc::RefCountInterface { | |
| 463 public: | |
| 464 virtual void OnFailure(int error) = 0; | |
| 465 // TODO(jiayl): Unify the OnSuccess method once Chrome code is updated. | |
| 466 virtual void OnSuccess(const std::string& der_cert, | |
| 467 const std::string& der_private_key) = 0; | |
| 468 // |identity| is a scoped_ptr because rtc::SSLIdentity is not copyable and the | |
| 469 // client has to get the ownership of the object to make use of it. | |
| 470 virtual void OnSuccessWithIdentityObj( | |
| 471 rtc::scoped_ptr<rtc::SSLIdentity> identity) = 0; | |
| 472 | |
| 473 protected: | |
| 474 virtual ~DTLSIdentityRequestObserver() {} | |
| 475 }; | |
| 476 | |
| 477 class DTLSIdentityServiceInterface { | |
| 478 public: | |
| 479 // Asynchronously request a DTLS identity, including a self-signed certificate | |
| 480 // and the private key used to sign the certificate, from the identity store | |
| 481 // for the given identity name. | |
| 482 // DTLSIdentityRequestObserver::OnSuccess will be called with the identity if | |
| 483 // the request succeeded; DTLSIdentityRequestObserver::OnFailure will be | |
| 484 // called with an error code if the request failed. | |
| 485 // | |
| 486 // Only one request can be made at a time. If a second request is called | |
| 487 // before the first one completes, RequestIdentity will abort and return | |
| 488 // false. | |
| 489 // | |
| 490 // |identity_name| is an internal name selected by the client to identify an | |
| 491 // identity within an origin. E.g. an web site may cache the certificates used | |
| 492 // to communicate with differnent peers under different identity names. | |
| 493 // | |
| 494 // |common_name| is the common name used to generate the certificate. If the | |
| 495 // certificate already exists in the store, |common_name| is ignored. | |
| 496 // | |
| 497 // |observer| is the object to receive success or failure callbacks. | |
| 498 // | |
| 499 // Returns true if either OnFailure or OnSuccess will be called. | |
| 500 virtual bool RequestIdentity( | |
| 501 const std::string& identity_name, | |
| 502 const std::string& common_name, | |
| 503 DTLSIdentityRequestObserver* observer) = 0; | |
| 504 | |
| 505 virtual ~DTLSIdentityServiceInterface() {} | |
| 506 }; | |
| 507 | |
| 508 // PeerConnectionFactoryInterface is the factory interface use for creating | 462 // PeerConnectionFactoryInterface is the factory interface use for creating |
| 509 // PeerConnection, MediaStream and media tracks. | 463 // PeerConnection, MediaStream and media tracks. |
| 510 // PeerConnectionFactoryInterface will create required libjingle threads, | 464 // PeerConnectionFactoryInterface will create required libjingle threads, |
| 511 // socket and network manager factory classes for networking. | 465 // socket and network manager factory classes for networking. |
| 512 // If an application decides to provide its own threads and network | 466 // If an application decides to provide its own threads and network |
| 513 // implementation of these classes it should use the alternate | 467 // implementation of these classes it should use the alternate |
| 514 // CreatePeerConnectionFactory method which accepts threads as input and use the | 468 // CreatePeerConnectionFactory method which accepts threads as input and use the |
| 515 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as | 469 // CreatePeerConnection version that takes a PortAllocatorFactoryInterface as |
| 516 // argument. | 470 // argument. |
| 517 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { | 471 class PeerConnectionFactoryInterface : public rtc::RefCountInterface { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 533 int network_ignore_mask; | 487 int network_ignore_mask; |
| 534 | 488 |
| 535 // Sets the maximum supported protocol version. The highest version | 489 // Sets the maximum supported protocol version. The highest version |
| 536 // supported by both ends will be used for the connection, i.e. if one | 490 // supported by both ends will be used for the connection, i.e. if one |
| 537 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. | 491 // party supports DTLS 1.0 and the other DTLS 1.2, DTLS 1.0 will be used. |
| 538 rtc::SSLProtocolVersion ssl_max_version; | 492 rtc::SSLProtocolVersion ssl_max_version; |
| 539 }; | 493 }; |
| 540 | 494 |
| 541 virtual void SetOptions(const Options& options) = 0; | 495 virtual void SetOptions(const Options& options) = 0; |
| 542 | 496 |
| 543 // This method takes the ownership of |dtls_identity_service|. | |
| 544 virtual rtc::scoped_refptr<PeerConnectionInterface> | 497 virtual rtc::scoped_refptr<PeerConnectionInterface> |
| 545 CreatePeerConnection( | 498 CreatePeerConnection( |
| 546 const PeerConnectionInterface::RTCConfiguration& configuration, | 499 const PeerConnectionInterface::RTCConfiguration& configuration, |
| 547 const MediaConstraintsInterface* constraints, | 500 const MediaConstraintsInterface* constraints, |
| 548 PortAllocatorFactoryInterface* allocator_factory, | 501 PortAllocatorFactoryInterface* allocator_factory, |
| 549 DTLSIdentityServiceInterface* dtls_identity_service, | 502 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 550 PeerConnectionObserver* observer) = 0; | 503 PeerConnectionObserver* observer) = 0; |
| 551 | 504 |
| 552 // TODO(mallinath) : Remove below versions after clients are updated | 505 // TODO(mallinath) : Remove below versions after clients are updated |
|
tommi
2015/07/09 16:13:57
nit: assign to you? (or me)
hbos
2015/07/27 13:29:00
Acknowledged.
| |
| 553 // to above method. | 506 // to above method. |
| 554 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, | 507 // In latest W3C WebRTC draft, PC constructor will take RTCConfiguration, |
| 555 // and not IceServers. RTCConfiguration is made up of ice servers and | 508 // and not IceServers. RTCConfiguration is made up of ice servers and |
| 556 // ice transport type. | 509 // ice transport type. |
| 557 // http://dev.w3.org/2011/webrtc/editor/webrtc.html | 510 // http://dev.w3.org/2011/webrtc/editor/webrtc.html |
| 558 inline rtc::scoped_refptr<PeerConnectionInterface> | 511 inline rtc::scoped_refptr<PeerConnectionInterface> |
| 559 CreatePeerConnection( | 512 CreatePeerConnection( |
| 560 const PeerConnectionInterface::IceServers& servers, | 513 const PeerConnectionInterface::IceServers& servers, |
| 561 const MediaConstraintsInterface* constraints, | 514 const MediaConstraintsInterface* constraints, |
| 562 PortAllocatorFactoryInterface* allocator_factory, | 515 PortAllocatorFactoryInterface* allocator_factory, |
| 563 DTLSIdentityServiceInterface* dtls_identity_service, | 516 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 564 PeerConnectionObserver* observer) { | 517 PeerConnectionObserver* observer) { |
| 565 PeerConnectionInterface::RTCConfiguration rtc_config; | 518 PeerConnectionInterface::RTCConfiguration rtc_config; |
| 566 rtc_config.servers = servers; | 519 rtc_config.servers = servers; |
| 567 return CreatePeerConnection(rtc_config, constraints, allocator_factory, | 520 return CreatePeerConnection(rtc_config, constraints, allocator_factory, |
| 568 dtls_identity_service, observer); | 521 dtls_identity_store.Pass(), observer); |
| 569 } | 522 } |
| 570 | 523 |
| 571 virtual rtc::scoped_refptr<MediaStreamInterface> | 524 virtual rtc::scoped_refptr<MediaStreamInterface> |
| 572 CreateLocalMediaStream(const std::string& label) = 0; | 525 CreateLocalMediaStream(const std::string& label) = 0; |
| 573 | 526 |
| 574 // Creates a AudioSourceInterface. | 527 // Creates a AudioSourceInterface. |
| 575 // |constraints| decides audio processing settings but can be NULL. | 528 // |constraints| decides audio processing settings but can be NULL. |
| 576 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( | 529 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
| 577 const MediaConstraintsInterface* constraints) = 0; | 530 const MediaConstraintsInterface* constraints) = 0; |
| 578 | 531 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 CreatePeerConnectionFactory( | 572 CreatePeerConnectionFactory( |
| 620 rtc::Thread* worker_thread, | 573 rtc::Thread* worker_thread, |
| 621 rtc::Thread* signaling_thread, | 574 rtc::Thread* signaling_thread, |
| 622 AudioDeviceModule* default_adm, | 575 AudioDeviceModule* default_adm, |
| 623 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 576 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 624 cricket::WebRtcVideoDecoderFactory* decoder_factory); | 577 cricket::WebRtcVideoDecoderFactory* decoder_factory); |
| 625 | 578 |
| 626 } // namespace webrtc | 579 } // namespace webrtc |
| 627 | 580 |
| 628 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ | 581 #endif // TALK_APP_WEBRTC_PEERCONNECTIONINTERFACE_H_ |
| OLD | NEW |