OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 const WebRTCConfiguration&, | 224 const WebRTCConfiguration&, |
225 WebMediaConstraints, | 225 WebMediaConstraints, |
226 ExceptionState&); | 226 ExceptionState&); |
227 void Dispose(); | 227 void Dispose(); |
228 | 228 |
229 void ScheduleDispatchEvent(Event*); | 229 void ScheduleDispatchEvent(Event*); |
230 void ScheduleDispatchEvent(Event*, std::unique_ptr<BoolFunction>); | 230 void ScheduleDispatchEvent(Event*, std::unique_ptr<BoolFunction>); |
231 void DispatchScheduledEvent(); | 231 void DispatchScheduledEvent(); |
232 MediaStreamTrack* GetLocalTrackById(const String& track_id) const; | 232 MediaStreamTrack* GetLocalTrackById(const String& track_id) const; |
233 MediaStreamTrack* GetRemoteTrackById(const String& track_id) const; | 233 MediaStreamTrack* GetRemoteTrackById(const String& track_id) const; |
234 // Senders and receivers returned by the handler are in use by the peer | |
235 // connection, a sender or receiver that is no longer in use is permanently | |
236 // inactive and does not need to be referenced anymore. These methods removes | |
237 // such senders/receivers from |rtp_senders_|/|rtp_receivers_|. | |
238 void RemoveInactiveSenders(); | |
239 void RemoveInactiveReceivers(); | |
240 | 234 |
241 void ChangeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState); | 235 void ChangeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState); |
242 void ChangeIceGatheringState( | 236 void ChangeIceGatheringState( |
243 WebRTCPeerConnectionHandlerClient::ICEGatheringState); | 237 WebRTCPeerConnectionHandlerClient::ICEGatheringState); |
244 // Changes the state immediately; does not fire an event. | 238 // Changes the state immediately; does not fire an event. |
245 // Returns true if the state was changed. | 239 // Returns true if the state was changed. |
246 bool SetIceConnectionState( | 240 bool SetIceConnectionState( |
247 WebRTCPeerConnectionHandlerClient::ICEConnectionState); | 241 WebRTCPeerConnectionHandlerClient::ICEConnectionState); |
248 // Changes the state asynchronously and fires an event immediately after | 242 // Changes the state asynchronously and fires an event immediately after |
249 // changing the state. | 243 // changing the state. |
250 void ChangeIceConnectionState( | 244 void ChangeIceConnectionState( |
251 WebRTCPeerConnectionHandlerClient::ICEConnectionState); | 245 WebRTCPeerConnectionHandlerClient::ICEConnectionState); |
252 | 246 |
253 void CloseInternal(); | 247 void CloseInternal(); |
254 | 248 |
255 void RecordRapporMetrics(); | 249 void RecordRapporMetrics(); |
256 | 250 |
257 SignalingState signaling_state_; | 251 SignalingState signaling_state_; |
258 ICEGatheringState ice_gathering_state_; | 252 ICEGatheringState ice_gathering_state_; |
259 ICEConnectionState ice_connection_state_; | 253 ICEConnectionState ice_connection_state_; |
260 | 254 |
261 // TODO(hbos): Move away from "addStream" and "removeStream" in favor of | 255 // TODO(hbos): Move away from "addStream" and "removeStream" in favor of |
262 // "addTrack" and "removeTrack". Update tracks, senders and receivers on | 256 // "addTrack" and "removeTrack". Update tracks, senders and receivers on |
263 // relevant events. https://crbug.com/705901 | 257 // relevant events. https://crbug.com/705901 |
264 MediaStreamVector local_streams_; | 258 MediaStreamVector local_streams_; |
265 MediaStreamVector remote_streams_; | 259 MediaStreamVector remote_streams_; |
266 HeapHashMap<uintptr_t, Member<RTCRtpSender>> rtp_senders_; | 260 HeapHashMap<uintptr_t, WeakMember<RTCRtpSender>> rtp_senders_; |
267 HeapHashMap<uintptr_t, Member<RTCRtpReceiver>> rtp_receivers_; | 261 HeapHashMap<uintptr_t, WeakMember<RTCRtpReceiver>> rtp_receivers_; |
268 | 262 |
269 std::unique_ptr<WebRTCPeerConnectionHandler> peer_handler_; | 263 std::unique_ptr<WebRTCPeerConnectionHandler> peer_handler_; |
270 | 264 |
271 Member<AsyncMethodRunner<RTCPeerConnection>> dispatch_scheduled_event_runner_; | 265 Member<AsyncMethodRunner<RTCPeerConnection>> dispatch_scheduled_event_runner_; |
272 HeapVector<Member<EventWrapper>> scheduled_events_; | 266 HeapVector<Member<EventWrapper>> scheduled_events_; |
273 | 267 |
274 // This handle notifies scheduler about an active connection associated | 268 // This handle notifies scheduler about an active connection associated |
275 // with a frame. Handle should be destroyed when connection is closed. | 269 // with a frame. Handle should be destroyed when connection is closed. |
276 std::unique_ptr<WebFrameScheduler::ActiveConnectionHandle> | 270 std::unique_ptr<WebFrameScheduler::ActiveConnectionHandle> |
277 connection_handle_for_scheduler_; | 271 connection_handle_for_scheduler_; |
278 | 272 |
279 bool stopped_; | 273 bool stopped_; |
280 bool closed_; | 274 bool closed_; |
281 | 275 |
282 bool has_data_channels_; // For RAPPOR metrics | 276 bool has_data_channels_; // For RAPPOR metrics |
283 }; | 277 }; |
284 | 278 |
285 } // namespace blink | 279 } // namespace blink |
286 | 280 |
287 #endif // RTCPeerConnection_h | 281 #endif // RTCPeerConnection_h |
OLD | NEW |