Skip to content

Fire OS experimental audio compatibility + DTS-HD fallback hardening (stacked on #387)#563

Open
johnneerdael wants to merge 50 commits intotapframe:devfrom
johnneerdael:feat/dts-firetv-fix
Open

Fire OS experimental audio compatibility + DTS-HD fallback hardening (stacked on #387)#563
johnneerdael wants to merge 50 commits intotapframe:devfrom
johnneerdael:feat/dts-firetv-fix

Conversation

@johnneerdael
Copy link
Contributor

@johnneerdael johnneerdael commented Mar 3, 2026

Summary

Expands the experimental Fire OS audio compatibility path and adds targeted DTS-HD fallback robustness for limited Fire TV devices, behind the existing opt-in toggle.

This PR is stacked on #387 and keeps default behavior unchanged for users who do not enable the Fire OS compatibility toggle.

Why

Community testing on Fire TV reported continued DTS-HD MA 7.1 failures. The earlier experimental path needed stricter fallback behavior and clearer diagnostics on limited Fire TV models.

Amazon's Media3 external port also applies Fire OS specific passthrough and compatibility quirks, so this PR ports the relevant behavior in a guarded way.

Testing

  • :media:lib-exoplayer:compileReleaseJavaWithJavac passed
  • :media:lib-exoplayer:compileDebugJavaWithJavac passed
  • :media:lib-exoplayer-hls:compileDebugJavaWithJavac passed after cleaning stale buildout outputs
  • :app:packageDebugUniversalApk --rerun-tasks --console=plain passed
  • Fresh artifact produced:
    • app/build/outputs/apk_from_bundle/debug/app-debug-universal.apk

Notes:

  • Focused unit-test invocation in this branch hit pre-existing unrelated test compile drift in other test classes; this patch includes dedicated AudioCapabilities test coverage for the new Fire TV DTS fallback logic.

Breaking changes

  • None by default.
  • All Fire OS-specific behavior is still behind Fire OS - Experimental Audio Compatibility (opt-in).
  • Non-Fire devices and users with the toggle disabled keep the normal playback path.

Linked issues

Additional details

Under the Fire OS experimental toggle, this PR now includes:

  1. Limited Fire TV DTS-HD 7.1 clamp
  • For limited Fire TV devices, DTS-HD-like passthrough fallback now clamps 7.1 channel layouts to 5.1 core DTS for better AVR/device compatibility.
  1. Stronger DTS-HD-like detection
  • Fallback matching now uses both MIME and codec-hint detection, so DTS-HD-like streams are caught even when metadata is inconsistent.
  1. Structured fallback telemetry
  • Added FIREOS_DTS_FALLBACK log line with model/mime/codecs/encoding/channel mapping details for reproducible field debugging.
  1. Targeted test coverage
  • Added/updated AudioCapabilities tests for limited Fire TV DTS-HD behavior (including fallback and channel clamp scenarios).

Also retained from earlier Fire OS compatibility work (same toggle):

  • Fire OS surround-sound flag routing in AudioCapabilitiesReceiver
  • Fire OS-oriented passthrough routing in MediaCodecAudioRenderer
  • Amazon-style encoded output MIME fallback behavior
  • Legacy Amazon timing/latency quirk path for affected old-device classes
  • skipProfileLevelCheck wiring in MediaCodecInfo behind the same experimental toggle
  • Legacy Fire TV Gen1-family Dolby passthrough direct-track path

John Neerdael and others added 30 commits February 21, 2026 03:02
- cap VOD cache to 500MB and keep cache fail-safe fallback behavior

- integrate parallel range datasource path with persisted network settings

- add memory-budget-aware buffer/network settings UI + datastore/viewmodel plumbing

- add Dolby Vision decoder resilience: enable decoder fallback and conditional DV->HEVC/HDR10 codec selector

- retry once on Dolby Vision decoder failure and persist per-stream fallback memory

- rename playback toggle to 'Force HDR10 Fallback' with profile caveat
…me-stacked

# Conflicts:
#	app/src/main/java/com/nuvio/tv/data/local/PlayerSettingsDataStore.kt
#	app/src/main/java/com/nuvio/tv/ui/screens/player/PlayerMediaSourceFactory.kt
#	app/src/main/java/com/nuvio/tv/ui/screens/player/PlayerRuntimeController.kt
#	app/src/main/java/com/nuvio/tv/ui/screens/player/PlayerRuntimeControllerInitialization.kt
#	app/src/main/java/com/nuvio/tv/ui/screens/player/PlayerRuntimeControllerObservers.kt
#	app/src/main/java/com/nuvio/tv/ui/screens/player/PlayerRuntimeControllerPlaybackEvents.kt
#	app/src/main/java/com/nuvio/tv/ui/screens/player/PlayerRuntimeControllerStreams.kt
#	app/src/main/java/com/nuvio/tv/ui/screens/settings/PlaybackAutoPlaySettings.kt
#	local.example.properties
@johnneerdael
Copy link
Contributor Author

Can try a DTS HD 7.1 track, let me know it works then select the DTS HD 5.1. Also what happens when you select them.

@ram130 I tried to add some fixes for DTS-HD MA 7.1 (your suggested channel fix). dts-universal-debug.apk

let me know if this fixes it.

@johnneerdael johnneerdael changed the title Experimental DTS IEC passthrough for Fire TV (stacked on #387) Fire OS experimental audio compatibility + DTS-HD fallback hardening (stacked on #387) Mar 4, 2026
@DHARMAHydra
Copy link

Okay, will check again ASAP

@DHARMAHydra
Copy link

DHARMAHydra commented Mar 4, 2026

@ram130 @johnneerdael I tested it again, still no audio coming from my Fire Cube 3 on both DTS-HD 5.1 and 7.1 tracks at all. And yes I toggled it on and was sure it was on. Plus, the update info screen kept popping up after I supposedly installed the update.

@johnneerdael
Copy link
Contributor Author

johnneerdael commented Mar 4, 2026

@ram130 @johnneerdael I tested it again, still no audio coming from my Fire Cube 3 on both DTS-HD 5.1 and 7.1 tracks at all. And yes I toggled it on and was sure it was on. Plus, the update info screen kept popping up after I supposedly installed the update.

that update screen is normal, this is because nuviotv rolled out a new version and this is a custom debug build. unfortunately I dont have access to fire os devices since we need adb debug logging to fix the issue your having. Does your audio device support DTS playback?

@DHARMAHydra
Copy link

@johnneerdael Yes it does. It supports DTS-HD MA and DTS:X too alongside Dolby Atmos, it's an LG SNC75 soundbar.

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 @johnneerdael I tested it again, still no audio coming from my Fire Cube 3 on both DTS-HD 5.1 and 7.1 tracks at all. And yes I toggled it on and was sure it was on. Plus, the update info screen kept popping up after I supposedly installed the update.

Thanks for testing. Just hit ignore on the update it's from the official version. As John said it's a debug version we are on and we update manually like what you did earlier to install. After you hit ignore just try again. But first. Reboot the device. And then let me know what happens when you toggle the audio tracks.

@ram130 @johnneerdael I tested it again, still no audio coming from my Fire Cube 3 on both DTS-HD 5.1 and 7.1 tracks at all. And yes I toggled it on and was sure it was on. Plus, the update info screen kept popping up after I supposedly installed the update.

that update screen is normal, this is because nuviotv rolled out a new version and this is a custom debug build. unfortunately I dont have access to fire os devices since we need adb debug logging to fix the issue your having. Does your audio device support DTS playback?

Can try a DTS HD 7.1 track, let me know it works then select the DTS HD 5.1. Also what happens when you select them.

@ram130 I tried to add some fixes for DTS-HD MA 7.1 (your suggested channel fix). dts-universal-debug.apk

let me know if this fixes it.

I can confirm their sound bar and fire tv supports it. I think I know the issue but I'm not home at the moment. I'll reply in a few hours with my thoughts and an updated code.

@DHARMAHydra
Copy link

@ram130 yup, just rebooted the device, same thing happens.

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 yup, just rebooted the device, same thing happens.

Thanks. Does the video reload when you select the track or it’s just playing with no audio?

@DHARMAHydra
Copy link

@ram130 Most times it just plays with no audio, other times the video starts to lag (not buffer, it's a lag) a lot with no audio obviously.

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 Most times it just plays with no audio, other times the video starts to lag (not buffer, it's a lag) a lot with no audio obviously.

Does Atmos True Hd work? First track on that Oppenheimer file.

@DHARMAHydra
Copy link

@ram130 Dolby Atmos/TrueHD works beautifully on all the files that I have played.

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 Dolby Atmos/TrueHD works beautifully on all the files that I have played.

Ok now let's test this. Disable the toggle Fire OS - Experimental in settings and try the DTS tracks again.

@DHARMAHydra
Copy link

@ram130 just turned it off. I played one DTS-MA 5.1 file. Video looked fine, but no audio at all. Then I played a DTS MA 7.1 file, no audio, and 20 seconds into it, the video froze. I played another one that was DTS-MA 7.1 after that, and it also froze about 19-20 seconds in, again, no audio.

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 just turned it off. I played one DTS-MA 5.1 file. Video looked fine, but no audio at all. Then I played a DTS MA 7.1 file, no audio, and 20 seconds into it, the video froze. I played another one that was DTS-MA 7.1 after that, and it also froze about 19-20 seconds in, again, no audio.

Ok we gonna update the code. I think I know the issue. Just to confirm have DTS ever worked with any other apps?

@DHARMAHydra
Copy link

@ram130 Yeah. I used Kodi to play DTS files before and they worked perfectly. Everything I put in, whether that's DTS HD MA 5.1, 7.1 or DTS:X, it all worked well. Same thing whenever I would watch a physical Blu-Ray or 4K disc with any of those formats on my PS5 as well, it worked without a hitch as well

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 Yeah. I used Kodi to play DTS files before and they worked perfectly. Everything I put in, whether that's DTS HD MA 5.1, 7.1 or DTS:X, it all worked well. Same thing whenever I would watch a physical Blu-Ray or 4K disc with any of those formats on my PS5 as well, it worked without a hitch as well

And they all showed up as DTS itself on the sound bar or had something like DTS HD MA..etc.?

@DHARMAHydra
Copy link

@ram130 I know whenever I played something that was DTS:X, it would say it right on the soundbar at the start whether on Kodi or my PS5. Because of this, this is how I knew DTS-MA tracks worked as well even though they don't say it on the soundbar right when I started them up.

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 I know whenever I played something that was DTS:X, it would say it right on the soundbar at the start whether on Kodi or my PS5. Because of this, this is how I knew DTS-MA tracks worked as well even though they don't say it on the soundbar right when I started them up.

Copy. Can't wait to see what you say on the new update.

@johnneerdael
Copy link
Contributor Author

@ram130 I know whenever I played something that was DTS:X, it would say it right on the soundbar at the start whether on Kodi or my PS5. Because of this, this is how I knew DTS-MA tracks worked as well even though they don't say it on the soundbar right when I started them up.

Copy. Can't wait to see what you say on the new update.

Did DTS-HD MA 7.1 streams now work for you @ram130 , towards @DHARMAHydra I guess the media3 fork from amazon doesnt handle your device well for DTS streams... Without adb debug logging I cant do much

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 I know whenever I played something that was DTS:X, it would say it right on the soundbar at the start whether on Kodi or my PS5. Because of this, this is how I knew DTS-MA tracks worked as well even though they don't say it on the soundbar right when I started them up.

Copy. Can't wait to see what you say on the new update.

Did DTS-HD MA 7.1 streams now work for you @ram130 , towards @DHARMAHydra I guess the media3 fork from amazon doesnt handle your device well for DTS streams... Without adb debug logging I cant do much

Check my reply in the other thread for the new code. Or I can post it here if you want.

Update: here's the relevant reply:

For the Fire TV cube issue the code does block it for those devices from the downgrade block, and only to allow full pass through to happen.

After reviewing the developer specs for the Cube 3 (model AFTGAZL,) it explicitly say “DTS-HD passthrough (basic profile)” only — not full lossless. Same as every other Fire TV device

Man Amazon sucks lol.

New code
Just replace the helper with some variation of this or use it:


private boolean isFireTvLimitedDtsDevice() {
    return "Amazon".equalsIgnoreCase(Build.MANUFACTURER)
            && Build.MODEL.startsWith("AFT");  // Covers EVERY Fire TV. 
}

So something like that. Once done it should work.

@ram130
Copy link

ram130 commented Mar 5, 2026

Let me know when it's updated so I can have another test it as well.

@DHARMAHydra
Copy link

@ram130 I don't really understand why the dev specs of the Cube 3 says that it's only DTS-HD basic profile and not full lossless, as again, Kodi plays DTS:X 7.1 well on my Cube 3, and that's a lossless format. I know Kodi found their own fix for that, to make it play lossless.

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 I don't really understand why the dev specs of the Cube 3 says that it's only DTS-HD basic profile and not full lossless, as again, Kodi plays DTS:X 7.1 well on my Cube 3, and that's a lossless format. I know Kodi found their own fix for that, to make it play lossless.

Yeah I was confused at first. I think your soundbar could be up mixing it using a dsp. Kinda like how Dolby pro logic worked. I'm check how Kodi did it. And report back.

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 I don't really understand why the dev specs of the Cube 3 says that it's only DTS-HD basic profile and not full lossless, as again, Kodi plays DTS:X 7.1 well on my Cube 3, and that's a lossless format. I know Kodi found their own fix for that, to make it play lossless.

Ok I figured it out. They did a custom work around and rebranded it Kodi IEC packer.
image

They have their own custom “Kodi IEC packer” written in native C++ inside AESinkAUDIOTRACK.cpp.

See this https://github.com/xbmc/xbmc/blob/master/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp

Based on the code. It maybe weeks of work and occasionally requires maintenance if it's rewritten. Or we can implement that, take the part we need only for these two devices but John would have to check if it's possible.

So it might be best to just do the downgrade on all the fire tv devices.

@johnneerdael - let me know if your research turns up something similar. For now we can just use that new helper code

Update:

This code update would at least attempt the full lossless on these two devices and if failed then downgrade. So if Amazon updates something with it in the future it will adapt.

I came up with this.


// 1. Device helper update 
private boolean isFireTvLimitedDtsDevice() {
    return "Amazon".equalsIgnoreCase(Build.MANUFACTURER)
            && Build.MODEL.startsWith("AFT");
}

// 2. Check for the two fire tv models for full lossless
private boolean isFireTvFullLosslessCapable() {
    String model = Build.MODEL;
    return model.equals("AFTGAZL") || model.equals("AFTKRT");  // Cube 3 and 4K Max 2nd Gen
}

Main code part


// 3. place in preparation / track selector (right before building MediaItem or passing to ExoPlayer)
boolean useFullLossless = Settings.getBoolean("experimental_full_dts_hd", false);  // new toggle

if (isFireTvLimitedDtsDevice()
        && format.sampleMimeType != null
        && (MimeTypes.AUDIO_DTS_HD.equals(format.sampleMimeType)
            || format.sampleMimeType.contains("dts") && hasDtsHdExtension(format))) {

    if (useFullLossless && isFireTvFullLosslessCapable()) {
        // Experimental: try full lossless
        // Log.d("NuvioTV", "Trying full lossless DTS-HD on Fire TV (experimental)");
    } else {
        // Default reliable path
        format = format.buildUpon()
                .setSampleMimeType(MimeTypes.AUDIO_DTS)
                .setChannelCount(6)
                .build();
        // Log.d("NuvioTV", "Downgraded to 5.1 core DTS for Fire TV");
    }
}

@ram130
Copy link

ram130 commented Mar 5, 2026

@ram130 I don't really understand why the dev specs of the Cube 3 says that it's only DTS-HD basic profile and not full lossless, as again, Kodi plays DTS:X 7.1 well on my Cube 3, and that's a lossless format. I know Kodi found their own fix for that, to make it play lossless.

Ok I figured it out. They did a custom work around and rebranded it Kodi IEC packer.
image

They have their own custom “Kodi IEC packer” written in native C++ inside AESinkAUDIOTRACK.cpp.

See this https://github.com/xbmc/xbmc/blob/master/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp

Based on the code. It maybe weeks of work and occasionally requires maintenance if it's rewritten. Or we can implement that, take the part we need only for these two devices but John would have to check if it's possible.

So it might be best to just do the downgrade on all the fire tv devices.

@johnneerdael - let me know if your research turns up something similar. For now we can just use that new helper code

Update:

This code update would at least attempt the full lossless on these two devices and if failed then downgrade. So if Amazon updates something with it in the future it will adapt.

I came up with this.


// 1. Device helper update 
private boolean isFireTvLimitedDtsDevice() {
    return "Amazon".equalsIgnoreCase(Build.MANUFACTURER)
            && Build.MODEL.startsWith("AFT");
}

// 2. Check for the two fire tv models for full lossless
private boolean isFireTvFullLosslessCapable() {
    String model = Build.MODEL;
    return model.equals("AFTGAZL") || model.equals("AFTKRT");  // Cube 3 and 4K Max 2nd Gen
}

Main code part


// 3. place in preparation / track selector (right before building MediaItem or passing to ExoPlayer)
boolean useFullLossless = Settings.getBoolean("experimental_full_dts_hd", false);  // new toggle

if (isFireTvLimitedDtsDevice()
        && format.sampleMimeType != null
        && (MimeTypes.AUDIO_DTS_HD.equals(format.sampleMimeType)
            || format.sampleMimeType.contains("dts") && hasDtsHdExtension(format))) {

    if (useFullLossless && isFireTvFullLosslessCapable()) {
        // Experimental: try full lossless
        // Log.d("NuvioTV", "Trying full lossless DTS-HD on Fire TV (experimental)");
    } else {
        // Default reliable path
        format = format.buildUpon()
                .setSampleMimeType(MimeTypes.AUDIO_DTS)
                .setChannelCount(6)
                .build();
        // Log.d("NuvioTV", "Downgraded to 5.1 core DTS for Fire TV");
    }
}

Also if this doesn't work after we test. We will keep the previous main code as is and just update helper to allow fire tv devices to access this method.

I'll update once I see the updated build. Current seems to be missing the toggle. So some users I'm with testing also can't test the feature.

@johnneerdael
Copy link
Contributor Author

johnneerdael commented Mar 6, 2026

@DHARMAHydra @ram130 : For now this build should be sufficient to test the original suggested fix (downgrade). app-release-universal.apk if using the Downloader app you can also enter shortcode: 8330444

I will merge the fixes in here if confirmed working, this release build is actually a full blow fork of NuvioTV that I call NEXIO and I've been working on the past 2 days. This has major differences over NuvioTV to align with what I want in a media streamer. This is not intended to replace NuvioTV, but be a major change that aligns more with my personal vision for a Media Streamer. You can check out the configuration portal here: nexioapp.org or the GitHub release: @johnneerdael/nexio/releases/tag/v0.10

These features are removed:

  • Trailer playback
  • Profiles
  • On account tracking of watch items (I prefer Trakt and don't need a duplicate implementation introducing bloat)
  • Support for parental controls
  • Network buffer controls (moved to media3 default tuned values)

New Features:

  • Full blown Trakt integration, includes User Lists as catalogs (plus Popular Lists from other users), and off course continue watching, scribble and checkin.
  • Extensive MDBList integration, besides the existing features this adds support for personal MDBLists and allows you to add Top Lists from the UI.
  • Trakt/MDBLists become Custom Catalogs, Catalogs are fully controllable from the new Catalogs menu, includes options for Disabling the Cinemeta Catalogs and full reordering control.
  • Add support for Poster Ratings through RPDB and TOPPosters.
  • Has a broad web-based configuration page that allows you to manage all configuration settings that are not device dependent (Including API keys configuration, Catalog Ordening, etc...) nexioapp.org
  • All settings are synced bidirectional between web and app, if you setup on web. Logging in on device pushes all settings to app, changes made on app are instantly pushed to web.
  • Any sensitive information (Base64 API keys in Stremio Addons, API keys, Trakt Authentication) is moved out of the public sync payload and stored in a Supabase vault for security of your credentials (I don't see any focus on this from any other add-on provider like Stremio/Nuvio), without this your paid API keys are basically up for grabs... Sensitive information can only be fetched from vault for your personal details with your account, web version also hides all secret information.
  • Disk Cache and Parallel Downloading (VOD Cache - aka Disk Cache in now off/on toggle).
  • 60HZ patch suggested by @ram130 for interface.
Screenshot 2026-03-06 at 10 42 07 Screenshot 2026-03-06 at 10 43 16 Screenshot 2026-03-06 at 10 47 37

@johnneerdael
Copy link
Contributor Author

@ram130 @DHARMAHydra: Can you also test this version, this includes both the IEC and MAT packer (support for DTS-HD MA 7.1/5.1 DTS:X and TrueHD without downgrading). dts-release-universal.apk or Downloader code: 2023527

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.

DTS audio tracks not playing on Fire Cube 3

3 participants