Skip to content

Commit 2439912

Browse files
authored
Merge pull request #2 from Bandwidth/release/daab689
WebRTC M88
2 parents 8ebd8d8 + aa85375 commit 2439912

File tree

263 files changed

+13320
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+13320
-0
lines changed

WebRTC.xcframework/Info.plist

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>AvailableLibraries</key>
6+
<array>
7+
<dict>
8+
<key>LibraryIdentifier</key>
9+
<string>macos-x86_64</string>
10+
<key>LibraryPath</key>
11+
<string>WebRTC.framework</string>
12+
<key>SupportedArchitectures</key>
13+
<array>
14+
<string>x86_64</string>
15+
</array>
16+
<key>SupportedPlatform</key>
17+
<string>macos</string>
18+
</dict>
19+
<dict>
20+
<key>LibraryIdentifier</key>
21+
<string>ios-x86_64-simulator</string>
22+
<key>LibraryPath</key>
23+
<string>WebRTC.framework</string>
24+
<key>SupportedArchitectures</key>
25+
<array>
26+
<string>x86_64</string>
27+
</array>
28+
<key>SupportedPlatform</key>
29+
<string>ios</string>
30+
<key>SupportedPlatformVariant</key>
31+
<string>simulator</string>
32+
</dict>
33+
<dict>
34+
<key>LibraryIdentifier</key>
35+
<string>ios-arm64</string>
36+
<key>LibraryPath</key>
37+
<string>WebRTC.framework</string>
38+
<key>SupportedArchitectures</key>
39+
<array>
40+
<string>arm64</string>
41+
</array>
42+
<key>SupportedPlatform</key>
43+
<string>ios</string>
44+
</dict>
45+
</array>
46+
<key>CFBundlePackageType</key>
47+
<string>XFWK</string>
48+
<key>XCFrameworkFormatVersion</key>
49+
<string>1.0</string>
50+
</dict>
51+
</plist>
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
/*
2+
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
3+
*
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
6+
* tree. An additional intellectual property rights grant can be found
7+
* in the file PATENTS. All contributing project authors may
8+
* be found in the AUTHORS file in the root of the source tree.
9+
*/
10+
11+
#import <AVFoundation/AVFoundation.h>
12+
#import <Foundation/Foundation.h>
13+
14+
#import <WebRTC/RTCMacros.h>
15+
16+
NS_ASSUME_NONNULL_BEGIN
17+
18+
extern NSString *const kRTCAudioSessionErrorDomain;
19+
/** Method that requires lock was called without lock. */
20+
extern NSInteger const kRTCAudioSessionErrorLockRequired;
21+
/** Unknown configuration error occurred. */
22+
extern NSInteger const kRTCAudioSessionErrorConfiguration;
23+
24+
@class RTC_OBJC_TYPE(RTCAudioSession);
25+
@class RTC_OBJC_TYPE(RTCAudioSessionConfiguration);
26+
27+
// Surfaces AVAudioSession events. WebRTC will listen directly for notifications
28+
// from AVAudioSession and handle them before calling these delegate methods,
29+
// at which point applications can perform additional processing if required.
30+
RTC_OBJC_EXPORT
31+
@protocol RTC_OBJC_TYPE
32+
(RTCAudioSessionDelegate)<NSObject>
33+
34+
@optional
35+
/** Called on a system notification thread when AVAudioSession starts an
36+
* interruption event.
37+
*/
38+
- (void)audioSessionDidBeginInterruption:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
39+
40+
/** Called on a system notification thread when AVAudioSession ends an
41+
* interruption event.
42+
*/
43+
- (void)audioSessionDidEndInterruption:(RTC_OBJC_TYPE(RTCAudioSession) *)session
44+
shouldResumeSession:(BOOL)shouldResumeSession;
45+
46+
/** Called on a system notification thread when AVAudioSession changes the
47+
* route.
48+
*/
49+
- (void)audioSessionDidChangeRoute:(RTC_OBJC_TYPE(RTCAudioSession) *)session
50+
reason:(AVAudioSessionRouteChangeReason)reason
51+
previousRoute:(AVAudioSessionRouteDescription *)previousRoute;
52+
53+
/** Called on a system notification thread when AVAudioSession media server
54+
* terminates.
55+
*/
56+
- (void)audioSessionMediaServerTerminated:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
57+
58+
/** Called on a system notification thread when AVAudioSession media server
59+
* restarts.
60+
*/
61+
- (void)audioSessionMediaServerReset:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
62+
63+
// TODO(tkchin): Maybe handle SilenceSecondaryAudioHintNotification.
64+
65+
- (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)session
66+
didChangeCanPlayOrRecord:(BOOL)canPlayOrRecord;
67+
68+
/** Called on a WebRTC thread when the audio device is notified to begin
69+
* playback or recording.
70+
*/
71+
- (void)audioSessionDidStartPlayOrRecord:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
72+
73+
/** Called on a WebRTC thread when the audio device is notified to stop
74+
* playback or recording.
75+
*/
76+
- (void)audioSessionDidStopPlayOrRecord:(RTC_OBJC_TYPE(RTCAudioSession) *)session;
77+
78+
/** Called when the AVAudioSession output volume value changes. */
79+
- (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession
80+
didChangeOutputVolume:(float)outputVolume;
81+
82+
/** Called when the audio device detects a playout glitch. The argument is the
83+
* number of glitches detected so far in the current audio playout session.
84+
*/
85+
- (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession
86+
didDetectPlayoutGlitch:(int64_t)totalNumberOfGlitches;
87+
88+
/** Called when the audio session is about to change the active state.
89+
*/
90+
- (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession willSetActive:(BOOL)active;
91+
92+
/** Called after the audio session sucessfully changed the active state.
93+
*/
94+
- (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession didSetActive:(BOOL)active;
95+
96+
/** Called after the audio session failed to change the active state.
97+
*/
98+
- (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession
99+
failedToSetActive:(BOOL)active
100+
error:(NSError *)error;
101+
102+
@end
103+
104+
/** This is a protocol used to inform RTCAudioSession when the audio session
105+
* activation state has changed outside of RTCAudioSession. The current known use
106+
* case of this is when CallKit activates the audio session for the application
107+
*/
108+
RTC_OBJC_EXPORT
109+
@protocol RTC_OBJC_TYPE
110+
(RTCAudioSessionActivationDelegate)<NSObject>
111+
112+
/** Called when the audio session is activated outside of the app by iOS. */
113+
- (void)audioSessionDidActivate : (AVAudioSession *)session;
114+
115+
/** Called when the audio session is deactivated outside of the app by iOS. */
116+
- (void)audioSessionDidDeactivate:(AVAudioSession *)session;
117+
118+
@end
119+
120+
/** Proxy class for AVAudioSession that adds a locking mechanism similar to
121+
* AVCaptureDevice. This is used to that interleaving configurations between
122+
* WebRTC and the application layer are avoided.
123+
*
124+
* RTCAudioSession also coordinates activation so that the audio session is
125+
* activated only once. See |setActive:error:|.
126+
*/
127+
RTC_OBJC_EXPORT
128+
@interface RTC_OBJC_TYPE (RTCAudioSession) : NSObject <RTC_OBJC_TYPE(RTCAudioSessionActivationDelegate)>
129+
130+
/** Convenience property to access the AVAudioSession singleton. Callers should
131+
* not call setters on AVAudioSession directly, but other method invocations
132+
* are fine.
133+
*/
134+
@property(nonatomic, readonly) AVAudioSession *session;
135+
136+
/** Our best guess at whether the session is active based on results of calls to
137+
* AVAudioSession.
138+
*/
139+
@property(nonatomic, readonly) BOOL isActive;
140+
/** Whether RTCAudioSession is currently locked for configuration. */
141+
@property(nonatomic, readonly) BOOL isLocked;
142+
143+
/** If YES, WebRTC will not initialize the audio unit automatically when an
144+
* audio track is ready for playout or recording. Instead, applications should
145+
* call setIsAudioEnabled. If NO, WebRTC will initialize the audio unit
146+
* as soon as an audio track is ready for playout or recording.
147+
*/
148+
@property(nonatomic, assign) BOOL useManualAudio;
149+
150+
/** This property is only effective if useManualAudio is YES.
151+
* Represents permission for WebRTC to initialize the VoIP audio unit.
152+
* When set to NO, if the VoIP audio unit used by WebRTC is active, it will be
153+
* stopped and uninitialized. This will stop incoming and outgoing audio.
154+
* When set to YES, WebRTC will initialize and start the audio unit when it is
155+
* needed (e.g. due to establishing an audio connection).
156+
* This property was introduced to work around an issue where if an AVPlayer is
157+
* playing audio while the VoIP audio unit is initialized, its audio would be
158+
* either cut off completely or played at a reduced volume. By preventing
159+
* the audio unit from being initialized until after the audio has completed,
160+
* we are able to prevent the abrupt cutoff.
161+
*/
162+
@property(nonatomic, assign) BOOL isAudioEnabled;
163+
164+
// Proxy properties.
165+
@property(readonly) NSString *category;
166+
@property(readonly) AVAudioSessionCategoryOptions categoryOptions;
167+
@property(readonly) NSString *mode;
168+
@property(readonly) BOOL secondaryAudioShouldBeSilencedHint;
169+
@property(readonly) AVAudioSessionRouteDescription *currentRoute;
170+
@property(readonly) NSInteger maximumInputNumberOfChannels;
171+
@property(readonly) NSInteger maximumOutputNumberOfChannels;
172+
@property(readonly) float inputGain;
173+
@property(readonly) BOOL inputGainSettable;
174+
@property(readonly) BOOL inputAvailable;
175+
@property(readonly, nullable) NSArray<AVAudioSessionDataSourceDescription *> *inputDataSources;
176+
@property(readonly, nullable) AVAudioSessionDataSourceDescription *inputDataSource;
177+
@property(readonly, nullable) NSArray<AVAudioSessionDataSourceDescription *> *outputDataSources;
178+
@property(readonly, nullable) AVAudioSessionDataSourceDescription *outputDataSource;
179+
@property(readonly) double sampleRate;
180+
@property(readonly) double preferredSampleRate;
181+
@property(readonly) NSInteger inputNumberOfChannels;
182+
@property(readonly) NSInteger outputNumberOfChannels;
183+
@property(readonly) float outputVolume;
184+
@property(readonly) NSTimeInterval inputLatency;
185+
@property(readonly) NSTimeInterval outputLatency;
186+
@property(readonly) NSTimeInterval IOBufferDuration;
187+
@property(readonly) NSTimeInterval preferredIOBufferDuration;
188+
189+
/**
190+
When YES, calls to -setConfiguration:error: and -setConfiguration:active:error: ignore errors in
191+
configuring the audio session's "preferred" attributes (e.g. preferredInputNumberOfChannels).
192+
Typically, configurations to preferred attributes are optimizations, and ignoring this type of
193+
configuration error allows code flow to continue along the happy path when these optimization are
194+
not available. The default value of this property is NO.
195+
*/
196+
@property(nonatomic) BOOL ignoresPreferredAttributeConfigurationErrors;
197+
198+
/** Default constructor. */
199+
+ (instancetype)sharedInstance;
200+
- (instancetype)init NS_UNAVAILABLE;
201+
202+
/** Adds a delegate, which is held weakly. */
203+
- (void)addDelegate:(id<RTC_OBJC_TYPE(RTCAudioSessionDelegate)>)delegate;
204+
/** Removes an added delegate. */
205+
- (void)removeDelegate:(id<RTC_OBJC_TYPE(RTCAudioSessionDelegate)>)delegate;
206+
207+
/** Request exclusive access to the audio session for configuration. This call
208+
* will block if the lock is held by another object.
209+
*/
210+
- (void)lockForConfiguration;
211+
/** Relinquishes exclusive access to the audio session. */
212+
- (void)unlockForConfiguration;
213+
214+
/** If |active|, activates the audio session if it isn't already active.
215+
* Successful calls must be balanced with a setActive:NO when activation is no
216+
* longer required. If not |active|, deactivates the audio session if one is
217+
* active and this is the last balanced call. When deactivating, the
218+
* AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation option is passed to
219+
* AVAudioSession.
220+
*/
221+
- (BOOL)setActive:(BOOL)active error:(NSError **)outError;
222+
223+
// The following methods are proxies for the associated methods on
224+
// AVAudioSession. |lockForConfiguration| must be called before using them
225+
// otherwise they will fail with kRTCAudioSessionErrorLockRequired.
226+
227+
- (BOOL)setCategory:(NSString *)category
228+
withOptions:(AVAudioSessionCategoryOptions)options
229+
error:(NSError **)outError;
230+
- (BOOL)setMode:(NSString *)mode error:(NSError **)outError;
231+
- (BOOL)setInputGain:(float)gain error:(NSError **)outError;
232+
- (BOOL)setPreferredSampleRate:(double)sampleRate error:(NSError **)outError;
233+
- (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError **)outError;
234+
- (BOOL)setPreferredInputNumberOfChannels:(NSInteger)count error:(NSError **)outError;
235+
- (BOOL)setPreferredOutputNumberOfChannels:(NSInteger)count error:(NSError **)outError;
236+
- (BOOL)overrideOutputAudioPort:(AVAudioSessionPortOverride)portOverride error:(NSError **)outError;
237+
- (BOOL)setPreferredInput:(AVAudioSessionPortDescription *)inPort error:(NSError **)outError;
238+
- (BOOL)setInputDataSource:(AVAudioSessionDataSourceDescription *)dataSource
239+
error:(NSError **)outError;
240+
- (BOOL)setOutputDataSource:(AVAudioSessionDataSourceDescription *)dataSource
241+
error:(NSError **)outError;
242+
@end
243+
244+
@interface RTC_OBJC_TYPE (RTCAudioSession)
245+
(Configuration)
246+
247+
/** Applies the configuration to the current session. Attempts to set all
248+
* properties even if previous ones fail. Only the last error will be
249+
* returned.
250+
* |lockForConfiguration| must be called first.
251+
*/
252+
- (BOOL)setConfiguration : (RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *)configuration error
253+
: (NSError **)outError;
254+
255+
/** Convenience method that calls both setConfiguration and setActive.
256+
* |lockForConfiguration| must be called first.
257+
*/
258+
- (BOOL)setConfiguration:(RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *)configuration
259+
active:(BOOL)active
260+
error:(NSError **)outError;
261+
262+
@end
263+
264+
NS_ASSUME_NONNULL_END
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
3+
*
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
6+
* tree. An additional intellectual property rights grant can be found
7+
* in the file PATENTS. All contributing project authors may
8+
* be found in the AUTHORS file in the root of the source tree.
9+
*/
10+
11+
#import <AVFoundation/AVFoundation.h>
12+
#import <Foundation/Foundation.h>
13+
14+
#import <WebRTC/RTCMacros.h>
15+
16+
NS_ASSUME_NONNULL_BEGIN
17+
18+
RTC_EXTERN const int kRTCAudioSessionPreferredNumberOfChannels;
19+
RTC_EXTERN const double kRTCAudioSessionHighPerformanceSampleRate;
20+
RTC_EXTERN const double kRTCAudioSessionLowComplexitySampleRate;
21+
RTC_EXTERN const double kRTCAudioSessionHighPerformanceIOBufferDuration;
22+
RTC_EXTERN const double kRTCAudioSessionLowComplexityIOBufferDuration;
23+
24+
// Struct to hold configuration values.
25+
RTC_OBJC_EXPORT
26+
@interface RTC_OBJC_TYPE (RTCAudioSessionConfiguration) : NSObject
27+
28+
@property(nonatomic, strong) NSString *category;
29+
@property(nonatomic, assign) AVAudioSessionCategoryOptions categoryOptions;
30+
@property(nonatomic, strong) NSString *mode;
31+
@property(nonatomic, assign) double sampleRate;
32+
@property(nonatomic, assign) NSTimeInterval ioBufferDuration;
33+
@property(nonatomic, assign) NSInteger inputNumberOfChannels;
34+
@property(nonatomic, assign) NSInteger outputNumberOfChannels;
35+
36+
/** Initializes configuration to defaults. */
37+
- (instancetype)init NS_DESIGNATED_INITIALIZER;
38+
39+
/** Returns the current configuration of the audio session. */
40+
+ (instancetype)currentConfiguration;
41+
/** Returns the configuration that WebRTC needs. */
42+
+ (instancetype)webRTCConfiguration;
43+
/** Provide a way to override the default configuration. */
44+
+ (void)setWebRTCConfiguration:(RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *)configuration;
45+
46+
@end
47+
48+
NS_ASSUME_NONNULL_END
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
3+
*
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
6+
* tree. An additional intellectual property rights grant can be found
7+
* in the file PATENTS. All contributing project authors may
8+
* be found in the AUTHORS file in the root of the source tree.
9+
*/
10+
11+
#import <Foundation/Foundation.h>
12+
13+
#import <WebRTC/RTCMacros.h>
14+
#import <WebRTC/RTCMediaSource.h>
15+
16+
NS_ASSUME_NONNULL_BEGIN
17+
18+
RTC_OBJC_EXPORT
19+
@interface RTC_OBJC_TYPE (RTCAudioSource) : RTC_OBJC_TYPE(RTCMediaSource)
20+
21+
- (instancetype)init NS_UNAVAILABLE;
22+
23+
// Sets the volume for the RTCMediaSource. |volume| is a gain value in the range
24+
// [0, 10].
25+
// Temporary fix to be able to modify volume of remote audio tracks.
26+
// TODO(kthelgason): Property stays here temporarily until a proper volume-api
27+
// is available on the surface exposed by webrtc.
28+
@property(nonatomic, assign) double volume;
29+
30+
@end
31+
32+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)