mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Make RTCAudioSession accessible to Swift.
This is done by: 1. removing the <vector> include from RTCAudioSession+Private, 2. creating a audio_session_objc package that excludes the RTCNativeAudioSessionDelegateAdapter class. Bug: webrtc:11237 Change-Id: I36c86542a19e3244456fd164d908563b1435de29 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163900 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Chuck Hays <haysc@webrtc.org> Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30177}
This commit is contained in:
parent
0c20213e2a
commit
0b3a6e383e
5 changed files with 45 additions and 11 deletions
|
@ -521,7 +521,7 @@ def CheckPublicDepsIsNotUsed(gn_files, input_api, output_api):
|
|||
"""Checks that public_deps is not used without a good reason."""
|
||||
result = []
|
||||
no_presubmit_check_re = input_api.re.compile(
|
||||
r'# no-presubmit-check TODO\(webrtc:8603\)')
|
||||
r'# no-presubmit-check TODO\(webrtc:\d+\)')
|
||||
error_msg = ('public_deps is not recommended in WebRTC BUILD.gn files '
|
||||
'because it doesn\'t map well to downstream build systems.\n'
|
||||
'Used in: %s (line %d).\n'
|
||||
|
|
40
sdk/BUILD.gn
40
sdk/BUILD.gn
|
@ -286,7 +286,37 @@ if (is_ios || is_mac) {
|
|||
libs = [ "AudioToolbox.framework" ]
|
||||
}
|
||||
|
||||
rtc_library("audio_objc") {
|
||||
# This target exists to expose :audio_session_objc and
|
||||
# :audio_session_delegate_adapter_objc for backward compatibility,
|
||||
# and should be deprecated.
|
||||
group("audio_objc") {
|
||||
public_deps = [ # no-presubmit-check TODO(webrtc:11238)
|
||||
":audio_session_delegate_adapter_objc",
|
||||
":audio_session_objc",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_library("audio_session_delegate_adapter_objc") {
|
||||
sources = [
|
||||
"objc/components/audio/RTCNativeAudioSessionDelegateAdapter.h",
|
||||
"objc/components/audio/RTCNativeAudioSessionDelegateAdapter.mm",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"..:common_objc",
|
||||
":used_from_extension",
|
||||
]
|
||||
|
||||
public_configs = [ ":common_config_objc" ]
|
||||
|
||||
deps = [
|
||||
":audio_session_objc",
|
||||
":audio_session_observer",
|
||||
":base_objc",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_library("audio_session_objc") {
|
||||
sources = [
|
||||
"objc/components/audio/RTCAudioSession+Configuration.mm",
|
||||
"objc/components/audio/RTCAudioSession+Private.h",
|
||||
|
@ -294,9 +324,8 @@ if (is_ios || is_mac) {
|
|||
"objc/components/audio/RTCAudioSession.mm",
|
||||
"objc/components/audio/RTCAudioSessionConfiguration.h",
|
||||
"objc/components/audio/RTCAudioSessionConfiguration.m",
|
||||
"objc/components/audio/RTCNativeAudioSessionDelegateAdapter.h",
|
||||
"objc/components/audio/RTCNativeAudioSessionDelegateAdapter.mm",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"..:common_objc",
|
||||
":used_from_extension",
|
||||
|
@ -307,7 +336,6 @@ if (is_ios || is_mac) {
|
|||
libs = [ "AVFoundation.framework" ]
|
||||
|
||||
deps = [
|
||||
":audio_session_observer",
|
||||
":base_objc",
|
||||
":helpers_objc",
|
||||
"../rtc_base",
|
||||
|
@ -1073,7 +1101,7 @@ if (is_ios || is_mac) {
|
|||
|
||||
deps = [
|
||||
":audio_device",
|
||||
":audio_objc",
|
||||
":audio_session_objc",
|
||||
":base_objc",
|
||||
":callback_logger_objc",
|
||||
":framework_objc",
|
||||
|
@ -1225,7 +1253,7 @@ if (is_ios || is_mac) {
|
|||
|
||||
if (is_ios) {
|
||||
sources += [ "objc/unittests/RTCAudioSessionTest.mm" ]
|
||||
deps += [ ":audio_objc" ]
|
||||
deps += [ ":audio_session_objc" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
#import "RTCAudioSession.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RTCAudioSessionConfiguration;
|
||||
|
@ -77,8 +75,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
- (NSError *)configurationErrorWithDescription:(NSString *)description;
|
||||
|
||||
// Properties and methods for tests.
|
||||
@property(nonatomic, readonly) std::vector<__weak id<RTCAudioSessionDelegate> > delegates;
|
||||
|
||||
- (void)notifyDidBeginInterruption;
|
||||
- (void)notifyDidEndInterruptionWithShouldResumeSession:(BOOL)shouldResumeSession;
|
||||
- (void)notifyDidChangeRouteWithReason:(AVAudioSessionRouteChangeReason)reason
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "rtc_base/atomic_ops.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/critical_section.h"
|
||||
|
@ -25,6 +27,10 @@ NSInteger const kRTCAudioSessionErrorLockRequired = -1;
|
|||
NSInteger const kRTCAudioSessionErrorConfiguration = -2;
|
||||
NSString * const kRTCAudioSessionOutputVolumeSelector = @"outputVolume";
|
||||
|
||||
@interface RTCAudioSession ()
|
||||
@property(nonatomic, readonly) std::vector<__weak id<RTCAudioSessionDelegate> > delegates;
|
||||
@end
|
||||
|
||||
// This class needs to be thread-safe because it is accessed from many threads.
|
||||
// TODO(tkchin): Consider more granular locking. We're not expecting a lot of
|
||||
// lock contention so coarse locks should be fine for now.
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <OCMock/OCMock.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "rtc_base/gunit.h"
|
||||
|
||||
#import "components/audio/RTCAudioSession+Private.h"
|
||||
|
@ -20,6 +22,8 @@
|
|||
|
||||
@interface RTCAudioSession (UnitTesting)
|
||||
|
||||
@property(nonatomic, readonly) std::vector<__weak id<RTCAudioSessionDelegate> > delegates;
|
||||
|
||||
- (instancetype)initWithAudioSession:(id)audioSession;
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue