| 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 27 matching lines...) Expand all Loading... |
| 38 #include "talk/app/webrtc/statscollector.h" | 38 #include "talk/app/webrtc/statscollector.h" |
| 39 #include "talk/app/webrtc/streamcollection.h" | 39 #include "talk/app/webrtc/streamcollection.h" |
| 40 #include "talk/app/webrtc/webrtcsession.h" | 40 #include "talk/app/webrtc/webrtcsession.h" |
| 41 #include "webrtc/base/scoped_ptr.h" | 41 #include "webrtc/base/scoped_ptr.h" |
| 42 | 42 |
| 43 namespace webrtc { | 43 namespace webrtc { |
| 44 | 44 |
| 45 class MediaStreamObserver; | 45 class MediaStreamObserver; |
| 46 class RemoteMediaStreamFactory; | 46 class RemoteMediaStreamFactory; |
| 47 | 47 |
| 48 typedef std::vector<PortAllocatorFactoryInterface::StunConfiguration> | |
| 49 StunConfigurations; | |
| 50 typedef std::vector<PortAllocatorFactoryInterface::TurnConfiguration> | |
| 51 TurnConfigurations; | |
| 52 | |
| 53 // Populates |session_options| from |rtc_options|, and returns true if options | 48 // Populates |session_options| from |rtc_options|, and returns true if options |
| 54 // are valid. | 49 // are valid. |
| 55 bool ConvertRtcOptionsForOffer( | 50 bool ConvertRtcOptionsForOffer( |
| 56 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 51 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
| 57 cricket::MediaSessionOptions* session_options); | 52 cricket::MediaSessionOptions* session_options); |
| 58 | 53 |
| 59 // Populates |session_options| from |constraints|, and returns true if all | 54 // Populates |session_options| from |constraints|, and returns true if all |
| 60 // mandatory constraints are satisfied. | 55 // mandatory constraints are satisfied. |
| 61 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, | 56 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, |
| 62 cricket::MediaSessionOptions* session_options); | 57 cricket::MediaSessionOptions* session_options); |
| 63 | 58 |
| 64 // Parses the URLs for each server in |servers| to build |stun_config| and | 59 // Parses the URLs for each server in |servers| to build |stun_servers| and |
| 65 // |turn_config|. | 60 // |turn_servers|. |
| 66 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, | 61 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, |
| 67 StunConfigurations* stun_config, | 62 cricket::ServerAddresses* stun_servers, |
| 68 TurnConfigurations* turn_config); | 63 std::vector<cricket::RelayServerConfig>* turn_servers); |
| 69 | 64 |
| 70 // PeerConnection implements the PeerConnectionInterface interface. | 65 // PeerConnection implements the PeerConnectionInterface interface. |
| 71 // It uses WebRtcSession to implement the PeerConnection functionality. | 66 // It uses WebRtcSession to implement the PeerConnection functionality. |
| 72 class PeerConnection : public PeerConnectionInterface, | 67 class PeerConnection : public PeerConnectionInterface, |
| 73 public IceObserver, | 68 public IceObserver, |
| 74 public rtc::MessageHandler, | 69 public rtc::MessageHandler, |
| 75 public sigslot::has_slots<> { | 70 public sigslot::has_slots<> { |
| 76 public: | 71 public: |
| 77 explicit PeerConnection(PeerConnectionFactory* factory); | 72 explicit PeerConnection(PeerConnectionFactory* factory); |
| 78 | 73 |
| 79 // TODO(deadbeef): Remove this overload of Initialize once everyone is moved | |
| 80 // to the new version. | |
| 81 bool Initialize( | |
| 82 const PeerConnectionInterface::RTCConfiguration& configuration, | |
| 83 const MediaConstraintsInterface* constraints, | |
| 84 PortAllocatorFactoryInterface* allocator_factory, | |
| 85 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | |
| 86 PeerConnectionObserver* observer); | |
| 87 | |
| 88 bool Initialize( | 74 bool Initialize( |
| 89 const PeerConnectionInterface::RTCConfiguration& configuration, | 75 const PeerConnectionInterface::RTCConfiguration& configuration, |
| 90 const MediaConstraintsInterface* constraints, | 76 const MediaConstraintsInterface* constraints, |
| 91 rtc::scoped_ptr<cricket::PortAllocator> allocator, | 77 rtc::scoped_ptr<cricket::PortAllocator> allocator, |
| 92 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 78 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 93 PeerConnectionObserver* observer); | 79 PeerConnectionObserver* observer); |
| 94 | 80 |
| 95 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; | 81 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; |
| 96 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; | 82 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; |
| 97 bool AddStream(MediaStreamInterface* local_stream) override; | 83 bool AddStream(MediaStreamInterface* local_stream) override; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // because its destruction fires signals (such as VoiceChannelDestroyed) | 386 // because its destruction fires signals (such as VoiceChannelDestroyed) |
| 401 // which will trigger some final actions in PeerConnection... | 387 // which will trigger some final actions in PeerConnection... |
| 402 rtc::scoped_ptr<WebRtcSession> session_; | 388 rtc::scoped_ptr<WebRtcSession> session_; |
| 403 // ... But stats_ depends on session_ so it should be destroyed even earlier. | 389 // ... But stats_ depends on session_ so it should be destroyed even earlier. |
| 404 rtc::scoped_ptr<StatsCollector> stats_; | 390 rtc::scoped_ptr<StatsCollector> stats_; |
| 405 }; | 391 }; |
| 406 | 392 |
| 407 } // namespace webrtc | 393 } // namespace webrtc |
| 408 | 394 |
| 409 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ | 395 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ |
| OLD | NEW |