fix(playback): fix built-in speaker detection and bypass capabilities…#540
Open
mattsigal wants to merge 1 commit into
Open
fix(playback): fix built-in speaker detection and bypass capabilities…#540mattsigal wants to merge 1 commit into
mattsigal wants to merge 1 commit into
Conversation
… gating on manual AVR override - Update native route type resolution to identify built-in speakers for Smart TV panels and fall back to HDMI only on external streaming boxes. - Relocate audio capabilities routing/gating checks from native code to Dart side in `AudioCapabilityProfile.fromMap`. - Ensure manual AVR override (AV receiver preset) bypasses capability gating, setting the route type to HDMI and unlocking up to 8 PCM channels and HD audio pass-throughs (TrueHD, DTS-HD, etc.). - Refactor player backends and playback module to read consolidated audio capabilities from user preferences.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
This PR fixes the issue where built-in TV speakers are misdetected as HDMI receivers (ROUTE_HDMI), and when the user manually overrides "Audio Output" to "AV receiver (Atmos / DTS:X)", the app still downmixes to stereo. It updates the native audio routing logic to correctly detect TV speakers and shifts the capability-gating logic to the Dart side so that manual preference overrides can bypass route restrictions.
On a Smart TV panel (e.g., Sony Bravia, TCL, Hisense running Android TV) using its built-in speakers the Android OS reports both AudioDeviceInfo.TYPE_BUILTIN_SPEAKER and AudioDeviceInfo.TYPE_HDMI (the HDMI inputs on the back of the TV panel). Before this PR, because TYPE_HDMI was checked first in resolveRouteType, the TV resolved to ROUTE_HDMI (thinking an external AVR was connected). As a result, the TV speakers were incorrectly treated as a surround receiver, and the app attempted to bitstream lossless formats like TrueHD and DTS-HD. Because TV speakers cannot decode or handle lossless passthrough, the user got complete silence or playback hangs.
With this PR, isExternalBox returns false on a TV panel, causing it to correctly fall back to ROUTE_SPEAKER (TV Speakers), restricting the output to stereo PCM and forcing the server to transcode TrueHD/DTS-HD.
Related Issues
Type of Change
Changes Made
Android Native (android/app) AudioCapabilities.kt :
Flutter/Dart Client (lib) audio_capability_profile.dart:
user_preferences.dart:
settings_side_panel.dart:
Player Backends & Playback Module:
Refactored media3_player_backend.dart, media_kit_player_backend.dart, appletv_mpv_backend.dart, html_video_backend_profile.dart, and playback_module.dart to query the consolidated detectedAudioCapabilities from preferences, removing redundant snapshot parses and unused imports.
Platform
Testing
Describe how this change was tested.
Test Steps
Screenshots (if applicable)
AVR ON:

AVR OFF:

Checklist