-
Notifications
You must be signed in to change notification settings - Fork 0
fix(player): restore embedded mpv playback #64
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package com.miruplay.tv.player | ||
|
|
||
| import android.app.ActivityManager | ||
| import android.content.Context | ||
| import android.content.pm.ConfigurationInfo | ||
|
|
||
| fun resolveGlEsMajorVersion(reqGlEsVersion: Int): Int = | ||
| when { | ||
| reqGlEsVersion == ConfigurationInfo.GL_ES_VERSION_UNDEFINED -> 2 | ||
| reqGlEsVersion <= 0 -> 2 | ||
| else -> reqGlEsVersion shr 16 | ||
| } | ||
|
|
||
| fun resolveDeviceGlEsMajorVersion(context: Context): Int { | ||
| val activityManager = context.getSystemService(ActivityManager::class.java) | ||
| val reqGlEsVersion = activityManager?.deviceConfigurationInfo?.reqGlEsVersion | ||
| ?: ConfigurationInfo.GL_ES_VERSION_UNDEFINED | ||
| return resolveGlEsMajorVersion(reqGlEsVersion) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ fun buildEmbeddedMpvSessionOptions( | |
| shaderPaths: List<String>, | ||
| speed: Float = 1.0f, | ||
| runtimeAbiIs32Bit: Boolean = isEmbeddedMpvRuntime32Bit(), | ||
| glEsMajorVersion: Int = 3, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 8 --glob '*.kt' \
'buildEmbeddedMpvSessionOptions\s*\(|effectiveEmbeddedMpvVideoOutput\s*\(' \
player-core player-mpv-android ui-tvRepository: ModerRAS/MiruPlay Length of output: 26245 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- all references ---'
rg -n -C 5 --hidden --glob '!build/**' --glob '!node_modules/**' \
'buildEmbeddedMpvSessionOptions|effectiveEmbeddedMpvVideoOutput|deviceGlEsMajorVersion|resolveGlEsMajorVersion' .
printf '%s\n' '--- candidate source files ---'
git ls-files | rg 'EmbeddedMpvSessionOptions|ExoPlaybackController|\.kt$|\.java$' | head -200Repository: ModerRAS/MiruPlay Length of output: 41830 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- WebControlService production call ---'
sed -n '1075,1145p' web-control/src/main/kotlin/com/miruplay/tv/webcontrol/WebControlService.kt
printf '%s\n' '--- Embedded MPV option functions ---'
sed -n '1,45p;125,145p' player-core/src/main/kotlin/com/miruplay/tv/player/EmbeddedMpvSessionOptions.kt
printf '%s\n' '--- GLES capability resolution ---'
cat -n player-core/src/main/kotlin/com/miruplay/tv/player/DeviceGlCapabilities.kt
printf '%s\n' '--- all production uses of the diagnostic value ---'
rg -n -C 4 --glob 'src/main/**/*.kt' \
'effectiveEmbeddedMpvVo|embeddedMpvVo|effectiveEmbeddedMpvVideoOutput' web-control player-core appRepository: ModerRAS/MiruPlay Length of output: 7856 Pass the resolved GLES version to 🤖 Prompt for AI Agents |
||
| debugConfig: EmbeddedMpvDebugConfig = EmbeddedMpvDebugConfig(), | ||
| audioDspConfig: AudioDspConfig = AudioDspConfig.neutral(), | ||
| ): MiruMpvSurfaceView.SessionOptions { | ||
|
|
@@ -26,6 +27,7 @@ fun buildEmbeddedMpvSessionOptions( | |
| return MiruMpvSurfaceView.SessionOptions( | ||
| vo = effectiveEmbeddedMpvVideoOutput( | ||
| runtimeAbiIs32Bit = runtimeAbiIs32Bit, | ||
| glEsMajorVersion = glEsMajorVersion, | ||
| debugConfig = debugConfig, | ||
| ), | ||
| hwdec = effectiveEmbeddedMpvHwdec(debugConfig), | ||
|
|
@@ -130,8 +132,13 @@ private fun resolveEmbeddedMpvPeakDetection(strategy: PeakDetectionStrategy): Em | |
|
|
||
| fun effectiveEmbeddedMpvVideoOutput( | ||
| runtimeAbiIs32Bit: Boolean = isEmbeddedMpvRuntime32Bit(), | ||
| glEsMajorVersion: Int = 3, | ||
| debugConfig: EmbeddedMpvDebugConfig = EmbeddedMpvDebugConfig(), | ||
| ): String = debugConfig.vo ?: if (runtimeAbiIs32Bit) "gpu-hq" else "gpu-next" | ||
| ): String = debugConfig.vo ?: when { | ||
| glEsMajorVersion < 3 -> "mediacodec_embed" | ||
| runtimeAbiIs32Bit -> "gpu-hq" | ||
| else -> "gpu-next" | ||
| } | ||
|
|
||
| fun effectiveEmbeddedMpvHwdec( | ||
| debugConfig: EmbeddedMpvDebugConfig = EmbeddedMpvDebugConfig(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: ModerRAS/MiruPlay
Length of output: 6816
🌐 Web query:
Android SDK ConfigurationInfo reqGlEsVersion "major" "minor" 16 bits GL_ES_VERSION_UNDEFINED💡 Result:
In the Android SDK, the property reqGlEsVersion represents the OpenGL ES version required by an application, using a 32-bit integer format where the upper 16 bits define the major version and the lower 16 bits define the minor version [1][2][3]. GL_ES_VERSION_UNDEFINED is a constant defined as 0, which serves as the default value for reqGlEsVersion when no specific version has been set [1][2][3]. Key details regarding this configuration include: Bitwise Representation: The value is encoded such that the major and minor versions are separated into the high and low 16-bit segments, respectively [1][3]. For example, a value of 0x00010002 corresponds to OpenGL ES version 1.2 [2][3]. You can extract these values using the getGlEsVersion method, which parses this integer into a readable "major.minor" string [1][2][3]. Usage in Manifest: Developers declare these requirements in their AndroidManifest.xml using the uses-feature element with the android:glEsVersion attribute [4][5]. If an application does not specify this attribute, the system defaults to assuming the app requires OpenGL ES 1.0, which is supported by all Android devices [4]. Context in Data Structures: This field appears in both the ConfigurationInfo and FeatureInfo classes [1][6]. In FeatureInfo, the reqGlEsVersion is only considered valid if the name field of the object is null, indicating that the feature represents an OpenGL ES version requirement [6][3].
Citations:
🏁 Script executed:
Repository: ModerRAS/MiruPlay
Length of output: 11017
Fallback to ES2 when the packed major version is zero.
ConfigurationInfo.reqGlEsVersionstores the major version in the upper 16 bits. A positive value such as0x0000FFFFcurrently resolves to0, but invalid values must fall back to ES2. Coerce a zero decoded major version to2and add this case toEmbeddedMpvSessionOptionsTest.🤖 Prompt for AI Agents