-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to use audio units other than Voice-Processing I/O unit
- Loading branch information
1 parent
79c60ca
commit 6fcc170
Showing
10 changed files
with
186 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
sdk/objc/api/peerconnection/RTCAudioDeviceModule+Private.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2019 pixiv Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a license that can be | ||
* found in the LICENSE.pixiv file in the root of the source tree. | ||
*/ | ||
|
||
#import "RTCAudioDeviceModule.h" | ||
|
||
#if defined(WEBRTC_IOS) | ||
#include "sdk/objc/native/src/audio/audio_device_module_ios.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface RTCAudioDeviceModule () | ||
|
||
@property(nonatomic, readonly) rtc::scoped_refptr<webrtc::ios_adm::AudioDeviceModuleIOS> | ||
nativeModule; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright 2019 pixiv Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a license that can be | ||
* found in the LICENSE.pixiv file in the root of the source tree. | ||
*/ | ||
|
||
#import <CoreMedia/CoreMedia.h> | ||
#import <Foundation/Foundation.h> | ||
|
||
#import "RTCMacros.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
RTC_OBJC_EXPORT | ||
|
||
@interface RTCAudioDeviceModule : NSObject | ||
|
||
- (void)deliverRecordedData:(CMSampleBufferRef)sampleBuffer; | ||
@property(nonatomic, assign) OSType audioUnitSubType; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2019 pixiv Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by a license that can be | ||
* found in the LICENSE.pixiv file in the root of the source tree. | ||
*/ | ||
|
||
#include <AudioUnit/AudioUnit.h> | ||
|
||
#import "RTCAudioDeviceModule+Private.h" | ||
#include "rtc_base/ref_counted_object.h" | ||
|
||
@implementation RTCAudioDeviceModule { | ||
#if defined(WEBRTC_IOS) | ||
rtc::scoped_refptr<webrtc::ios_adm::AudioDeviceModuleIOS> _nativeModule; | ||
#endif | ||
} | ||
|
||
- (instancetype)init { | ||
#if defined(WEBRTC_IOS) | ||
self = [super init]; | ||
_nativeModule = new rtc::RefCountedObject<webrtc::ios_adm::AudioDeviceModuleIOS>(); | ||
return self; | ||
#else | ||
return nullptr; | ||
#endif | ||
} | ||
|
||
- (void)deliverRecordedData:(CMSampleBufferRef)sampleBuffer { | ||
#if defined(WEBRTC_IOS) | ||
_nativeModule->OnDeliverRecordedExternalData(sampleBuffer); | ||
#endif | ||
} | ||
|
||
- (void)setAudioUnitSubType:(OSType)audioUnitSubType { | ||
#if defined(WEBRTC_IOS) | ||
_nativeModule->SetAudioUnitSubType(audioUnitSubType); | ||
#endif | ||
} | ||
|
||
- (OSType)audioUnitSubType { | ||
#if defined(WEBRTC_IOS) | ||
return _nativeModule->GetAudioUnitSubType(); | ||
#else | ||
return kAudioUnitSubType_VoiceProcessingIO; | ||
#endif | ||
} | ||
|
||
#pragma mark - Private | ||
|
||
#if defined(WEBRTC_IOS) | ||
- (rtc::scoped_refptr<webrtc::ios_adm::AudioDeviceModuleIOS>)nativeModule { | ||
return _nativeModule; | ||
} | ||
#endif | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters