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