[Audio Output] Correctly delay layout updates

Channel layout updates should be delayed when resampling, just like
sample format changes are.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-24 23:10:35 -07:00
parent 8e1175bbd4
commit b55955ef1c
2 changed files with 4 additions and 1 deletions

View File

@ -79,6 +79,7 @@ using std::atomic_long;
uint32_t deviceChannelConfig;
uint32_t streamChannelConfig;
uint32_t newChannelConfig;
AVSampleBufferAudioRenderer *audioRenderer;
AVSampleBufferRenderSynchronizer *renderSynchronizer;

View File

@ -107,7 +107,7 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
}
[currentPtsLock unlock];
newFormat = format;
streamChannelConfig = config;
newChannelConfig = config;
streamFormatStarted = YES;
visFormat = format;
@ -118,6 +118,7 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
downmixerForVis = [[DownmixProcessor alloc] initWithInputFormat:format inputConfig:config andOutputFormat:visFormat outputConfig:AudioConfigMono];
if(!r8bold) {
streamFormat = format;
streamChannelConfig = config;
[self updateStreamFormat];
}
}
@ -714,6 +715,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
if(r8bDone) {
r8bDone = NO;
streamFormat = newFormat;
streamChannelConfig = newChannelConfig;
[self updateStreamFormat];
}
}