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

Conversation

cloudwebrtc
Copy link
Contributor

@cloudwebrtc cloudwebrtc commented Jun 30, 2025

close #132

@cloudwebrtc cloudwebrtc requested review from ladvoc and Copilot June 30, 2025 01:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extends the microphone sample rate override to Android when building with Unity 6.0.0 or newer and updates the inline comment to reflect that change.

  • Include Android (Unity 6.0+) in the DefaultMicrophoneSampleRate preprocessor condition
  • Update comment to mention both iOS and Android sample rates
Comments suppressed due to low confidence (2)

Runtime/Scripts/RtcAudioSource.cs:36

  • [nitpick] Clarify the comment to reference a valid Unity version macro and platform, for example: // iOS and Android (Unity 2020.3 or newer) microphone sample rate is 24 kHz.
        // iOS/Android(Unity 6000+) microphone sample rate is 24k

Runtime/Scripts/RtcAudioSource.cs:37

  • [nitpick] Add unit or integration tests to verify that DefaultMicrophoneSampleRate resolves to 24000 in both iOS and Android builds (with and without UNITY_EDITOR) to prevent regressions.
        public static uint DefaultMicrophoneSampleRate = 24000;

Comment on lines +35 to +36
#if (UNITY_IOS || (UNITY_ANDROID && UNITY_6000_0_OR_NEWER)) && !UNITY_EDITOR
// iOS/Android(Unity 6000+) microphone sample rate is 24k
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android microphone audio not received by other participants (LiveKit Unity SDK v1.2.4)
1 participant