[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 deviceChannelConfig;
uint32_t streamChannelConfig; uint32_t streamChannelConfig;
uint32_t newChannelConfig;
AVSampleBufferAudioRenderer *audioRenderer; AVSampleBufferAudioRenderer *audioRenderer;
AVSampleBufferRenderSynchronizer *renderSynchronizer; AVSampleBufferRenderSynchronizer *renderSynchronizer;

View File

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