From b55955ef1cea57a5996ae4c1c7ba0d650971dd7a Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 24 Jun 2022 23:10:35 -0700 Subject: [PATCH] [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 --- Audio/Output/OutputAVFoundation.h | 1 + Audio/Output/OutputAVFoundation.m | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Audio/Output/OutputAVFoundation.h b/Audio/Output/OutputAVFoundation.h index 8f1552213..8d415c6c1 100644 --- a/Audio/Output/OutputAVFoundation.h +++ b/Audio/Output/OutputAVFoundation.h @@ -79,6 +79,7 @@ using std::atomic_long; uint32_t deviceChannelConfig; uint32_t streamChannelConfig; + uint32_t newChannelConfig; AVSampleBufferAudioRenderer *audioRenderer; AVSampleBufferRenderSynchronizer *renderSynchronizer; diff --git a/Audio/Output/OutputAVFoundation.m b/Audio/Output/OutputAVFoundation.m index 2790aaf10..f7b6096cc 100644 --- a/Audio/Output/OutputAVFoundation.m +++ b/Audio/Output/OutputAVFoundation.m @@ -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]; } }