| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 class MediaStreamTrack; | 51 class MediaStreamTrack; |
| 52 class RTCAnswerOptions; | 52 class RTCAnswerOptions; |
| 53 class RTCConfiguration; | 53 class RTCConfiguration; |
| 54 class RTCDTMFSender; | 54 class RTCDTMFSender; |
| 55 class RTCDataChannel; | 55 class RTCDataChannel; |
| 56 class RTCDataChannelInit; | 56 class RTCDataChannelInit; |
| 57 class RTCIceCandidateInitOrRTCIceCandidate; | 57 class RTCIceCandidateInitOrRTCIceCandidate; |
| 58 class RTCOfferOptions; | 58 class RTCOfferOptions; |
| 59 class RTCPeerConnectionErrorCallback; | 59 class RTCPeerConnectionErrorCallback; |
| 60 class RTCRtpReceiver; | 60 class RTCRtpReceiver; |
| 61 class RTCRtpSender; |
| 61 class RTCSessionDescription; | 62 class RTCSessionDescription; |
| 62 class RTCSessionDescriptionCallback; | 63 class RTCSessionDescriptionCallback; |
| 63 class RTCSessionDescriptionInit; | 64 class RTCSessionDescriptionInit; |
| 64 class RTCStatsCallback; | 65 class RTCStatsCallback; |
| 65 class ScriptState; | 66 class ScriptState; |
| 66 class VoidCallback; | 67 class VoidCallback; |
| 67 struct WebRTCConfiguration; | 68 struct WebRTCConfiguration; |
| 68 | 69 |
| 69 class RTCPeerConnection final : public EventTargetWithInlineData, | 70 class RTCPeerConnection final : public EventTargetWithInlineData, |
| 70 public WebRTCPeerConnectionHandlerClient, | 71 public WebRTCPeerConnectionHandlerClient, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 const Dictionary& media_constraints, | 144 const Dictionary& media_constraints, |
| 144 ExceptionState&); | 145 ExceptionState&); |
| 145 | 146 |
| 146 void removeStream(MediaStream*, ExceptionState&); | 147 void removeStream(MediaStream*, ExceptionState&); |
| 147 | 148 |
| 148 ScriptPromise getStats(ScriptState*, | 149 ScriptPromise getStats(ScriptState*, |
| 149 RTCStatsCallback* success_callback, | 150 RTCStatsCallback* success_callback, |
| 150 MediaStreamTrack* selector = nullptr); | 151 MediaStreamTrack* selector = nullptr); |
| 151 ScriptPromise getStats(ScriptState*); | 152 ScriptPromise getStats(ScriptState*); |
| 152 | 153 |
| 154 HeapVector<Member<RTCRtpSender>> getSenders(); |
| 153 HeapVector<Member<RTCRtpReceiver>> getReceivers(); | 155 HeapVector<Member<RTCRtpReceiver>> getReceivers(); |
| 154 | 156 |
| 155 RTCDataChannel* createDataChannel(ScriptState*, | 157 RTCDataChannel* createDataChannel(ScriptState*, |
| 156 String label, | 158 String label, |
| 157 const RTCDataChannelInit&, | 159 const RTCDataChannelInit&, |
| 158 ExceptionState&); | 160 ExceptionState&); |
| 159 | 161 |
| 160 RTCDTMFSender* createDTMFSender(MediaStreamTrack*, ExceptionState&); | 162 RTCDTMFSender* createDTMFSender(MediaStreamTrack*, ExceptionState&); |
| 161 | 163 |
| 162 void close(ExceptionState&); | 164 void close(ExceptionState&); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 222 |
| 221 RTCPeerConnection(ExecutionContext*, | 223 RTCPeerConnection(ExecutionContext*, |
| 222 const WebRTCConfiguration&, | 224 const WebRTCConfiguration&, |
| 223 WebMediaConstraints, | 225 WebMediaConstraints, |
| 224 ExceptionState&); | 226 ExceptionState&); |
| 225 void Dispose(); | 227 void Dispose(); |
| 226 | 228 |
| 227 void ScheduleDispatchEvent(Event*); | 229 void ScheduleDispatchEvent(Event*); |
| 228 void ScheduleDispatchEvent(Event*, std::unique_ptr<BoolFunction>); | 230 void ScheduleDispatchEvent(Event*, std::unique_ptr<BoolFunction>); |
| 229 void DispatchScheduledEvent(); | 231 void DispatchScheduledEvent(); |
| 230 bool HasLocalStreamWithTrackId(const String& track_id); | 232 MediaStreamTrack* GetLocalTrackById(const String& track_id) const; |
| 231 MediaStreamTrack* GetRemoteTrackById(const String& track_id) const; | 233 MediaStreamTrack* GetRemoteTrackById(const String& track_id) const; |
| 232 // Receivers returned by the handler are in use by the peer connection, a | 234 // Senders and receivers returned by the handler are in use by the peer |
| 233 // receiver that is no longer in use is permanently inactive and does not need | 235 // connection, a sender or receiver that is no longer in use is permanently |
| 234 // to be referenced anymore. Removes such receivers from |m_rtpReceivers|. | 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(); |
| 235 void RemoveInactiveReceivers(); | 239 void RemoveInactiveReceivers(); |
| 236 | 240 |
| 237 void ChangeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState); | 241 void ChangeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState); |
| 238 void ChangeIceGatheringState( | 242 void ChangeIceGatheringState( |
| 239 WebRTCPeerConnectionHandlerClient::ICEGatheringState); | 243 WebRTCPeerConnectionHandlerClient::ICEGatheringState); |
| 240 // Changes the state immediately; does not fire an event. | 244 // Changes the state immediately; does not fire an event. |
| 241 // Returns true if the state was changed. | 245 // Returns true if the state was changed. |
| 242 bool SetIceConnectionState( | 246 bool SetIceConnectionState( |
| 243 WebRTCPeerConnectionHandlerClient::ICEConnectionState); | 247 WebRTCPeerConnectionHandlerClient::ICEConnectionState); |
| 244 // Changes the state asynchronously and fires an event immediately after | 248 // Changes the state asynchronously and fires an event immediately after |
| 245 // changing the state. | 249 // changing the state. |
| 246 void ChangeIceConnectionState( | 250 void ChangeIceConnectionState( |
| 247 WebRTCPeerConnectionHandlerClient::ICEConnectionState); | 251 WebRTCPeerConnectionHandlerClient::ICEConnectionState); |
| 248 | 252 |
| 249 void CloseInternal(); | 253 void CloseInternal(); |
| 250 | 254 |
| 251 void RecordRapporMetrics(); | 255 void RecordRapporMetrics(); |
| 252 | 256 |
| 253 SignalingState signaling_state_; | 257 SignalingState signaling_state_; |
| 254 ICEGatheringState ice_gathering_state_; | 258 ICEGatheringState ice_gathering_state_; |
| 255 ICEConnectionState ice_connection_state_; | 259 ICEConnectionState ice_connection_state_; |
| 256 | 260 |
| 257 // TODO(hbos): Move away from "addStream" and "removeStream" in favor of | 261 // TODO(hbos): Move away from "addStream" and "removeStream" in favor of |
| 258 // "addTrack" and "removeTrack". Update tracks, senders and receivers on | 262 // "addTrack" and "removeTrack". Update tracks, senders and receivers on |
| 259 // relevant events. https://crbug.com/705901 | 263 // relevant events. https://crbug.com/705901 |
| 260 MediaStreamVector local_streams_; | 264 MediaStreamVector local_streams_; |
| 261 MediaStreamVector remote_streams_; | 265 MediaStreamVector remote_streams_; |
| 266 HeapHashMap<uintptr_t, Member<RTCRtpSender>> rtp_senders_; |
| 262 HeapHashMap<uintptr_t, Member<RTCRtpReceiver>> rtp_receivers_; | 267 HeapHashMap<uintptr_t, Member<RTCRtpReceiver>> rtp_receivers_; |
| 263 | 268 |
| 264 std::unique_ptr<WebRTCPeerConnectionHandler> peer_handler_; | 269 std::unique_ptr<WebRTCPeerConnectionHandler> peer_handler_; |
| 265 | 270 |
| 266 Member<AsyncMethodRunner<RTCPeerConnection>> dispatch_scheduled_event_runner_; | 271 Member<AsyncMethodRunner<RTCPeerConnection>> dispatch_scheduled_event_runner_; |
| 267 HeapVector<Member<EventWrapper>> scheduled_events_; | 272 HeapVector<Member<EventWrapper>> scheduled_events_; |
| 268 | 273 |
| 269 // This handle notifies scheduler about an active connection associated | 274 // This handle notifies scheduler about an active connection associated |
| 270 // with a frame. Handle should be destroyed when connection is closed. | 275 // with a frame. Handle should be destroyed when connection is closed. |
| 271 std::unique_ptr<WebFrameScheduler::ActiveConnectionHandle> | 276 std::unique_ptr<WebFrameScheduler::ActiveConnectionHandle> |
| 272 connection_handle_for_scheduler_; | 277 connection_handle_for_scheduler_; |
| 273 | 278 |
| 274 bool stopped_; | 279 bool stopped_; |
| 275 bool closed_; | 280 bool closed_; |
| 276 | 281 |
| 277 bool has_data_channels_; // For RAPPOR metrics | 282 bool has_data_channels_; // For RAPPOR metrics |
| 278 }; | 283 }; |
| 279 | 284 |
| 280 } // namespace blink | 285 } // namespace blink |
| 281 | 286 |
| 282 #endif // RTCPeerConnection_h | 287 #endif // RTCPeerConnection_h |
| OLD | NEW |