| 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 | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 94 | 94 | 
| 95 - (void)timerDidFire:(NSTimer *)timer { | 95 - (void)timerDidFire:(NSTimer *)timer { | 
| 96   _timerHandler(); | 96   _timerHandler(); | 
| 97 } | 97 } | 
| 98 | 98 | 
| 99 @end | 99 @end | 
| 100 | 100 | 
| 101 @implementation ARDAppClient { | 101 @implementation ARDAppClient { | 
| 102   RTCFileLogger *_fileLogger; | 102   RTCFileLogger *_fileLogger; | 
| 103   ARDTimerProxy *_statsTimer; | 103   ARDTimerProxy *_statsTimer; | 
|  | 104   RTCMediaConstraints *_cameraConstraints; | 
| 104 } | 105 } | 
| 105 | 106 | 
| 106 @synthesize shouldGetStats = _shouldGetStats; | 107 @synthesize shouldGetStats = _shouldGetStats; | 
| 107 @synthesize state = _state; | 108 @synthesize state = _state; | 
| 108 @synthesize delegate = _delegate; | 109 @synthesize delegate = _delegate; | 
| 109 @synthesize roomServerClient = _roomServerClient; | 110 @synthesize roomServerClient = _roomServerClient; | 
| 110 @synthesize channel = _channel; | 111 @synthesize channel = _channel; | 
| 111 @synthesize loopbackChannel = _loopbackChannel; | 112 @synthesize loopbackChannel = _loopbackChannel; | 
| 112 @synthesize turnClient = _turnClient; | 113 @synthesize turnClient = _turnClient; | 
| 113 @synthesize peerConnection = _peerConnection; | 114 @synthesize peerConnection = _peerConnection; | 
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 314   [_factory stopAecDump]; | 315   [_factory stopAecDump]; | 
| 315   [_peerConnection stopRtcEventLog]; | 316   [_peerConnection stopRtcEventLog]; | 
| 316 #endif | 317 #endif | 
| 317   _peerConnection = nil; | 318   _peerConnection = nil; | 
| 318   self.state = kARDAppClientStateDisconnected; | 319   self.state = kARDAppClientStateDisconnected; | 
| 319 #if defined(WEBRTC_IOS) | 320 #if defined(WEBRTC_IOS) | 
| 320   RTCStopInternalCapture(); | 321   RTCStopInternalCapture(); | 
| 321 #endif | 322 #endif | 
| 322 } | 323 } | 
| 323 | 324 | 
|  | 325 - (void)setCameraConstraints:(RTCMediaConstraints *)mediaConstraints { | 
|  | 326   _cameraConstraints = mediaConstraints; | 
|  | 327 } | 
|  | 328 | 
| 324 #pragma mark - ARDSignalingChannelDelegate | 329 #pragma mark - ARDSignalingChannelDelegate | 
| 325 | 330 | 
| 326 - (void)channel:(id<ARDSignalingChannel>)channel | 331 - (void)channel:(id<ARDSignalingChannel>)channel | 
| 327     didReceiveMessage:(ARDSignalingMessage *)message { | 332     didReceiveMessage:(ARDSignalingMessage *)message { | 
| 328   switch (message.type) { | 333   switch (message.type) { | 
| 329     case kARDSignalingMessageTypeOffer: | 334     case kARDSignalingMessageTypeOffer: | 
| 330     case kARDSignalingMessageTypeAnswer: | 335     case kARDSignalingMessageTypeAnswer: | 
| 331       // Offers and answers must be processed before any other message, so we | 336       // Offers and answers must be processed before any other message, so we | 
| 332       // place them at the front of the queue. | 337       // place them at the front of the queue. | 
| 333       _hasReceivedSdp = YES; | 338       _hasReceivedSdp = YES; | 
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 688   return sender; | 693   return sender; | 
| 689 } | 694 } | 
| 690 | 695 | 
| 691 - (RTCVideoTrack *)createLocalVideoTrack { | 696 - (RTCVideoTrack *)createLocalVideoTrack { | 
| 692   RTCVideoTrack* localVideoTrack = nil; | 697   RTCVideoTrack* localVideoTrack = nil; | 
| 693   // The iOS simulator doesn't provide any sort of camera capture | 698   // The iOS simulator doesn't provide any sort of camera capture | 
| 694   // support or emulation (http://goo.gl/rHAnC1) so don't bother | 699   // support or emulation (http://goo.gl/rHAnC1) so don't bother | 
| 695   // trying to open a local stream. | 700   // trying to open a local stream. | 
| 696 #if !TARGET_IPHONE_SIMULATOR | 701 #if !TARGET_IPHONE_SIMULATOR | 
| 697   if (!_isAudioOnly) { | 702   if (!_isAudioOnly) { | 
| 698     RTCMediaConstraints *mediaConstraints = | 703     RTCMediaConstraints *cameraConstraints = | 
| 699         [self defaultMediaStreamConstraints]; | 704         [self cameraConstraints]; | 
| 700     RTCAVFoundationVideoSource *source = | 705     RTCAVFoundationVideoSource *source = | 
| 701         [_factory avFoundationVideoSourceWithConstraints:mediaConstraints]; | 706         [_factory avFoundationVideoSourceWithConstraints:cameraConstraints]; | 
| 702     localVideoTrack = | 707     localVideoTrack = | 
| 703         [_factory videoTrackWithSource:source | 708         [_factory videoTrackWithSource:source | 
| 704                                trackId:kARDVideoTrackId]; | 709                                trackId:kARDVideoTrackId]; | 
| 705   } | 710   } | 
| 706 #endif | 711 #endif | 
| 707   return localVideoTrack; | 712   return localVideoTrack; | 
| 708 } | 713 } | 
| 709 | 714 | 
| 710 #pragma mark - Collider methods | 715 #pragma mark - Collider methods | 
| 711 | 716 | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 730     [_loopbackChannel registerForRoomId:_roomId clientId:@"LOOPBACK_CLIENT_ID"]; | 735     [_loopbackChannel registerForRoomId:_roomId clientId:@"LOOPBACK_CLIENT_ID"]; | 
| 731   } | 736   } | 
| 732 } | 737 } | 
| 733 | 738 | 
| 734 #pragma mark - Defaults | 739 #pragma mark - Defaults | 
| 735 | 740 | 
| 736  - (RTCMediaConstraints *)defaultMediaAudioConstraints { | 741  - (RTCMediaConstraints *)defaultMediaAudioConstraints { | 
| 737    NSString *valueLevelControl = _shouldUseLevelControl ? | 742    NSString *valueLevelControl = _shouldUseLevelControl ? | 
| 738        kRTCMediaConstraintsValueTrue : kRTCMediaConstraintsValueFalse; | 743        kRTCMediaConstraintsValueTrue : kRTCMediaConstraintsValueFalse; | 
| 739    NSDictionary *mandatoryConstraints = @{ kRTCMediaConstraintsLevelControl : va
     lueLevelControl }; | 744    NSDictionary *mandatoryConstraints = @{ kRTCMediaConstraintsLevelControl : va
     lueLevelControl }; | 
| 740    RTCMediaConstraints* constraints = | 745    RTCMediaConstraints *constraints = | 
| 741        [[RTCMediaConstraints alloc]  initWithMandatoryConstraints:mandatoryConst
     raints | 746        [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatoryConstr
     aints | 
| 742                                               optionalConstraints:nil]; | 747                                              optionalConstraints:nil]; | 
| 743    return constraints; | 748    return constraints; | 
| 744 } | 749 } | 
| 745 | 750 | 
| 746 - (RTCMediaConstraints *)defaultMediaStreamConstraints { | 751 - (RTCMediaConstraints *)cameraConstraints { | 
| 747   RTCMediaConstraints* constraints = | 752   return _cameraConstraints; | 
| 748       [[RTCMediaConstraints alloc] |  | 
| 749           initWithMandatoryConstraints:nil |  | 
| 750                    optionalConstraints:nil]; |  | 
| 751   return constraints; |  | 
| 752 } | 753 } | 
| 753 | 754 | 
| 754 - (RTCMediaConstraints *)defaultAnswerConstraints { | 755 - (RTCMediaConstraints *)defaultAnswerConstraints { | 
| 755   return [self defaultOfferConstraints]; | 756   return [self defaultOfferConstraints]; | 
| 756 } | 757 } | 
| 757 | 758 | 
| 758 - (RTCMediaConstraints *)defaultOfferConstraints { | 759 - (RTCMediaConstraints *)defaultOfferConstraints { | 
| 759   NSDictionary *mandatoryConstraints = @{ | 760   NSDictionary *mandatoryConstraints = @{ | 
| 760     @"OfferToReceiveAudio" : @"true", | 761     @"OfferToReceiveAudio" : @"true", | 
| 761     @"OfferToReceiveVideo" : @"true" | 762     @"OfferToReceiveVideo" : @"true" | 
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 837                                          code:kARDAppClientErrorInvalidRoom | 838                                          code:kARDAppClientErrorInvalidRoom | 
| 838                                      userInfo:@{ | 839                                      userInfo:@{ | 
| 839         NSLocalizedDescriptionKey: @"Invalid room.", | 840         NSLocalizedDescriptionKey: @"Invalid room.", | 
| 840       }]; | 841       }]; | 
| 841       break; | 842       break; | 
| 842   } | 843   } | 
| 843   return error; | 844   return error; | 
| 844 } | 845 } | 
| 845 | 846 | 
| 846 @end | 847 @end | 
| OLD | NEW | 
|---|