Broadcast extension for AppRTCMobile on iOS

This provides an environment for testing out using WebRTC from an iOS
extension. It implements a ReplayKit broadcast extension for live
streaming games and screensharing.

The extension is only supported on iOS 11+ and is guarded by a build
flag.

Bug: webrtc:9335
Change-Id: Id218d6c73ef7599f5953c5a1e0e62e5d0dc4f10b
Reviewed-on: https://webrtc-review.googlesource.com/80000
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23504}
This commit is contained in:
Anders Carlsson
2018-06-04 10:24:37 +02:00
committed by Commit Bot
parent 27fe43a1aa
commit 358f2e0760
18 changed files with 572 additions and 18 deletions

View File

@ -12,6 +12,7 @@
#import <Foundation/Foundation.h>
NS_EXTENSION_UNAVAILABLE_IOS("Application status not available in app extensions.")
@interface RTCUIApplicationStatusObserver : NSObject
+ (instancetype)sharedInstance;

View File

@ -78,7 +78,7 @@ void decompressionOutputCallback(void *decoderRef,
- (instancetype)init {
if (self = [super init]) {
#if defined(WEBRTC_IOS)
#if defined(WEBRTC_IOS) && !defined(RTC_APPRTCMOBILE_BROADCAST_EXTENSION)
[RTCUIApplicationStatusObserver prepareForUse];
_error = noErr;
#endif
@ -113,7 +113,7 @@ void decompressionOutputCallback(void *decoderRef,
return WEBRTC_VIDEO_CODEC_ERROR;
}
#if defined(WEBRTC_IOS)
#if defined(WEBRTC_IOS) && !defined(RTC_APPRTCMOBILE_BROADCAST_EXTENSION)
if (![[RTCUIApplicationStatusObserver sharedInstance] isApplicationActive]) {
// Ignore all decode requests when app isn't active. In this state, the
// hardware decoder has been invalidated by the OS.

View File

@ -307,7 +307,7 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) {
RTC_LOG(LS_INFO) << "Using profile " << CFStringToString(_profile);
RTC_CHECK([codecInfo.name isEqualToString:kRTCVideoCodecH264Name]);
#if defined(WEBRTC_IOS)
#if defined(WEBRTC_IOS) && !defined(RTC_APPRTCMOBILE_BROADCAST_EXTENSION)
[RTCUIApplicationStatusObserver prepareForUse];
#endif
}
@ -345,7 +345,7 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) {
if (!_callback || !_compressionSession) {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
#if defined(WEBRTC_IOS)
#if defined(WEBRTC_IOS) && !defined(RTC_APPRTCMOBILE_BROADCAST_EXTENSION)
if (![[RTCUIApplicationStatusObserver sharedInstance] isApplicationActive]) {
// Ignore all encode requests when app isn't active. In this state, the
// hardware encoder has been invalidated by the OS.

View File

@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
RTC_EXPORT
// Camera capture that implements RTCVideoCapturer. Delivers frames to a RTCVideoCapturerDelegate
// (usually RTCVideoSource).
NS_EXTENSION_UNAVAILABLE_IOS("Camera not available in app extensions.")
@interface RTCCameraVideoCapturer : RTCVideoCapturer
// Capture session that is used for capturing. Valid from initialization to dealloc.

View File

@ -28,6 +28,7 @@ RTC_EXPORT
* bounds using OpenGLES 2.0 or OpenGLES 3.0.
*/
RTC_EXPORT
NS_EXTENSION_UNAVAILABLE_IOS("Rendering not available in app extensions.")
@interface RTCEAGLVideoView : UIView <RTCVideoRenderer>
@property(nonatomic, weak) id<RTCVideoViewDelegate> delegate;