OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 new JsepIceCandidate(candidate.transport_name(), -1, candidate)); | 193 new JsepIceCandidate(candidate.transport_name(), -1, candidate)); |
194 RTCIceCandidate* ice_candidate = [[RTCIceCandidate alloc] | 194 RTCIceCandidate* ice_candidate = [[RTCIceCandidate alloc] |
195 initWithNativeCandidate:candidate_wrapper.get()]; | 195 initWithNativeCandidate:candidate_wrapper.get()]; |
196 [ice_candidates addObject:ice_candidate]; | 196 [ice_candidates addObject:ice_candidate]; |
197 } | 197 } |
198 RTCPeerConnection* peer_connection = peer_connection_; | 198 RTCPeerConnection* peer_connection = peer_connection_; |
199 [peer_connection.delegate peerConnection:peer_connection | 199 [peer_connection.delegate peerConnection:peer_connection |
200 didRemoveIceCandidates:ice_candidates]; | 200 didRemoveIceCandidates:ice_candidates]; |
201 } | 201 } |
202 | 202 |
| 203 void PeerConnectionDelegateAdapter::OnAddTrack( |
| 204 rtc::scoped_refptr<RtpReceiverInterface> receiver, |
| 205 const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) { |
| 206 RTCRtpReceiver* rtpReceiver = |
| 207 [[RTCRtpReceiver alloc] initWithNativeRtpReceiver:receiver]; |
| 208 NSMutableArray* mediaStreams = |
| 209 [NSMutableArray arrayWithCapacity:streams.size()]; |
| 210 |
| 211 RTCPeerConnection* peer_connection = peer_connection_; |
| 212 for (const auto stream : streams) { |
| 213 RTCMediaStream *mediaStream = |
| 214 [[RTCMediaStream alloc] initWithNativeMediaStream:stream]; |
| 215 [mediaStreams addObject:mediaStream]; |
| 216 } |
| 217 if ([peer_connection.delegate |
| 218 respondsToSelector:@selector(peerConnection:didAddTrack:streams:)]) { |
| 219 [peer_connection.delegate peerConnection:peer_connection |
| 220 didAddTrack:rtpReceiver |
| 221 streams:mediaStreams]; |
| 222 } |
| 223 } |
| 224 |
203 } // namespace webrtc | 225 } // namespace webrtc |
204 | 226 |
205 | 227 |
206 @implementation RTCPeerConnection { | 228 @implementation RTCPeerConnection { |
207 NSMutableArray<RTCMediaStream *> *_localStreams; | 229 NSMutableArray<RTCMediaStream *> *_localStreams; |
208 std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer; | 230 std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer; |
209 rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection; | 231 rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection; |
210 std::unique_ptr<webrtc::MediaConstraints> _nativeConstraints; | 232 std::unique_ptr<webrtc::MediaConstraints> _nativeConstraints; |
211 BOOL _hasStartedRtcEventLog; | 233 BOOL _hasStartedRtcEventLog; |
212 } | 234 } |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 case RTCStatsOutputLevelDebug: | 608 case RTCStatsOutputLevelDebug: |
587 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; | 609 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; |
588 } | 610 } |
589 } | 611 } |
590 | 612 |
591 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection { | 613 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection { |
592 return _peerConnection; | 614 return _peerConnection; |
593 } | 615 } |
594 | 616 |
595 @end | 617 @end |
OLD | NEW |