mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
Xbox Cloud Gaming: stream from the store and Games tab, native player with DroidDeck frame generation Stream Xbox games with Xbox Cloud Gaming (Game Pass) from DroidDeck, outside the Linux session. - Backend: `xodus-cli cloud-token` (tools/xbox/droiddeck-cloud-token.patch) gets the streaming tokens; they stay in memory. - Web player (default): the Greenlight player page (tools/xcloud-player, MIT) in a WebView, plus Microsoft's own xbox.com/play player. In-stream menu with screen effects (sharpen, colour, deband, FXAA, CRT, NTSC, Toon, fps cap), stream quality, performance overlay (level, layout, top right / top left) and rumble. - Native player (opt-in, Android 10+, Player engine: Native): Google's WebRTC (io.github.webrtc-sdk 125.6422.07, BSD) with the Greenlight protocol ported to Kotlin, in its own process (:xcloudnative) with its own instance of DroidDeck's compositor. Decoded frames reach the compositor as AHardwareBuffers (new stream mode, VK_ANDROID_external_memory_android_ hardware_buffer import), so DDFG 2x and LSFG 2x/3x/4x run on them. Live frame generation, frame-rate target (presets and a 10-165 fps slider, even pacing), zero-copy picture, small network buffer, fast decoder, instant controller input, overlay with engine and on-screen fps, background end, restart and web fallback. It takes the main process's tokens through XboxCloudTokenService; they are fetched ahead while a cloud game is shown. - The compositor requests the dma-buf import extensions only where the driver has them (the system driver has none). - Catalog: cloud availability, Game Pass plan CFQ7TTC0K6L8 counted, library filter All / Owned / Game Pass / Cloud, Stream and Add to Games on the store page, stream-only Games-tab entries (Stream + Download / Play + Stream). - Xbox games get VC++ 2015-2022 and the ARM64 runtime registry entries (vcredist2022_arm64, built in until the catalog has it) before each launch. - Controller focus reaches pickers opened from a game page (install location, uninstall); Add / Remove from Games keep the focus. Credits: Greenlight by UnknownSKL (Jim Kroon), MIT, player and protocol; Better xCloud for the resolution / OS mapping; MGamer404's Bannerlator #627 for the ARM64 runtime approach. Ported from the412banner's Bannerlator.
35 lines
1.6 KiB
TypeScript
35 lines
1.6 KiB
TypeScript
// Offer tweaks after Better xCloud by redphx (MIT, src/utils/sdp.ts): prefer an H.264 profile, cap bitrate.
|
|
|
|
/** Moves the H.264 payloads of the chosen profile to the front of the video m-line. */
|
|
export function preferH264Profile(sdp: string, profile: 'high' | 'normal' | 'low'): string {
|
|
const prefix = profile === 'high' ? '4d' : (profile === 'low' ? '420' : '42e')
|
|
const preferred: string[] = []
|
|
for (const match of sdp.matchAll(/a=fmtp:(\d+).*profile-level-id=([0-9a-f]{6})/g)) {
|
|
if (match[2].startsWith(prefix)) preferred.push(match[1])
|
|
}
|
|
if (preferred.length === 0) return sdp
|
|
const lines = sdp.split('\r\n')
|
|
const index = lines.findIndex(line => line.startsWith('m=video'))
|
|
if (index < 0) return sdp
|
|
const parts = lines[index].trim().split(' ')
|
|
const ids = parts.slice(3).filter(id => !preferred.includes(id))
|
|
lines[index] = parts.slice(0, 3).concat(preferred, ids).join(' ')
|
|
return lines.join('\r\n')
|
|
}
|
|
|
|
/** Sets b=AS (kbit/s) on the video m-section. */
|
|
export function capVideoBitrate(sdp: string, kbps: number): string {
|
|
const lines = sdp.split('\r\n')
|
|
const start = lines.findIndex(line => line.startsWith('m=video'))
|
|
if (start < 0) return sdp
|
|
const bLine = `b=AS:${kbps}`
|
|
for (let i = start + 1; i <= lines.length; i++) {
|
|
const line = lines[i]
|
|
if (line === undefined || line.startsWith('m=')) { lines.splice(i, 0, bLine); break }
|
|
if (line.startsWith('i=') || line.startsWith('c=')) continue
|
|
if (line.startsWith('b=AS:')) { lines[i] = bLine; break }
|
|
lines.splice(i, 0, bLine); break
|
|
}
|
|
return lines.join('\r\n')
|
|
}
|