Skip to content

Implement MediaCodec decoder pipeline and GPU encoder backend detection#1

Merged
supermarsx merged 3 commits intomainfrom
copilot/implement-pending-crates
Mar 8, 2026
Merged

Implement MediaCodec decoder pipeline and GPU encoder backend detection#1
supermarsx merged 3 commits intomainfrom
copilot/implement-pending-crates

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 7, 2026

Wires up the two critical TODO stubs blocking the video streaming pipeline: Android-side MediaCodec decoding and PC-side hardware encoder detection.

Android MediaCodec decoder (DecoderController.kt)

  • Full MediaCodec lifecycle: init on configure/surface-set, feed frames to input buffers, drain decoded output to Surface, release on teardown
  • Thread-safe via synchronized; handles CodecException with auto-reinit on non-recoverable errors
  • Fixed H.266/VVC MIME mapping (was silently aliased to H.264)
// Before: frames were silently dropped
fun onFrame(data: ByteArray) {
    if (data.isEmpty()) return
    // TODO: feed MediaCodec once decoder pipeline is wired.
}

// After: full decode + render pipeline
fun onFrame(data: ByteArray) {
    if (data.isEmpty()) return
    synchronized(lock) { feedDecoder(data) }
}

PC GPU encoder detection (encoder.rs)

  • Replaced hardcoded backend list with real DXGI adapter enumeration (vendor IDs: NVIDIA→NVENC, AMD→AMF, Intel→QSV)
  • Added MFTEnumEx probe for Media Foundation H.264 encoder availability
  • Added codec_priority() and discover_capabilities() for spec-compliant codec selection (H.265→AV1→H.264→VP9)

Android codec capability discovery (CodecCapabilities.kt)

  • Refactored to data-driven MIME→mask mapping; added EVC/LCEVC decoder probing

Tests

  • 9 Kotlin unit tests for MIME mapping and decoder status
  • 7 Rust tests for backend detection, priority ordering, and capability discovery

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.2.1-bin/5hap6b9n41hkg4jeh2au2pllh/gradle-8.2.1/lib/gradle-launcher-8.2.1.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.2.1-bin/5hap6b9n41hkg4jeh2au2pllh/gradle-8.2.1/lib/agents/gradle-instrumentation-agent-8.2.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon (dns block)
    • Triggering command: /usr/bin/curl curl -s -o /dev/null -w %{http_code} REDACTED de/node/bin/grep (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 8, 2026 00:15
Co-authored-by: supermarsx <17675589+supermarsx@users.noreply.github.com>
Co-authored-by: supermarsx <17675589+supermarsx@users.noreply.github.com>
Copilot AI changed the title [WIP] Add pending implementations for crates Implement MediaCodec decoder pipeline and GPU encoder backend detection Mar 8, 2026
@supermarsx supermarsx marked this pull request as ready for review March 8, 2026 00:33
@supermarsx supermarsx merged commit 6d6dbdd into main Mar 8, 2026
1 check failed
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.

2 participants