Skip to content

Conversation

@PacificSilent
Copy link

Force GPU Composition for Android TV + Mini Performance Overlay

Summary

This PR adds two features to improve the Android TV experience:

  1. Force GPU Composition: Option to force GPU composition and fix stuttering/frame drop issues
  2. Mini Performance Overlay: Ultra-compact performance metrics display mode

Force GPU Composition

Problem it solves

On Android TV, some devices experience frame synchronization issues that cause:

  • Stuttering during streaming
  • Frame drops
  • Inconsistent video playback

Solution

Adds an invisible TextView that forces Android to use GPU composition instead of hardware overlays, improving frame synchronization.

Implementation:

  • Invisible TextView (1sp) in activity_game.xml
  • Controlled by user preference
  • Completely transparent, doesn't affect gameplay

When to enable:

  • ✅ If experiencing stuttering or frame drops on Android TV
  • ✅ If video doesn't play smoothly
  • ❌ If streaming already works well

Modified files

  • app/src/main/res/layout/activity_game.xml - Invisible TextView
  • app/src/main/java/com/limelight/Game.java - Visibility control
  • app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java - Config
  • app/src/main/res/xml/preferences.xml - UI settings
  • app/src/main/res/values/strings.xml - Strings

Mini Performance Overlay

Features

  • Ultra-compact overlay (8sp) with essential metrics
  • Format: BW: 109M/s PL: 0% Net: 7ms | Dec: 109ms XX.XX FPS
  • Mutual exclusion with "Lite" mode (only one can be active)

Displayed metrics

  • BW: Bandwidth
  • PL: Packet Loss
  • Net: Network latency
  • Dec: Decode time
  • FPS: Frames per second

Modified files

  • app/src/main/res/layout/activity_game.xml - Overlay TextView
  • app/src/main/java/com/limelight/Game.java - Metrics update
  • app/src/main/java/com/limelight/binding/video/MediaCodecDecoderRenderer.java - FPS tracking
  • app/src/main/java/com/limelight/preferences/StreamSettings.java - Mutual exclusion
  • app/src/main/res/xml/preferences.xml - UI settings
  • app/src/main/res/values/strings.xml - Strings

Technical Changes

MediaCodecDecoderRenderer.java

  • FPS tracking with updates every second
  • Performance metrics for mini overlay

Game.java

  • GPU composition TextView visibility management
  • Real-time mini overlay updates

StreamSettings.java

  • Mutual exclusion logic between Lite and Mini overlays

Testing

Force GPU Composition:

  • Test on Android TV with/without option enabled
  • Verify stuttering improvement
  • Confirm no performance impact

Mini Overlay:

  • Verify correct metrics updates
  • Confirm mutual exclusion with Lite mode
  • Validate readability

Compatibility

✅ Android TV (main beneficiary)
✅ Standard Android devices
✅ Backward compatible

IMG_4865

@ClassicOldSong
Copy link
Owner

Thank you for the contribution, but this might not be needed when a bug in frame timing is fixed.

I'll leave this PR open for now in case it doesn't fix the problem.

@farnsworth3010
Copy link

I am still seeing unplayable stutters on mi TV Stick 4k gen 2 on the latest release and the latest beta. Toggling the overlay makes it butter smooth

@farnsworth3010
Copy link

Tried building your branch, now it works very well (2k 60fps with no stutters). Thank you! This little fix should definitely be merged.

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.

3 participants