Skip to content

Commit b71a6f2

Browse files
committed
ios16 单声道audiounit
Change-Id: I956697a9f0a4f006a3456c6ed89962a6b14cfc98
1 parent 05f6c87 commit b71a6f2

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ - (void)getDeviceStatusWithType:(NSString *)singleType qualityType:(NSString *)q
264264
TIoTCoreAudioConfig *audio_config = [TIoTCoreAudioConfig new];
265265
audio_config.refreshSession = NO;
266266
audio_config.sampleRate = TIoTAVCaptionFLVAudio_16;
267-
audio_config.channels = 2;
267+
audio_config.channels = 1;
268268
audio_config.isEchoCancel = NO;
269269
audio_config.pitch = tt_pitch; // -6声音会变粗一点; 6声音会变细一点
270270

Source/LinkSDKDemo/Video/P2P/Controller/TIoTSessionManager.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,12 @@ - (void)resumeRTCAudioSession {
9696
if (@available(iOS 10.0, *)) {
9797
categoryOptions |= AVAudioSessionCategoryOptionAllowBluetooth;
9898
}
99-
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:categoryOptions error:nil];
100-
[[AVAudioSession sharedInstance] setActive:YES error:nil];
99+
AVAudioSession *session = [AVAudioSession sharedInstance];
100+
[session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:categoryOptions error:nil];
101+
// [session setPreferredSampleRate:16000 error:nil];
102+
// [session setPreferredInputNumberOfChannels:1 error:nil];
103+
// [session setPreferredIOBufferDuration:0.064 error:nil]; //16000*0.032*2=1024字节
104+
[session setActive:YES error:nil];
101105
}
102106
}
103107
//功能结束时重置audioSession,重置到缓存的audioSession设置

Source/SDK/LinkVideo/FLV/TIoTAACEncoder.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ -(void)encodePCMData:(NSData *)pcmdata {
127127
ConverterContext *cxt = self->convertContext;
128128
if (cxt && cxt->converter) {
129129

130-
dispatch_async(encodeQueue, ^{
130+
// dispatch_async(encodeQueue, ^{
131131

132132
NSUInteger pcmLength = pcmdata.length;
133133
void *pcmData = pcmdata.bytes;
@@ -168,7 +168,7 @@ -(void)encodePCMData:(NSData *)pcmdata {
168168
free(outputBuffer);
169169
outputBuffer = NULL;
170170
}
171-
});
171+
// });
172172
}
173173
}
174174

0 commit comments

Comments
 (0)