Revert "Add file capturer to AppRTCMobile on simulator."
This reverts commit 5adcd198752b651f7b7e9199a91f9b873b7d7237.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Add file capturer to AppRTCMobile on simulator.
>
> To achieve this, the CL does the following
> - Adds sample mp4 video
> - Refactors the existing RTCFileVideoCapturer to achieve continious
> capture and adds tests.
>
> Bug: webrtc:8406
> Change-Id: Ibc0891176c58ec9053b42e340d2113036e7199ec
> Reviewed-on: https://webrtc-review.googlesource.com/12180
> Reviewed-by: Anders Carlsson <andersc@webrtc.org>
> Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
> Commit-Queue: Daniela Jovanoska Petrenko <denicija@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20598}
TBR=magjed@webrtc.org,andersc@webrtc.org,denicija@webrtc.org
Change-Id: I73b35c67296c964f65d206454ac1329b4b979628
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8406
Reviewed-on: https://webrtc-review.googlesource.com/21240
Reviewed-by: Daniela Jovanoska Petrenko <denicija@webrtc.org>
Commit-Queue: Daniela Jovanoska Petrenko <denicija@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20599}
diff --git a/examples/objc/AppRTCMobile/ARDAppClient.h b/examples/objc/AppRTCMobile/ARDAppClient.h
index 5054c28..8c27b34 100644
--- a/examples/objc/AppRTCMobile/ARDAppClient.h
+++ b/examples/objc/AppRTCMobile/ARDAppClient.h
@@ -9,6 +9,8 @@
*/
#import <Foundation/Foundation.h>
+
+#import "WebRTC/RTCCameraVideoCapturer.h"
#import "WebRTC/RTCPeerConnection.h"
#import "WebRTC/RTCVideoTrack.h"
@@ -24,8 +26,6 @@
@class ARDAppClient;
@class ARDSettingsModel;
@class RTCMediaConstraints;
-@class RTCCameraVideoCapturer;
-@class RTCFileVideoCapturer;
// The delegate is informed of pertinent events and will be called on the
// main queue.
@@ -52,10 +52,6 @@
- (void)appClient:(ARDAppClient *)client
didGetStats:(NSArray *)stats;
-@optional
-- (void)appClient:(ARDAppClient *)client
-didCreateLocalFileCapturer:(RTCFileVideoCapturer *)fileCapturer;
-
@end
// Handles connections to the AppRTC server for a given room. Methods on this
diff --git a/examples/objc/AppRTCMobile/ARDAppClient.m b/examples/objc/AppRTCMobile/ARDAppClient.m
index 1c41a72..f753828 100644
--- a/examples/objc/AppRTCMobile/ARDAppClient.m
+++ b/examples/objc/AppRTCMobile/ARDAppClient.m
@@ -15,7 +15,6 @@
#import "WebRTC/RTCCameraVideoCapturer.h"
#import "WebRTC/RTCConfiguration.h"
#import "WebRTC/RTCFileLogger.h"
-#import "WebRTC/RTCFileVideoCapturer.h"
#import "WebRTC/RTCIceServer.h"
#import "WebRTC/RTCLogging.h"
#import "WebRTC/RTCMediaConstraints.h"
@@ -691,24 +690,21 @@
}
- (RTCVideoTrack *)createLocalVideoTrack {
- if ([_settings currentAudioOnlySettingFromStore]) {
- return nil;
- }
-
- RTCVideoSource *source = [_factory videoSource];
-
+ RTCVideoTrack* localVideoTrack = nil;
+ // The iOS simulator doesn't provide any sort of camera capture
+ // support or emulation (http://goo.gl/rHAnC1) so don't bother
+ // trying to open a local stream.
#if !TARGET_IPHONE_SIMULATOR
- RTCCameraVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:source];
- [_delegate appClient:self didCreateLocalCapturer:capturer];
-
-#else
- if (@available(iOS 10, *)) {
- RTCFileVideoCapturer *fileCapturer = [[RTCFileVideoCapturer alloc] initWithDelegate:source];
- [_delegate appClient:self didCreateLocalFileCapturer:fileCapturer];
+ if (![_settings currentAudioOnlySettingFromStore]) {
+ RTCVideoSource *source = [_factory videoSource];
+ RTCCameraVideoCapturer *capturer = [[RTCCameraVideoCapturer alloc] initWithDelegate:source];
+ [_delegate appClient:self didCreateLocalCapturer:capturer];
+ localVideoTrack =
+ [_factory videoTrackWithSource:source
+ trackId:kARDVideoTrackId];
}
#endif
-
- return [_factory videoTrackWithSource:source trackId:kARDVideoTrackId];
+ return localVideoTrack;
}
#pragma mark - Collider methods
diff --git a/examples/objc/AppRTCMobile/ARDSettingsModel.m b/examples/objc/AppRTCMobile/ARDSettingsModel.m
index a4eea73..0a2bee6 100644
--- a/examples/objc/AppRTCMobile/ARDSettingsModel.m
+++ b/examples/objc/AppRTCMobile/ARDSettingsModel.m
@@ -169,12 +169,20 @@
- (void)registerStoreDefaults {
NSString *defaultVideoResolutionSetting = [self defaultVideoResolutionSetting];
+ BOOL audioOnly = (defaultVideoResolutionSetting.length == 0);
+
+// The iOS simulator doesn't provide any sort of camera capture
+// support or emulation (http://goo.gl/rHAnC1) so don't bother
+// trying to open a local stream.
+#if TARGET_IPHONE_SIMULATOR
+ audioOnly = YES;
+#endif
NSData *codecData = [NSKeyedArchiver archivedDataWithRootObject:[self defaultVideoCodecSetting]];
[ARDSettingsStore setDefaultsForVideoResolution:[self defaultVideoResolutionSetting]
videoCodec:codecData
bitrate:nil
- audioOnly:NO
+ audioOnly:audioOnly
createAecDump:NO
useLevelController:NO
useManualAudioConfig:YES];
diff --git a/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.h b/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.h
deleted file mode 100644
index 7e0387d..0000000
--- a/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2017 The WebRTC Project Authors. All rights reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#import <Foundation/Foundation.h>
-
-@class RTCFileVideoCapturer;
-
-/**
- * Controls a file capturer.
- */
-NS_CLASS_AVAILABLE_IOS(10)
-@interface ARDFileCaptureController : NSObject
-
-/**
- * Creates instance of the controller.
- *
- * @param capturer The capturer to be controlled.
- */
-- (instancetype)initWithCapturer:(RTCFileVideoCapturer *)capturer;
-
-/**
- * Starts the file capturer.
- *
- * Possible errors produced by the capturer will be logged.
- */
-- (void)startCapture;
-
-/**
- * Immediately stops capturer.
- */
-- (void)stopCapture;
-
-@end
diff --git a/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.m b/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.m
deleted file mode 100644
index d61bfe2..0000000
--- a/examples/objc/AppRTCMobile/ios/ARDFileCaptureController.m
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2017 The WebRTC Project Authors. All rights reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#import "ARDFileCaptureController.h"
-
-#import "WebRTC/RTCFileVideoCapturer.h"
-
-@interface ARDFileCaptureController ()
-
-@property(nonatomic, strong) RTCFileVideoCapturer *fileCapturer;
-
-@end
-
-@implementation ARDFileCaptureController
-@synthesize fileCapturer = _fileCapturer;
-
-- (instancetype)initWithCapturer:(RTCFileVideoCapturer *)capturer {
- if (self = [super init]) {
- _fileCapturer = capturer;
- }
- return self;
-}
-
-- (void)startCapture {
- [self startFileCapture];
-}
-
-- (void)startFileCapture {
- [self.fileCapturer startCapturingFromFileNamed:@"foreman.mp4"
- onError:^(NSError *_Nonnull error) {
- NSLog(@"Error %@", error.userInfo);
- }];
-}
-
-- (void)stopCapture {
- [self.fileCapturer stopCapture];
-}
-@end
diff --git a/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m b/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m
index e5c9e64..ad5bc80 100644
--- a/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m
+++ b/examples/objc/AppRTCMobile/ios/ARDVideoCallViewController.m
@@ -11,11 +11,9 @@
#import "ARDVideoCallViewController.h"
#import "WebRTC/RTCAudioSession.h"
-#import "WebRTC/RTCCameraVideoCapturer.h"
#import "ARDAppClient.h"
#import "ARDCaptureController.h"
-#import "ARDFileCaptureController.h"
#import "ARDSettingsModel.h"
#import "ARDVideoCallView.h"
#import "WebRTC/RTCAVFoundationVideoSource.h"
@@ -34,7 +32,6 @@
ARDAppClient *_client;
RTCVideoTrack *_remoteVideoTrack;
ARDCaptureController *_captureController;
- ARDFileCaptureController *_fileCaptureController NS_AVAILABLE_IOS(10);
AVAudioSessionPortOverride _portOverride;
}
@@ -105,14 +102,6 @@
}
- (void)appClient:(ARDAppClient *)client
- didCreateLocalFileCapturer:(RTCFileVideoCapturer *)fileCapturer {
- if (@available(iOS 10, *)) {
- _fileCaptureController = [[ARDFileCaptureController alloc] initWithCapturer:fileCapturer];
- [_fileCaptureController startCapture];
- }
-}
-
-- (void)appClient:(ARDAppClient *)client
didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack {
}
@@ -198,8 +187,6 @@
_videoCallView.localVideoView.captureSession = nil;
[_captureController stopCapture];
_captureController = nil;
- [_fileCaptureController stopCapture];
- _fileCaptureController = nil;
[_client disconnect];
[_delegate viewControllerDidFinish:self];
}
diff --git a/examples/objc/AppRTCMobile/ios/resources/foreman.mp4 b/examples/objc/AppRTCMobile/ios/resources/foreman.mp4
deleted file mode 100644
index ccffbf4..0000000
--- a/examples/objc/AppRTCMobile/ios/resources/foreman.mp4
+++ /dev/null
Binary files differ
diff --git a/examples/objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm b/examples/objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm
deleted file mode 100644
index e734f10..0000000
--- a/examples/objc/AppRTCMobile/tests/ARDFileCaptureController_xctest.mm
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2017 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#import <Foundation/Foundation.h>
-#import <OCMock/OCMock.h>
-#import <XCTest/XCTest.h>
-
-#import "ARDFileCaptureController.h"
-
-#import "WebRTC/RTCFileVideoCapturer.h"
-
-NS_CLASS_AVAILABLE_IOS(10)
-@interface ARDFileCaptureControllerTests : XCTestCase
-
-@property(nonatomic, strong) ARDFileCaptureController *fileCaptureController;
-@property(nonatomic, strong) id fileCapturerMock;
-
-@end
-
-@implementation ARDFileCaptureControllerTests
-
-@synthesize fileCaptureController = _fileCaptureController;
-@synthesize fileCapturerMock = _fileCapturerMock;
-
-- (void)setUp {
- [super setUp];
- self.fileCapturerMock = OCMClassMock([RTCFileVideoCapturer class]);
- self.fileCaptureController =
- [[ARDFileCaptureController alloc] initWithCapturer:self.fileCapturerMock];
-}
-
-- (void)tearDown {
- self.fileCaptureController = nil;
- [self.fileCapturerMock stopMocking];
- self.fileCapturerMock = nil;
- [super tearDown];
-}
-
-- (void)testCaptureIsStarted {
- [[self.fileCapturerMock expect] startCapturingFromFileNamed:[OCMArg any] onError:[OCMArg any]];
-
- [self.fileCaptureController startCapture];
-
- [self.fileCapturerMock verify];
-}
-
-- (void)testCaptureIsStoped {
- [[self.fileCapturerMock expect] stopCapture];
-
- [self.fileCaptureController stopCapture];
-
- [self.fileCapturerMock verify];
-}
-
-@end