Skip to content

Conversation

mariotaku
Copy link
Contributor

@mariotaku mariotaku commented Sep 16, 2025

Description

When host has no audio playing, Sunshine won't send audio. For webOS client, when surround sound is used, video will freeze when there is no audio coming in.

This PR allows the host to send empty audio frame in such case, mitigating webOS freezing issue.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@ReenigneArcher ReenigneArcher changed the title Continuous Audio Feature fix(audio): allow sending continuous audio Sep 16, 2025
@ReenigneArcher ReenigneArcher changed the title fix(audio): allow sending continuous audio feat(audio): allow sending continuous audio Sep 16, 2025
@mariotaku mariotaku force-pushed the feature/continuous-audio branch 2 times, most recently from feaddf3 to adcbfd4 Compare October 10, 2025 14:19
@mariotaku mariotaku marked this pull request as ready for review October 10, 2025 14:20
@andygrundman
Copy link
Contributor

andygrundman commented Oct 11, 2025

LGTM, nice and simple, and seems fine as a hidden setting. I guess the only downside is that the audio stream is CBR so all those zeroes still consume 512k/1.5Mb/2Mb.

Copy link

codecov bot commented Oct 11, 2025

Bundle Report

Bundle size has no change ✅

@ReenigneArcher
Copy link
Member

seems fine as a hidden setting.

I believe this a setting that comes from the client itself, right?

Copy link

codecov bot commented Oct 11, 2025

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.97%. Comparing base (246d8f1) to head (e3069d9).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/platform/windows/audio.cpp 0.00% 8 Missing ⚠️
src/audio.cpp 0.00% 3 Missing ⚠️
src/rtsp.cpp 0.00% 3 Missing ⚠️
src/nvhttp.cpp 0.00% 1 Missing ⚠️
src/platform/linux/audio.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4261      +/-   ##
==========================================
- Coverage   11.98%   11.97%   -0.01%     
==========================================
  Files          87       87              
  Lines       17572    17581       +9     
  Branches     8076     8082       +6     
==========================================
  Hits         2106     2106              
- Misses      14569    14578       +9     
  Partials      897      897              
Flag Coverage Δ
Linux-AppImage 11.48% <0.00%> (-0.01%) ⬇️
Windows-AMD64 13.25% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/audio.h 100.00% <ø> (ø)
src/platform/common.h 24.13% <ø> (ø)
src/nvhttp.cpp 18.07% <0.00%> (-0.03%) ⬇️
src/platform/linux/audio.cpp 10.63% <0.00%> (ø)
src/audio.cpp 22.05% <0.00%> (-0.17%) ⬇️
src/rtsp.cpp 1.04% <0.00%> (-0.01%) ⬇️
src/platform/windows/audio.cpp 25.13% <0.00%> (-0.19%) ⬇️

@mariotaku
Copy link
Contributor Author

@ReenigneArcher Yes. Only when the client requests continuousAudio=1 via launch request, Sunshine will feed empty audio frame when it's not able to capture one.

@ReenigneArcher ReenigneArcher force-pushed the feature/continuous-audio branch from e4b43d3 to e3069d9 Compare October 11, 2025 20:12
Copy link

@ReenigneArcher ReenigneArcher merged commit fbcf211 into LizardByte:master Oct 11, 2025
47 of 48 checks passed
@ns6089
Copy link
Contributor

ns6089 commented Oct 13, 2025

It's simple because it has an inherent buffer underrun - buffer is only filled when WaitForSingleObjectEx() times out and this function always overshoots. But it it fixes your issue...

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.

4 participants