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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm

Issue 2944643002: Support building WebRTC without audio and video for IOS (Closed)
Patch Set: Reponse to comments. Created 3 years, 6 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
OLDNEW
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 void PeerConnectionDelegateAdapter::OnSignalingChange( 119 void PeerConnectionDelegateAdapter::OnSignalingChange(
120 PeerConnectionInterface::SignalingState new_state) { 120 PeerConnectionInterface::SignalingState new_state) {
121 RTCSignalingState state = 121 RTCSignalingState state =
122 [[RTCPeerConnection class] signalingStateForNativeState:new_state]; 122 [[RTCPeerConnection class] signalingStateForNativeState:new_state];
123 RTCPeerConnection *peer_connection = peer_connection_; 123 RTCPeerConnection *peer_connection = peer_connection_;
124 [peer_connection.delegate peerConnection:peer_connection 124 [peer_connection.delegate peerConnection:peer_connection
125 didChangeSignalingState:state]; 125 didChangeSignalingState:state];
126 } 126 }
127 127
128 void PeerConnectionDelegateAdapter::OnAddStream(
129 rtc::scoped_refptr<MediaStreamInterface> stream) {
130 RTCMediaStream *mediaStream =
131 [[RTCMediaStream alloc] initWithNativeMediaStream:stream];
132 RTCPeerConnection *peer_connection = peer_connection_;
133 [peer_connection.delegate peerConnection:peer_connection
134 didAddStream:mediaStream];
135 }
136
137 void PeerConnectionDelegateAdapter::OnRemoveStream(
138 rtc::scoped_refptr<MediaStreamInterface> stream) {
139 RTCMediaStream *mediaStream =
140 [[RTCMediaStream alloc] initWithNativeMediaStream:stream];
141 RTCPeerConnection *peer_connection = peer_connection_;
142 [peer_connection.delegate peerConnection:peer_connection
143 didRemoveStream:mediaStream];
144 }
145
146 void PeerConnectionDelegateAdapter::OnDataChannel( 128 void PeerConnectionDelegateAdapter::OnDataChannel(
147 rtc::scoped_refptr<DataChannelInterface> data_channel) { 129 rtc::scoped_refptr<DataChannelInterface> data_channel) {
148 RTCDataChannel *dataChannel = 130 RTCDataChannel *dataChannel =
149 [[RTCDataChannel alloc] initWithNativeDataChannel:data_channel]; 131 [[RTCDataChannel alloc] initWithNativeDataChannel:data_channel];
150 RTCPeerConnection *peer_connection = peer_connection_; 132 RTCPeerConnection *peer_connection = peer_connection_;
151 [peer_connection.delegate peerConnection:peer_connection 133 [peer_connection.delegate peerConnection:peer_connection
152 didOpenDataChannel:dataChannel]; 134 didOpenDataChannel:dataChannel];
153 } 135 }
154 136
155 void PeerConnectionDelegateAdapter::OnRenegotiationNeeded() { 137 void PeerConnectionDelegateAdapter::OnRenegotiationNeeded() {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 _peerConnection->StopRtcEventLog(); 375 _peerConnection->StopRtcEventLog();
394 _hasStartedRtcEventLog = NO; 376 _hasStartedRtcEventLog = NO;
395 } 377 }
396 378
397 - (RTCRtpSender *)senderWithKind:(NSString *)kind 379 - (RTCRtpSender *)senderWithKind:(NSString *)kind
398 streamId:(NSString *)streamId { 380 streamId:(NSString *)streamId {
399 std::string nativeKind = [NSString stdStringForString:kind]; 381 std::string nativeKind = [NSString stdStringForString:kind];
400 std::string nativeStreamId = [NSString stdStringForString:streamId]; 382 std::string nativeStreamId = [NSString stdStringForString:streamId];
401 rtc::scoped_refptr<webrtc::RtpSenderInterface> nativeSender( 383 rtc::scoped_refptr<webrtc::RtpSenderInterface> nativeSender(
402 _peerConnection->CreateSender(nativeKind, nativeStreamId)); 384 _peerConnection->CreateSender(nativeKind, nativeStreamId));
403 return nativeSender ? 385 return nativeSender ? [[RTCRtpSender alloc] initWithNativeRtpSender:nativeSend er] : nil;
404 [[RTCRtpSender alloc] initWithNativeRtpSender:nativeSender]
405 : nil;
406 } 386 }
407 387
408 - (NSArray<RTCRtpSender *> *)senders { 388 - (NSArray<RTCRtpSender *> *)senders {
409 std::vector<rtc::scoped_refptr<webrtc::RtpSenderInterface>> nativeSenders( 389 std::vector<rtc::scoped_refptr<webrtc::RtpSenderInterface>> nativeSenders(
410 _peerConnection->GetSenders()); 390 _peerConnection->GetSenders());
411 NSMutableArray *senders = [[NSMutableArray alloc] init]; 391 NSMutableArray *senders = [[NSMutableArray alloc] init];
412 for (const auto &nativeSender : nativeSenders) { 392 for (const auto &nativeSender : nativeSenders) {
413 RTCRtpSender *sender = 393 RTCRtpSender *sender = [[RTCRtpSender alloc] initWithNativeRtpSender:nativeS ender];
414 [[RTCRtpSender alloc] initWithNativeRtpSender:nativeSender];
415 [senders addObject:sender]; 394 [senders addObject:sender];
416 } 395 }
417 return senders; 396 return senders;
418 } 397 }
419 398
420 - (NSArray<RTCRtpReceiver *> *)receivers { 399 - (NSArray<RTCRtpReceiver *> *)receivers {
421 std::vector<rtc::scoped_refptr<webrtc::RtpReceiverInterface>> nativeReceivers( 400 std::vector<rtc::scoped_refptr<webrtc::RtpReceiverInterface>> nativeReceivers(
422 _peerConnection->GetReceivers()); 401 _peerConnection->GetReceivers());
423 NSMutableArray *receivers = [[NSMutableArray alloc] init]; 402 NSMutableArray *receivers = [[NSMutableArray alloc] init];
424 for (const auto &nativeReceiver : nativeReceivers) { 403 for (const auto &nativeReceiver : nativeReceivers) {
425 RTCRtpReceiver *receiver = 404 RTCRtpReceiver *receiver = [[RTCRtpReceiver alloc] initWithNativeRtpReceiver :nativeReceiver];
426 [[RTCRtpReceiver alloc] initWithNativeRtpReceiver:nativeReceiver];
427 [receivers addObject:receiver]; 405 [receivers addObject:receiver];
428 } 406 }
429 return receivers; 407 return receivers;
430 } 408 }
431 409
432 #pragma mark - Private 410 #pragma mark - Private
433 411
434 + (webrtc::PeerConnectionInterface::SignalingState)nativeSignalingStateForState: 412 + (webrtc::PeerConnectionInterface::SignalingState)nativeSignalingStateForState:
435 (RTCSignalingState)state { 413 (RTCSignalingState)state {
436 switch (state) { 414 switch (state) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 case RTCStatsOutputLevelDebug: 570 case RTCStatsOutputLevelDebug:
593 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; 571 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug;
594 } 572 }
595 } 573 }
596 574
597 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection { 575 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection {
598 return _peerConnection; 576 return _peerConnection;
599 } 577 }
600 578
601 @end 579 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698