| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 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 |
| 11 #import "ARDAppClient+Internal.h" | 11 #import "ARDAppClient+Internal.h" |
| 12 | 12 |
| 13 #import "WebRTC/RTCAVFoundationVideoSource.h" | 13 #import "WebRTC/RTCAVFoundationVideoSource.h" |
| 14 #import "WebRTC/RTCAudioTrack.h" | 14 #import "WebRTC/RTCAudioTrack.h" |
| 15 #import "WebRTC/RTCCameraVideoCapturer.h" | 15 #import "WebRTC/RTCCameraVideoCapturer.h" |
| 16 #import "WebRTC/RTCConfiguration.h" | 16 #import "WebRTC/RTCConfiguration.h" |
| 17 #import "WebRTC/RTCFileLogger.h" | 17 #import "WebRTC/RTCFileLogger.h" |
| 18 #import "WebRTC/RTCIceServer.h" | 18 #import "WebRTC/RTCIceServer.h" |
| 19 #import "WebRTC/RTCLogging.h" | 19 #import "WebRTC/RTCLogging.h" |
| 20 #import "WebRTC/RTCMediaConstraints.h" | 20 #import "WebRTC/RTCMediaConstraints.h" |
| 21 #import "WebRTC/RTCMediaStream.h" | 21 #import "WebRTC/RTCMediaStream.h" |
| 22 #import "WebRTC/RTCPeerConnectionFactory.h" | 22 #import "WebRTC/RTCPeerConnectionFactory.h" |
| 23 #import "WebRTC/RTCRtpSender.h" | 23 #import "WebRTC/RTCRtpSender.h" |
| 24 #import "WebRTC/RTCTracing.h" | 24 #import "WebRTC/RTCTracing.h" |
| 25 #import "WebRTC/RTCVideoTrack.h" | 25 #import "WebRTC/RTCVideoTrack.h" |
| 26 | 26 |
| 27 #import "ARDAppEngineClient.h" | 27 #import "ARDAppEngineClient.h" |
| 28 #import "ARDBitrateAllocationStrategy.h" |
| 28 #import "ARDJoinResponse.h" | 29 #import "ARDJoinResponse.h" |
| 29 #import "ARDMessageResponse.h" | 30 #import "ARDMessageResponse.h" |
| 30 #import "ARDSDPUtils.h" | 31 #import "ARDSDPUtils.h" |
| 31 #import "ARDSettingsModel.h" | 32 #import "ARDSettingsModel.h" |
| 32 #import "ARDSignalingMessage.h" | 33 #import "ARDSignalingMessage.h" |
| 33 #import "ARDTURNClient+Internal.h" | 34 #import "ARDTURNClient+Internal.h" |
| 34 #import "ARDUtilities.h" | 35 #import "ARDUtilities.h" |
| 35 #import "ARDWebSocketChannel.h" | 36 #import "ARDWebSocketChannel.h" |
| 36 #import "RTCIceCandidate+JSON.h" | 37 #import "RTCIceCandidate+JSON.h" |
| 37 #import "RTCSessionDescription+JSON.h" | 38 #import "RTCSessionDescription+JSON.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 } | 526 } |
| 526 self.state = kARDAppClientStateConnected; | 527 self.state = kARDAppClientStateConnected; |
| 527 | 528 |
| 528 // Create peer connection. | 529 // Create peer connection. |
| 529 RTCMediaConstraints *constraints = [self defaultPeerConnectionConstraints]; | 530 RTCMediaConstraints *constraints = [self defaultPeerConnectionConstraints]; |
| 530 RTCConfiguration *config = [[RTCConfiguration alloc] init]; | 531 RTCConfiguration *config = [[RTCConfiguration alloc] init]; |
| 531 config.iceServers = _iceServers; | 532 config.iceServers = _iceServers; |
| 532 _peerConnection = [_factory peerConnectionWithConfiguration:config | 533 _peerConnection = [_factory peerConnectionWithConfiguration:config |
| 533 constraints:constraints | 534 constraints:constraints |
| 534 delegate:self]; | 535 delegate:self]; |
| 536 |
| 537 // Create bitrate allocation strategy |
| 538 [ARDBitrateAllocationStrategy setAudioPriorityStrategy:_peerConnection |
| 539 audioTrackId:kARDAudioTrackId]; |
| 540 |
| 535 // Create AV senders. | 541 // Create AV senders. |
| 536 [self createMediaSenders]; | 542 [self createMediaSenders]; |
| 543 |
| 537 if (_isInitiator) { | 544 if (_isInitiator) { |
| 538 // Send offer. | 545 // Send offer. |
| 539 __weak ARDAppClient *weakSelf = self; | 546 __weak ARDAppClient *weakSelf = self; |
| 540 [_peerConnection offerForConstraints:[self defaultOfferConstraints] | 547 [_peerConnection offerForConstraints:[self defaultOfferConstraints] |
| 541 completionHandler:^(RTCSessionDescription *sdp, | 548 completionHandler:^(RTCSessionDescription *sdp, |
| 542 NSError *error) { | 549 NSError *error) { |
| 543 ARDAppClient *strongSelf = weakSelf; | 550 ARDAppClient *strongSelf = weakSelf; |
| 544 [strongSelf peerConnection:strongSelf.peerConnection | 551 [strongSelf peerConnection:strongSelf.peerConnection |
| 545 didCreateSessionDescription:sdp | 552 didCreateSessionDescription:sdp |
| 546 error:error]; | 553 error:error]; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 } | 687 } |
| 681 | 688 |
| 682 - (void)createMediaSenders { | 689 - (void)createMediaSenders { |
| 683 RTCMediaConstraints *constraints = [self defaultMediaAudioConstraints]; | 690 RTCMediaConstraints *constraints = [self defaultMediaAudioConstraints]; |
| 684 RTCAudioSource *source = [_factory audioSourceWithConstraints:constraints]; | 691 RTCAudioSource *source = [_factory audioSourceWithConstraints:constraints]; |
| 685 RTCAudioTrack *track = [_factory audioTrackWithSource:source | 692 RTCAudioTrack *track = [_factory audioTrackWithSource:source |
| 686 trackId:kARDAudioTrackId]; | 693 trackId:kARDAudioTrackId]; |
| 687 RTCMediaStream *stream = [_factory mediaStreamWithStreamId:kARDMediaStreamId]; | 694 RTCMediaStream *stream = [_factory mediaStreamWithStreamId:kARDMediaStreamId]; |
| 688 [stream addAudioTrack:track]; | 695 [stream addAudioTrack:track]; |
| 689 _localVideoTrack = [self createLocalVideoTrack]; | 696 _localVideoTrack = [self createLocalVideoTrack]; |
| 690 if(_localVideoTrack) { | 697 if (_localVideoTrack) { |
| 691 [stream addVideoTrack:_localVideoTrack]; | 698 [stream addVideoTrack:_localVideoTrack]; |
| 692 } | 699 } |
| 693 [_peerConnection addStream:stream]; | 700 [_peerConnection addStream:stream]; |
| 694 } | 701 } |
| 695 | 702 |
| 696 - (RTCVideoTrack *)createLocalVideoTrack { | 703 - (RTCVideoTrack *)createLocalVideoTrack { |
| 697 RTCVideoTrack* localVideoTrack = nil; | 704 RTCVideoTrack* localVideoTrack = nil; |
| 698 // The iOS simulator doesn't provide any sort of camera capture | 705 // The iOS simulator doesn't provide any sort of camera capture |
| 699 // support or emulation (http://goo.gl/rHAnC1) so don't bother | 706 // support or emulation (http://goo.gl/rHAnC1) so don't bother |
| 700 // trying to open a local stream. | 707 // trying to open a local stream. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 code:kARDAppClientErrorInvalidRoom | 835 code:kARDAppClientErrorInvalidRoom |
| 829 userInfo:@{ | 836 userInfo:@{ |
| 830 NSLocalizedDescriptionKey: @"Invalid room.", | 837 NSLocalizedDescriptionKey: @"Invalid room.", |
| 831 }]; | 838 }]; |
| 832 break; | 839 break; |
| 833 } | 840 } |
| 834 return error; | 841 return error; |
| 835 } | 842 } |
| 836 | 843 |
| 837 @end | 844 @end |
| OLD | NEW |