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 "APPRTCViewController.h" | 11 #import "APPRTCViewController.h" |
12 | 12 |
13 #import <AVFoundation/AVFoundation.h> | 13 #import <AVFoundation/AVFoundation.h> |
14 | 14 |
15 #import "WebRTC/RTCMTLNSVideoView.h" | 15 #import "WebRTC/RTCMTLNSVideoView.h" |
16 #import "WebRTC/RTCNSGLVideoView.h" | 16 #import "WebRTC/RTCNSGLVideoView.h" |
17 #import "WebRTC/RTCVideoTrack.h" | 17 #import "WebRTC/RTCVideoTrack.h" |
18 | 18 |
19 #import "ARDAppClient.h" | 19 #import "ARDAppClient.h" |
| 20 #import "ARDCaptureController.h" |
20 #import "ARDSettingsModel.h" | 21 #import "ARDSettingsModel.h" |
21 | 22 |
22 static NSUInteger const kContentWidth = 900; | 23 static NSUInteger const kContentWidth = 900; |
23 static NSUInteger const kRoomFieldWidth = 200; | 24 static NSUInteger const kRoomFieldWidth = 200; |
24 static NSUInteger const kActionItemHeight = 30; | 25 static NSUInteger const kActionItemHeight = 30; |
25 static NSUInteger const kBottomViewHeight = 200; | 26 static NSUInteger const kBottomViewHeight = 200; |
26 | 27 |
27 @class APPRTCMainView; | 28 @class APPRTCMainView; |
28 @protocol APPRTCMainViewDelegate | 29 @protocol APPRTCMainViewDelegate |
29 | 30 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 293 |
293 @interface APPRTCViewController () | 294 @interface APPRTCViewController () |
294 <ARDAppClientDelegate, APPRTCMainViewDelegate> | 295 <ARDAppClientDelegate, APPRTCMainViewDelegate> |
295 @property(nonatomic, readonly) APPRTCMainView* mainView; | 296 @property(nonatomic, readonly) APPRTCMainView* mainView; |
296 @end | 297 @end |
297 | 298 |
298 @implementation APPRTCViewController { | 299 @implementation APPRTCViewController { |
299 ARDAppClient* _client; | 300 ARDAppClient* _client; |
300 RTCVideoTrack* _localVideoTrack; | 301 RTCVideoTrack* _localVideoTrack; |
301 RTCVideoTrack* _remoteVideoTrack; | 302 RTCVideoTrack* _remoteVideoTrack; |
| 303 ARDCaptureController* _captureController; |
302 } | 304 } |
303 | 305 |
304 - (void)dealloc { | 306 - (void)dealloc { |
305 [self disconnect]; | 307 [self disconnect]; |
306 } | 308 } |
307 | 309 |
308 - (void)viewDidAppear { | 310 - (void)viewDidAppear { |
309 [super viewDidAppear]; | 311 [super viewDidAppear]; |
310 [self displayUsageInstructions]; | 312 [self displayUsageInstructions]; |
311 } | 313 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 [self resetUI]; | 348 [self resetUI]; |
347 _client = nil; | 349 _client = nil; |
348 break; | 350 break; |
349 } | 351 } |
350 } | 352 } |
351 | 353 |
352 - (void)appClient:(ARDAppClient *)client | 354 - (void)appClient:(ARDAppClient *)client |
353 didChangeConnectionState:(RTCIceConnectionState)state { | 355 didChangeConnectionState:(RTCIceConnectionState)state { |
354 } | 356 } |
355 | 357 |
| 358 - (void)appClient:(ARDAppClient*)client |
| 359 didCreateLocalCapturer:(RTCCameraVideoCapturer*)localCapturer { |
| 360 _captureController = |
| 361 [[ARDCaptureController alloc] initWithCapturer:localCapturer |
| 362 settings:[[ARDSettingsModel alloc] i
nit]]; |
| 363 [_captureController startCapture]; |
| 364 } |
| 365 |
356 - (void)appClient:(ARDAppClient *)client | 366 - (void)appClient:(ARDAppClient *)client |
357 didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack { | 367 didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack { |
358 _localVideoTrack = localVideoTrack; | 368 _localVideoTrack = localVideoTrack; |
359 [_localVideoTrack addRenderer:self.mainView.localVideoView]; | 369 [_localVideoTrack addRenderer:self.mainView.localVideoView]; |
360 } | 370 } |
361 | 371 |
362 - (void)appClient:(ARDAppClient *)client | 372 - (void)appClient:(ARDAppClient *)client |
363 didReceiveRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack { | 373 didReceiveRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack { |
364 _remoteVideoTrack = remoteVideoTrack; | 374 _remoteVideoTrack = remoteVideoTrack; |
365 [_remoteVideoTrack addRenderer:self.mainView.remoteVideoView]; | 375 [_remoteVideoTrack addRenderer:self.mainView.remoteVideoView]; |
(...skipping 13 matching lines...) Expand all Loading... |
379 | 389 |
380 - (void)appRTCMainView:(APPRTCMainView*)mainView | 390 - (void)appRTCMainView:(APPRTCMainView*)mainView |
381 didEnterRoomId:(NSString*)roomId | 391 didEnterRoomId:(NSString*)roomId |
382 loopback:(BOOL)isLoopback { | 392 loopback:(BOOL)isLoopback { |
383 | 393 |
384 if ([roomId isEqualToString:@""]) { | 394 if ([roomId isEqualToString:@""]) { |
385 [self.mainView displayLogMessage:@"Missing room id"]; | 395 [self.mainView displayLogMessage:@"Missing room id"]; |
386 return; | 396 return; |
387 } | 397 } |
388 | 398 |
389 [_client disconnect]; | 399 [self disconnect]; |
390 ARDAppClient* client = [[ARDAppClient alloc] initWithDelegate:self]; | 400 ARDAppClient* client = [[ARDAppClient alloc] initWithDelegate:self]; |
391 [client connectToRoomWithId:roomId | 401 [client connectToRoomWithId:roomId |
392 settings:[[ARDSettingsModel alloc] init] // Use default se
ttings. | 402 settings:[[ARDSettingsModel alloc] init] // Use default se
ttings. |
393 isLoopback:isLoopback | 403 isLoopback:isLoopback |
394 isAudioOnly:NO | 404 isAudioOnly:NO |
395 shouldMakeAecDump:NO | 405 shouldMakeAecDump:NO |
396 shouldUseLevelControl:NO]; | 406 shouldUseLevelControl:NO]; |
397 _client = client; | 407 _client = client; |
398 } | 408 } |
399 | 409 |
(...skipping 13 matching lines...) Expand all Loading... |
413 [_remoteVideoTrack removeRenderer:self.mainView.remoteVideoView]; | 423 [_remoteVideoTrack removeRenderer:self.mainView.remoteVideoView]; |
414 [_localVideoTrack removeRenderer:self.mainView.localVideoView]; | 424 [_localVideoTrack removeRenderer:self.mainView.localVideoView]; |
415 _remoteVideoTrack = nil; | 425 _remoteVideoTrack = nil; |
416 _localVideoTrack = nil; | 426 _localVideoTrack = nil; |
417 [self.mainView.remoteVideoView renderFrame:nil]; | 427 [self.mainView.remoteVideoView renderFrame:nil]; |
418 [self.mainView.localVideoView renderFrame:nil]; | 428 [self.mainView.localVideoView renderFrame:nil]; |
419 } | 429 } |
420 | 430 |
421 - (void)disconnect { | 431 - (void)disconnect { |
422 [self resetUI]; | 432 [self resetUI]; |
| 433 [_captureController stopCapture]; |
| 434 _captureController = nil; |
423 [_client disconnect]; | 435 [_client disconnect]; |
424 } | 436 } |
425 | 437 |
426 @end | 438 @end |
OLD | NEW |