diff --git a/build/patches/airpod_fixes.patch b/build/patches/airpod_fixes.patch new file mode 100644 index 0000000..54ea03f --- /dev/null +++ b/build/patches/airpod_fixes.patch @@ -0,0 +1,30 @@ +diff --git a/modules/audio_device/mac/audio_device_mac.cc b/modules/audio_device/mac/audio_device_mac.cc +index 0a371737b3..e3a902270d 100644 +--- a/modules/audio_device/mac/audio_device_mac.cc ++++ b/modules/audio_device/mac/audio_device_mac.cc +@@ -2096,12 +2096,6 @@ int32_t AudioDeviceMac::HandleStreamFormatChange( + return -1; + } + +- if (_ptrAudioBuffer && streamFormat.mChannelsPerFrame != _recChannels) { +- RTC_LOG(LS_ERROR) << "Changing channels not supported (mChannelsPerFrame = " +- << streamFormat.mChannelsPerFrame << ")"; +- return -1; +- } +- + RTC_LOG(LS_VERBOSE) << "Stream format:"; + RTC_LOG(LS_VERBOSE) << "mSampleRate = " << streamFormat.mSampleRate + << ", mChannelsPerFrame = " +@@ -2115,6 +2109,12 @@ int32_t AudioDeviceMac::HandleStreamFormatChange( + logCAMsg(rtc::LS_VERBOSE, "mFormatID", (const char*)&streamFormat.mFormatID); + + if (propertyAddress.mScope == kAudioDevicePropertyScopeInput) { ++ if (_ptrAudioBuffer && streamFormat.mChannelsPerFrame != _recChannels) { ++ RTC_LOG(LS_ERROR) << "Changing channels not supported (mChannelsPerFrame = " ++ << streamFormat.mChannelsPerFrame << ")"; ++ return -1; ++ } ++ + const int io_block_size_samples = streamFormat.mChannelsPerFrame * + streamFormat.mSampleRate / 100 * + N_BLOCKS_IO; diff --git a/build/run.py b/build/run.py index 397fcbd..0863dd6 100644 --- a/build/run.py +++ b/build/run.py @@ -222,6 +222,7 @@ def get_depot_tools(source_dir, fetch=False): 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', 'dont_fatal_error_on_audio_device_stop.patch', + 'airpod_fixes.patch', ], 'macos_arm64': [ 'add_license_dav1d.patch', @@ -232,6 +233,7 @@ def get_depot_tools(source_dir, fetch=False): 'disable_mute_of_audio_processing.patch', 'crash_on_fatal_error.patch', 'dont_fatal_error_on_audio_device_stop.patch', + 'airpod_fixes.patch', ], 'ios': [ 'add_license_dav1d.patch',