Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

feat(display)!: Add libdisplaydevice dependency and output name mapping

Open FrogTheFrog opened this issue 1 year ago • 3 comments

Description

This is one of the first PRs related to https://github.com/LizardByte/Sunshine/pull/2582. The code has been moved to the https://github.com/LizardByte/libdisplaydevice repo and will be coming to Sunshine little by little.

In this PR libdisplaydevice has been added as a submodule and a new singleton class with a new map_output_name method has been added. For Windows the map_output_name now maps a device id to its corresponding display name, while on other platforms it simply performs a pass-trough. On WIndows, in case the corresponding device has no display name at the moment (either inactive or the id is just wrong), it will return an empty string and the default display would be used as a result (you would still be able to start the stream).

Unfortunately, the method cannot be called just once when the config is loaded to remap the output_name immediately, since on Windows there is no guarantee that the display name will remain the same for the display (even without restarting the PC).

The display name is tied to a topology of active displays, whose settings are cached by the OS. When Windows encounters a completely new topology of active displays, it will generate the "best" settings to be used as a base. The new base is not guaranteed to have the same display names as the other cached topology. Now, by simply turning off/on any of the displays, the active topology will change and so can the display name. This is at least one of the factors why the display name seems random and unpredictable.

Screenshot

Some changes have been made in the UI to show how to configure the output name on Windows. image

Type of Change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [x] Dependency update (updates to dependencies)
  • [x] Documentation update (changes to documentation)
  • [ ] Repository update (changes to repository files, e.g. .github/...)

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch must be updated before it can be merged. You must also Allow edits from maintainers.

  • [ ] I want maintainers to keep my branch updated

FrogTheFrog avatar Jul 19 '24 08:07 FrogTheFrog

Codecov Report

Attention: Patch coverage is 22.58065% with 48 lines in your changes missing coverage. Please review.

Project coverage is 11.16%. Comparing base (0cc98f1) to head (7293c10). Report is 97 commits behind head on master.

Files with missing lines Patch % Lines
src/display_device.cpp 13.04% 16 Missing and 4 partials :warning:
src/logging.cpp 28.57% 14 Missing and 6 partials :warning:
src/video.cpp 37.50% 3 Missing and 2 partials :warning:
src/platform/windows/display_base.cpp 0.00% 2 Missing :warning:
src/platform/macos/input.cpp 0.00% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2894      +/-   ##
==========================================
+ Coverage   11.12%   11.16%   +0.03%     
==========================================
  Files          99      100       +1     
  Lines       17253    17310      +57     
  Branches     8045     8069      +24     
==========================================
+ Hits         1920     1933      +13     
- Misses      12779    12812      +33     
- Partials     2554     2565      +11     
Flag Coverage Δ
Linux 8.43% <24.48%> (+0.05%) :arrow_up:
Windows 5.38% <20.33%> (+0.06%) :arrow_up:
macOS-13 13.72% <22.91%> (+0.08%) :arrow_up:
macOS-14 12.72% <22.91%> (+0.08%) :arrow_up:

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

Files with missing lines Coverage Δ
src/logging.h 32.35% <ø> (ø)
src/platform/macos/input.cpp 40.86% <0.00%> (-0.23%) :arrow_down:
src/platform/windows/display_base.cpp 13.46% <0.00%> (-0.03%) :arrow_down:
src/video.cpp 30.00% <37.50%> (+0.04%) :arrow_up:
src/display_device.cpp 13.04% <13.04%> (ø)
src/logging.cpp 60.71% <28.57%> (-7.43%) :arrow_down:
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jul 19 '24 08:07 codecov[bot]

For docs errors you can go here: https://app.readthedocs.org/projects/sunshinestream/builds/25123499/

And look for error:

Edit: that's my mistake. The docs are wrong... it's @examples_end

ReenigneArcher avatar Jul 26 '24 13:07 ReenigneArcher

Quality Gate Failed Quality Gate failed

Failed conditions
7 New issues
7 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

sonarqubecloud[bot] avatar Dec 11 '24 18:12 sonarqubecloud[bot]