Skip to content

Conversation

@PratimMallick
Copy link
Contributor

@PratimMallick PratimMallick commented Nov 4, 2025

Goal

This PR adds support for HiFi (high-fidelity) audio in the Stream Video Android SDK, enabling users to choose a certain type of audio profile before joining the call.
This enhancement allows applications to provide better audio quality for music streaming, podcast calls, or any scenario requiring higher audio fidelity

Implementation

  1. Audio Bitrate Profile Support (MediaManager.kt):

    • Added audioBitrateProfile StateFlow in MicrophoneManager to track current audio profile
    • Implemented setAudioBitrateProfile() method that validates:
      • HiFi audio must be enabled in dashboard settings to use MUSIC_HIGH_QUALITY
      • Profile can only be changed before joining a call
    • Added AudioBitrateProfile enum support with VOICE_STANDARD_UNSPECIFIED and MUSIC_HIGH_QUALITY options
  2. Peer Connection Factory Refactoring (StreamPeerConnectionFactory.kt):

    • Refactored factory creation to accept audioBitrateProfileProvider function, which enables it to turn off hardware AEC, NS
    • Factory is recreated when audio profile changes (before joining)
  3. Call State Management (Call.kt):

  • Added ensureFactoryMatchesAudioProfile() to validate factory matches current profile
  • Implemented recreateFactoryAndAudioTracks() to rebuild factory and tracks. This is needed if app has to provide a toggle in Lobby screen, where intial factory is already created with the default audioProfile
  • Made video/audio tracks and sources nullable and lazy-initialized for proper recreation
  • Shared EGL base context between factory and media manager to break circular dependency
  1. UI Components (ToggleHifiAudioAction.kt):

    • New composable action button for toggling HiFi audio
    • Integrates with CallAction system via ToggleHifiAudio action
    • Provides visual feedback with music note icons (MusicNote/MusicOff)
  2. Demo App Integration:

    • Added HiFi audio toggle in CallLobbyScreen and CallScreen

🎨 UI Changes

Screenshot_20251105_122805

Testing

  1. HiFi Audio Toggle:
    • Start a call from the demo app
    • Use the music note icon button in call controls to toggle HiFi audio
    • Verify that the publishing bitrate of audio is 128 kbps,
    • Verify that remote audio is looped back and sent again creating an echo which denotes that AEC is turned off
    • If you can, then play an instrument of your choice and observe the quality on the other side. The high notes should not be cut off denoting , both NS and AGC are turned off

PratimMallick and others added 19 commits October 16, 2025 09:33
…one when adding stereo capture to recording feature
… any remote track has come in. Updated to webrtc which has the fix for this.
@PratimMallick PratimMallick requested a review from a team as a code owner November 4, 2025 13:49
@PratimMallick PratimMallick marked this pull request as draft November 4, 2025 13:50
…nto hifi_audio

# Conflicts:
#	stream-video-android-core/api/stream-video-android-core.api
#	stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/MediaManager.kt
#	stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/connection/StreamPeerConnectionFactory.kt
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 11.91 MB 11.91 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.25 MB 6.27 MB 0.02 MB 🟢

… come under breaking change

Make eglbase optional param while creating StreamPeerConnectionFctory so that it doesnt come under breaking change
@PratimMallick PratimMallick changed the title hifi_audio Added support for High fidelity (hi-fi) audio capture Nov 5, 2025
@PratimMallick PratimMallick added the pr:new-feature Adds new functionality label Nov 5, 2025
@PratimMallick PratimMallick marked this pull request as ready for review November 5, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:new-feature Adds new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants