| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #import "ARDVideoCallViewController.h" | 28 #import "ARDVideoCallViewController.h" |
| 29 | 29 |
| 30 #import "RTCAVFoundationVideoSource.h" | 30 #import "RTCAVFoundationVideoSource.h" |
| 31 #import "RTCLogging.h" |
| 31 | 32 |
| 32 #import "ARDAppClient.h" | 33 #import "ARDAppClient.h" |
| 33 #import "ARDLogging.h" | |
| 34 #import "ARDVideoCallView.h" | 34 #import "ARDVideoCallView.h" |
| 35 | 35 |
| 36 @interface ARDVideoCallViewController () <ARDAppClientDelegate, | 36 @interface ARDVideoCallViewController () <ARDAppClientDelegate, |
| 37 ARDVideoCallViewDelegate> | 37 ARDVideoCallViewDelegate> |
| 38 @property(nonatomic, strong) RTCVideoTrack *localVideoTrack; | 38 @property(nonatomic, strong) RTCVideoTrack *localVideoTrack; |
| 39 @property(nonatomic, strong) RTCVideoTrack *remoteVideoTrack; | 39 @property(nonatomic, strong) RTCVideoTrack *remoteVideoTrack; |
| 40 @property(nonatomic, readonly) ARDVideoCallView *videoCallView; | 40 @property(nonatomic, readonly) ARDVideoCallView *videoCallView; |
| 41 @end | 41 @end |
| 42 | 42 |
| 43 @implementation ARDVideoCallViewController { | 43 @implementation ARDVideoCallViewController { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 63 [self statusTextForState:RTCICEConnectionNew]; | 63 [self statusTextForState:RTCICEConnectionNew]; |
| 64 self.view = _videoCallView; | 64 self.view = _videoCallView; |
| 65 } | 65 } |
| 66 | 66 |
| 67 #pragma mark - ARDAppClientDelegate | 67 #pragma mark - ARDAppClientDelegate |
| 68 | 68 |
| 69 - (void)appClient:(ARDAppClient *)client | 69 - (void)appClient:(ARDAppClient *)client |
| 70 didChangeState:(ARDAppClientState)state { | 70 didChangeState:(ARDAppClientState)state { |
| 71 switch (state) { | 71 switch (state) { |
| 72 case kARDAppClientStateConnected: | 72 case kARDAppClientStateConnected: |
| 73 ARDLog(@"Client connected."); | 73 RTCLog(@"Client connected."); |
| 74 break; | 74 break; |
| 75 case kARDAppClientStateConnecting: | 75 case kARDAppClientStateConnecting: |
| 76 ARDLog(@"Client connecting."); | 76 RTCLog(@"Client connecting."); |
| 77 break; | 77 break; |
| 78 case kARDAppClientStateDisconnected: | 78 case kARDAppClientStateDisconnected: |
| 79 ARDLog(@"Client disconnected."); | 79 RTCLog(@"Client disconnected."); |
| 80 [self hangup]; | 80 [self hangup]; |
| 81 break; | 81 break; |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 - (void)appClient:(ARDAppClient *)client | 85 - (void)appClient:(ARDAppClient *)client |
| 86 didChangeConnectionState:(RTCICEConnectionState)state { | 86 didChangeConnectionState:(RTCICEConnectionState)state { |
| 87 ARDLog(@"ICE state changed: %d", state); | 87 RTCLog(@"ICE state changed: %d", state); |
| 88 __weak ARDVideoCallViewController *weakSelf = self; | 88 __weak ARDVideoCallViewController *weakSelf = self; |
| 89 dispatch_async(dispatch_get_main_queue(), ^{ | 89 dispatch_async(dispatch_get_main_queue(), ^{ |
| 90 ARDVideoCallViewController *strongSelf = weakSelf; | 90 ARDVideoCallViewController *strongSelf = weakSelf; |
| 91 strongSelf.videoCallView.statusLabel.text = | 91 strongSelf.videoCallView.statusLabel.text = |
| 92 [strongSelf statusTextForState:state]; | 92 [strongSelf statusTextForState:state]; |
| 93 }); | 93 }); |
| 94 } | 94 } |
| 95 | 95 |
| 96 - (void)appClient:(ARDAppClient *)client | 96 - (void)appClient:(ARDAppClient *)client |
| 97 didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack { | 97 didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 - (void)showAlertWithMessage:(NSString*)message { | 185 - (void)showAlertWithMessage:(NSString*)message { |
| 186 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil | 186 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil |
| 187 message:message | 187 message:message |
| 188 delegate:nil | 188 delegate:nil |
| 189 cancelButtonTitle:@"OK" | 189 cancelButtonTitle:@"OK" |
| 190 otherButtonTitles:nil]; | 190 otherButtonTitles:nil]; |
| 191 [alertView show]; | 191 [alertView show]; |
| 192 } | 192 } |
| 193 | 193 |
| 194 @end | 194 @end |
| OLD | NEW |