Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to report device profile to server for troubleshooting #4482

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

nielsvanvelzen
Copy link
Member

@nielsvanvelzen nielsvanvelzen commented Feb 25, 2025

Troubleshooting playback issues is extremely difficult because the app doesn't give much insight into what is happening. Even with logging enabled, it can be difficult to figure out why something transcodes or produces a black screen.

This change should somewhat improve that situation by adding a new troubleshooting feature directly inside of the app. At the very least it will be extremely useful to test improvements to the device profile.

Changes

  • Add new "createDeviceProfileReport" function that creates a (markdown) report about the device profile and the data used to construct it
    • Includes the full device profile as JSON, the same one that would be reported on playback
    • Includes information about the device capabilities (MediaCodecList)
      • Could be extended some more in the future as some information is still missing
    • Includes basic app/device info
  • Add new "troubleshooting" category to advanced playback preferences with a button to upload a device profile report to the Jellyfin server. Requires the logging feature.
  • Extract markdown building code from TelemetryService to new "MarkdownBuilder"
    • Note that this is a really rough string builder and doesn't produce the prettiest markdown, but it is good enough for our uses
    • Output from crash reports slightly changed (new lines in different places)
  • Add new createDeviceProfile function that reads user preferences instead of passing them from the usage side
  • Remove unused functions from Utils class

Example
https://gist.github.com/nielsvanvelzen/cba33b29c1dfc82350735fd5f0190abd

Issues

@nielsvanvelzen nielsvanvelzen added the enhancement New feature or request label Feb 25, 2025
if (maxBitrate == null || maxBitrate < 1) maxBitrate = UserPreferences.maxBitrate.defaultValue.toInt()

// Convert megabit to bit
return maxBitrate * 1_000_000

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
private val prettyPrintJson = Json { prettyPrint = true }
private fun formatJson(json: String) = prettyPrintJson.encodeToString(prettyPrintJson.parseToJsonElement(json))

fun createDeviceProfileReport(

Check warning

Code scanning / detekt

One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand. Warning

The function createDeviceProfileReport is too long (77). The maximum length is 60.
private val prettyPrintJson = Json { prettyPrint = true }
private fun formatJson(json: String) = prettyPrintJson.encodeToString(prettyPrintJson.parseToJsonElement(json))

fun createDeviceProfileReport(

Check warning

Code scanning / detekt

Prefer splitting up complex methods into smaller, easier to test methods. Warning

The function createDeviceProfileReport appears to be too complex based on Cyclomatic Complexity (complexity: 15). Defined complexity threshold for methods is set to '15'
@nielsvanvelzen nielsvanvelzen added this to the v0.19.0 milestone Feb 26, 2025
@nielsvanvelzen nielsvanvelzen marked this pull request as ready for review February 26, 2025 18:37
@nielsvanvelzen nielsvanvelzen merged commit 5ae05c1 into jellyfin:master Feb 26, 2025
6 checks passed
@nielsvanvelzen nielsvanvelzen deleted the report-profile branch February 26, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants