Skip to content

fix: fix sample rate bug for Android on Unity 6000 or newer. #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Runtime/Scripts/RtcAudioSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public abstract class RtcAudioSource : IRtcSource, IDisposable
/// </remarks>
public abstract event Action<float[], int, int> AudioRead;

#if UNITY_IOS && !UNITY_EDITOR
// iOS microphone sample rate is 24k
#if (UNITY_IOS || (UNITY_ANDROID && UNITY_6000_0_OR_NEWER)) && !UNITY_EDITOR
// iOS/Android(Unity 6000+) microphone sample rate is 24k
Comment on lines +35 to +36
Copy link
Preview

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preprocessor symbol UNITY_6000_0_OR_NEWER does not correspond to any existing Unity version macro, so this block will never compile for Android. Use the correct Unity version define (e.g., UNITY_2020_3_OR_NEWER or another valid version) to ensure the Android path is enabled.

Suggested change
#if (UNITY_IOS || (UNITY_ANDROID && UNITY_6000_0_OR_NEWER)) && !UNITY_EDITOR
// iOS/Android(Unity 6000+) microphone sample rate is 24k
#if (UNITY_IOS || (UNITY_ANDROID && UNITY_2020_3_OR_NEWER)) && !UNITY_EDITOR
// iOS/Android(Unity 2020.3+) microphone sample rate is 24k

Copilot uses AI. Check for mistakes.

public static uint DefaultMicrophoneSampleRate = 24000;

public static uint DefaultSampleRate = 48000;
Expand Down
Loading