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

Side by Side Diff: webrtc/api/peerconnection.h

Issue 1717583002: Non-constraint interfaces for all constrainable interfaces (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Review comments Created 4 years, 9 months 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
« no previous file with comments | « webrtc/api/mediaconstraintsinterface_unittest.cc ('k') | webrtc/api/peerconnection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 namespace webrtc { 26 namespace webrtc {
27 27
28 class MediaStreamObserver; 28 class MediaStreamObserver;
29 class RemoteMediaStreamFactory; 29 class RemoteMediaStreamFactory;
30 30
31 // Populates |session_options| from |rtc_options|, and returns true if options 31 // Populates |session_options| from |rtc_options|, and returns true if options
32 // are valid. 32 // are valid.
33 // |session_options|->transport_options map entries must exist in order for 33 // |session_options|->transport_options map entries must exist in order for
34 // them to be populated from |rtc_options|. 34 // them to be populated from |rtc_options|.
35 bool ConvertRtcOptionsForOffer( 35 bool ExtractMediaSessionOptions(
36 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, 36 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
37 cricket::MediaSessionOptions* session_options); 37 cricket::MediaSessionOptions* session_options);
38 38
39 // Populates |session_options| from |constraints|, and returns true if all 39 // Populates |session_options| from |constraints|, and returns true if all
40 // mandatory constraints are satisfied. 40 // mandatory constraints are satisfied.
41 // Assumes that |session_options|->transport_options map entries exist. 41 // Assumes that |session_options|->transport_options map entries exist.
42 // Will also set defaults if corresponding constraints are not present:
43 // recv_audio=true, recv_video=true, bundle_enabled=true.
44 // Other fields will be left with existing values.
45 //
46 // Deprecated. Will be removed once callers that use constraints are gone.
47 // TODO(hta): Remove when callers are gone.
48 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5617
42 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, 49 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints,
43 cricket::MediaSessionOptions* session_options); 50 cricket::MediaSessionOptions* session_options);
44 51
45 // Parses the URLs for each server in |servers| to build |stun_servers| and 52 // Parses the URLs for each server in |servers| to build |stun_servers| and
46 // |turn_servers|. 53 // |turn_servers|.
47 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, 54 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers,
48 cricket::ServerAddresses* stun_servers, 55 cricket::ServerAddresses* stun_servers,
49 std::vector<cricket::RelayServerConfig>* turn_servers); 56 std::vector<cricket::RelayServerConfig>* turn_servers);
50 57
51 // PeerConnection implements the PeerConnectionInterface interface. 58 // PeerConnection implements the PeerConnectionInterface interface.
52 // It uses WebRtcSession to implement the PeerConnection functionality. 59 // It uses WebRtcSession to implement the PeerConnection functionality.
53 class PeerConnection : public PeerConnectionInterface, 60 class PeerConnection : public PeerConnectionInterface,
54 public IceObserver, 61 public IceObserver,
55 public rtc::MessageHandler, 62 public rtc::MessageHandler,
56 public sigslot::has_slots<> { 63 public sigslot::has_slots<> {
57 public: 64 public:
58 explicit PeerConnection(PeerConnectionFactory* factory); 65 explicit PeerConnection(PeerConnectionFactory* factory);
59 66
60 bool Initialize( 67 bool Initialize(
68 const cricket::MediaConfig& media_config,
61 const PeerConnectionInterface::RTCConfiguration& configuration, 69 const PeerConnectionInterface::RTCConfiguration& configuration,
62 const MediaConstraintsInterface* constraints,
63 rtc::scoped_ptr<cricket::PortAllocator> allocator, 70 rtc::scoped_ptr<cricket::PortAllocator> allocator,
64 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 71 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
65 PeerConnectionObserver* observer); 72 PeerConnectionObserver* observer);
66 73
67 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; 74 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override;
68 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; 75 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override;
69 bool AddStream(MediaStreamInterface* local_stream) override; 76 bool AddStream(MediaStreamInterface* local_stream) override;
70 void RemoveStream(MediaStreamInterface* local_stream) override; 77 void RemoveStream(MediaStreamInterface* local_stream) override;
71 78
72 rtc::scoped_refptr<RtpSenderInterface> AddTrack( 79 rtc::scoped_refptr<RtpSenderInterface> AddTrack(
(...skipping 26 matching lines...) Expand all
99 106
100 // TODO(bemasc): Remove ice_state() when callers are removed. 107 // TODO(bemasc): Remove ice_state() when callers are removed.
101 IceState ice_state() override; 108 IceState ice_state() override;
102 IceConnectionState ice_connection_state() override; 109 IceConnectionState ice_connection_state() override;
103 IceGatheringState ice_gathering_state() override; 110 IceGatheringState ice_gathering_state() override;
104 111
105 const SessionDescriptionInterface* local_description() const override; 112 const SessionDescriptionInterface* local_description() const override;
106 const SessionDescriptionInterface* remote_description() const override; 113 const SessionDescriptionInterface* remote_description() const override;
107 114
108 // JSEP01 115 // JSEP01
116 // Deprecated, use version without constraints.
109 void CreateOffer(CreateSessionDescriptionObserver* observer, 117 void CreateOffer(CreateSessionDescriptionObserver* observer,
110 const MediaConstraintsInterface* constraints) override; 118 const MediaConstraintsInterface* constraints) override;
111 void CreateOffer(CreateSessionDescriptionObserver* observer, 119 void CreateOffer(CreateSessionDescriptionObserver* observer,
112 const RTCOfferAnswerOptions& options) override; 120 const RTCOfferAnswerOptions& options) override;
121 // Deprecated, use version without constraints.
113 void CreateAnswer(CreateSessionDescriptionObserver* observer, 122 void CreateAnswer(CreateSessionDescriptionObserver* observer,
114 const MediaConstraintsInterface* constraints) override; 123 const MediaConstraintsInterface* constraints) override;
124 void CreateAnswer(CreateSessionDescriptionObserver* observer,
125 const RTCOfferAnswerOptions& options) override;
115 void SetLocalDescription(SetSessionDescriptionObserver* observer, 126 void SetLocalDescription(SetSessionDescriptionObserver* observer,
116 SessionDescriptionInterface* desc) override; 127 SessionDescriptionInterface* desc) override;
117 void SetRemoteDescription(SetSessionDescriptionObserver* observer, 128 void SetRemoteDescription(SetSessionDescriptionObserver* observer,
118 SessionDescriptionInterface* desc) override; 129 SessionDescriptionInterface* desc) override;
119 bool SetConfiguration( 130 bool SetConfiguration(
120 const PeerConnectionInterface::RTCConfiguration& config) override; 131 const PeerConnectionInterface::RTCConfiguration& config) override;
121 bool AddIceCandidate(const IceCandidateInterface* candidate) override; 132 bool AddIceCandidate(const IceCandidateInterface* candidate) override;
122 133
123 void RegisterUMAObserver(UMAObserver* observer) override; 134 void RegisterUMAObserver(UMAObserver* observer) override;
124 135
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 215 }
205 216
206 // Returns a MediaSessionOptions struct with options decided by |options|, 217 // Returns a MediaSessionOptions struct with options decided by |options|,
207 // the local MediaStreams and DataChannels. 218 // the local MediaStreams and DataChannels.
208 virtual bool GetOptionsForOffer( 219 virtual bool GetOptionsForOffer(
209 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, 220 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
210 cricket::MediaSessionOptions* session_options); 221 cricket::MediaSessionOptions* session_options);
211 222
212 // Returns a MediaSessionOptions struct with options decided by 223 // Returns a MediaSessionOptions struct with options decided by
213 // |constraints|, the local MediaStreams and DataChannels. 224 // |constraints|, the local MediaStreams and DataChannels.
225 // Deprecated, use version without constraints.
214 virtual bool GetOptionsForAnswer( 226 virtual bool GetOptionsForAnswer(
215 const MediaConstraintsInterface* constraints, 227 const MediaConstraintsInterface* constraints,
216 cricket::MediaSessionOptions* session_options); 228 cricket::MediaSessionOptions* session_options);
229 virtual bool GetOptionsForAnswer(
230 const RTCOfferAnswerOptions& options,
231 cricket::MediaSessionOptions* session_options);
232
233 // Helper function for options processing.
234 // Deprecated.
235 virtual void FinishOptionsForAnswer(
236 cricket::MediaSessionOptions* session_options);
217 237
218 // Remove all local and remote tracks of type |media_type|. 238 // Remove all local and remote tracks of type |media_type|.
219 // Called when a media type is rejected (m-line set to port 0). 239 // Called when a media type is rejected (m-line set to port 0).
220 void RemoveTracks(cricket::MediaType media_type); 240 void RemoveTracks(cricket::MediaType media_type);
221 241
222 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, 242 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|,
223 // and existing MediaStreamTracks are removed if there is no corresponding 243 // and existing MediaStreamTracks are removed if there is no corresponding
224 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack 244 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack
225 // is created if it doesn't exist; if false, it's removed if it exists. 245 // is created if it doesn't exist; if false, it's removed if it exists.
226 // |media_type| is the type of the |streams| and can be either audio or video. 246 // |media_type| is the type of the |streams| and can be either audio or video.
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // because its destruction fires signals (such as VoiceChannelDestroyed) 396 // because its destruction fires signals (such as VoiceChannelDestroyed)
377 // which will trigger some final actions in PeerConnection... 397 // which will trigger some final actions in PeerConnection...
378 rtc::scoped_ptr<WebRtcSession> session_; 398 rtc::scoped_ptr<WebRtcSession> session_;
379 // ... But stats_ depends on session_ so it should be destroyed even earlier. 399 // ... But stats_ depends on session_ so it should be destroyed even earlier.
380 rtc::scoped_ptr<StatsCollector> stats_; 400 rtc::scoped_ptr<StatsCollector> stats_;
381 }; 401 };
382 402
383 } // namespace webrtc 403 } // namespace webrtc
384 404
385 #endif // WEBRTC_API_PEERCONNECTION_H_ 405 #endif // WEBRTC_API_PEERCONNECTION_H_
OLDNEW
« no previous file with comments | « webrtc/api/mediaconstraintsinterface_unittest.cc ('k') | webrtc/api/peerconnection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698