From c3dc8508abc037ff5e7d12efe193b1bfe85cb972 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 4 Oct 2017 15:19:36 -0400 Subject: [PATCH] pre-PR cleanup // FREEBIE --- Signal/src/ViewControllers/CallViewController.swift | 4 +--- Signal/src/call/CallAudioService.swift | 7 +++++-- Signal/src/views/RemoteVideoView.h | 4 ++-- Signal/src/views/RemoteVideoView.m | 5 ++++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Signal/src/ViewControllers/CallViewController.swift b/Signal/src/ViewControllers/CallViewController.swift index 354315fb9..750186916 100644 --- a/Signal/src/ViewControllers/CallViewController.swift +++ b/Signal/src/ViewControllers/CallViewController.swift @@ -8,7 +8,6 @@ import PromiseKit // TODO: Add category so that button handlers can be defined where button is created. // TODO: Ensure buttons enabled & disabled as necessary. -//class CallViewController: OWSViewController, CallObserver, CallServiceObserver, RTCEAGLVideoViewDelegate { class CallViewController: OWSViewController, CallObserver, CallServiceObserver { let TAG = "[CallViewController]" @@ -231,10 +230,9 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver { } func createVideoViews() { - localVideoView = RTCCameraPreviewView() remoteVideoView = RemoteVideoView() - remoteVideoView.isUserInteractionEnabled = false + localVideoView = RTCCameraPreviewView() remoteVideoView.isHidden = true localVideoView.isHidden = true diff --git a/Signal/src/call/CallAudioService.swift b/Signal/src/call/CallAudioService.swift index d791606e8..9a446dbd0 100644 --- a/Signal/src/call/CallAudioService.swift +++ b/Signal/src/call/CallAudioService.swift @@ -418,8 +418,11 @@ struct AudioSource: Hashable { guard let availableInputs = session.availableInputs else { // I'm not sure when this would happen. - // TODO this happens when the call ends (at leas ton iOS8) -// owsFail("No available inputs or inputs not ready") + if #available(iOS 9.0, *) { + // Fails on iOS8. We *could* remove this assert, but it might + // still be helfpul in catching a bug in a more used platform. + owsFail("No available inputs or inputs not ready") + } return [AudioSource.builtInSpeaker] } diff --git a/Signal/src/views/RemoteVideoView.h b/Signal/src/views/RemoteVideoView.h index 6e84de450..46db91fc9 100644 --- a/Signal/src/views/RemoteVideoView.h +++ b/Signal/src/views/RemoteVideoView.h @@ -5,8 +5,8 @@ #import /** - * Drives the full screen remote video, this class is backed by either the modern MetalKit backed view on supported - * systems or the leagacy EAGL view. MetalKit is supported on 64bit systems running iOS8 or newer. + * Drives the full screen remote video. This is *not* a swift class + * so we can take advantage of some compile time constants from WebRTC */ @interface RemoteVideoView : UIView diff --git a/Signal/src/views/RemoteVideoView.m b/Signal/src/views/RemoteVideoView.m index 7f5cb8f07..8f1e6f8f2 100644 --- a/Signal/src/views/RemoteVideoView.m +++ b/Signal/src/views/RemoteVideoView.m @@ -79,12 +79,13 @@ NS_ASSUME_NONNULL_BEGIN return self; } + // On iOS8: prints a message saying the feature is unavailable. if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(9, 0)) { _videoRenderer = [NullVideoRenderer new]; } + // On 64-bit, iOS9+: uses the MetalKit backed view for improved battery/rendering performance. if (_videoRenderer == nil) { -// This class is defined in objc in order to access this compile time macro // Currently RTC only supports metal on 64bit machines #if defined(RTC_SUPPORTS_METAL) // RTCMTLVideoView requires the MTKView class, available in the iOS9+ MetalKit framework @@ -94,7 +95,9 @@ NS_ASSUME_NONNULL_BEGIN #endif } + // On 32-bit: uses the legacy EAGL backed view. if (_videoRenderer == nil) { + OWSAssert(!__arm64__); RTCEAGLVideoView *eaglVideoView = [[RTCEAGLVideoView alloc] initWithFrame:CGRectZero]; eaglVideoView.delegate = self; _videoRenderer = eaglVideoView;