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

Rewrite MediaCodecCapabilitiesTest in Kotlin #2015

Merged

Conversation

nielsvanvelzen
Copy link
Member

Changes

  • Rewrite MediaCodecCapabilitiesTest in Kotlin
  • Merge MediaUtils into MediaCodecCapabilitiesTest

Issues

@nielsvanvelzen nielsvanvelzen added the refactor Improvements to code realiability, readability and quality label Aug 27, 2022
@nielsvanvelzen nielsvanvelzen added this to the v0.15.0 milestone Aug 27, 2022
CodecProfileLevel.AVCLevel4
)

private fun hasDecoder(mime: String, profile: Int, level: Int): Boolean {

Check notice

Code scanning

Excessive nesting leads to hidden complexity. Prefer extracting code to make it easier to understand.

Function hasDecoder is nested too deeply.
// H.263 levels are not completely ordered:
// Level45 support only implies Level10 support
if (mime.equals(MediaFormat.MIMETYPE_VIDEO_H263, ignoreCase = true)) {
if (profileLevel.level != level && profileLevel.level == CodecProfileLevel.H263Level45 && level > CodecProfileLevel.H263Level10) {

Check notice

Code scanning

Line detected, which is longer than the defined maximum line length in the code style.

Line detected, which is longer than the defined maximum line length in the code style.
Comment on lines +31 to +43
for (profileLevel in capabilities.profileLevels) {
if (profileLevel.profile != profile) continue

// H.263 levels are not completely ordered:
// Level45 support only implies Level10 support
if (mime.equals(MediaFormat.MIMETYPE_VIDEO_H263, ignoreCase = true)) {
if (profileLevel.level != level && profileLevel.level == CodecProfileLevel.H263Level45 && level > CodecProfileLevel.H263Level10) {
continue
}
}

if (profileLevel.level >= level) return true
}

Check notice

Code scanning

The loop contains more than one break or continue statement. The code should be refactored to increase readability.

The loop contains more than one break or continue statement. The code should be refactored to increase readability.
@jellyfin-bot jellyfin-bot added the merge conflict Conflicts prevent merging label Aug 27, 2022
@nielsvanvelzen nielsvanvelzen force-pushed the media-codec-capabilities-test-kt branch from a361051 to e9bba78 Compare August 27, 2022 19:45
@jellyfin-bot jellyfin-bot removed the merge conflict Conflicts prevent merging label Aug 27, 2022
@nielsvanvelzen nielsvanvelzen merged commit c7e2789 into jellyfin:master Aug 27, 2022
@nielsvanvelzen nielsvanvelzen deleted the media-codec-capabilities-test-kt branch August 27, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Improvements to code realiability, readability and quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants