[PR #260] [CLOSED] Fix missing video_producer_buffer_caps field in API schema and handlers #397

Closed
opened 2026-10-15 13:00:16 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/wolf/pull/260
Author: @lukemarsden
Created: 9/27/2025
Status: ❌ Closed

Base: stable ← Head: fix/api-video-producer-buffer-caps


📝 Commits (1)

  • cf7b37d Fix missing video_producer_buffer_caps field in API schema and handlers

📊 Changes

2 files changed (+26 additions, -16 deletions)

View changed files

📝 src/moonlight-server/api/endpoints.cpp (+12 -8)
📝 src/moonlight-server/events/reflectors.hpp (+14 -8)

📄 Description

Problem

API-created apps generate malformed GStreamer video producer pipelines due to missing
video_producer_buffer_caps field in the API, while TOML-loaded apps work correctly.

Malformed pipeline example:
waylanddisplaysrc render_node=/dev/dri/renderD128 ! , width=3840, height=2160
(Note the stray comma from empty buffer_format parameter)

Root Cause

The API was missing video_producer_buffer_caps field in three critical places:

  1. API Schema (reflectors.hpp): ReflType struct missing field
  2. Response Serialization (reflectors.hpp): from() method omitting field
  3. Request Deserialization (endpoints.cpp): endpoint_AddApp not populating field

Solution

1. Make API Schema Match TOML Flexibility (reflectors.hpp)

  • Add missing field: std::optional<std::string> video_producer_buffer_caps
  • Make all fields optional: Changed required fields to std::optional<> to match
    TOML config behavior
    • support_hdr: bool → std::optional<bool>
    • h264/hevc/av1_gst_pipeline: string → std::optional<string>
    • render_node: string → std::optional<string>
    • opus_gst_pipeline: string → std::optional<string>
    • start_virtual_compositor: bool → std::optional<bool>
    • start_audio_server: bool → std::optional<bool>
  • Add field to serialization: Include video_producer_buffer_caps in from()
    method

2. Add Comprehensive Defaults (endpoints.cpp)

  • video_producer_buffer_caps: "video/x-raw(memory:DMABuf)" (NVIDIA GPU
    zero-copy)
  • support_hdr: false
  • h264_gst_pipeline: Full NVIDIA pipeline with nvh264enc
  • hevc/av1_gst_pipeline: "" (empty when not available, matches TOML)
  • render_node: "/dev/dri/renderD128"
  • opus_gst_pipeline: Full audio pipeline with opusenc
  • start_virtual_compositor: true
  • start_audio_server: true

Benefits

  • Fixes streaming: API-created apps now generate proper GStreamer pipelines
  • TOML compatibility: API behavior now matches TOML config defaults
  • Backwards compatible: Missing fields get sensible defaults
  • GPU optimized: Uses DMABuf for zero-copy performance on NVIDIA
  • Robust: Comprehensive defaults prevent malformed configurations

Testing

  • ✅ TOML apps: Continue working as before
  • ✅ API apps: Now generate proper pipelines and stream successfully
  • ✅ Minimal requests: Work with comprehensive defaults
  • ✅ Full requests: Explicit values override defaults correctly

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/games-on-whales/wolf/pull/260 **Author:** [@lukemarsden](https://github.com/lukemarsden) **Created:** 9/27/2025 **Status:** ❌ Closed **Base:** `stable` ← **Head:** `fix/api-video-producer-buffer-caps` --- ### 📝 Commits (1) - [`cf7b37d`](https://github.com/games-on-whales/wolf/commit/cf7b37d2a3ec230a53a6e4bb65716f590d0eecc2) Fix missing video_producer_buffer_caps field in API schema and handlers ### 📊 Changes **2 files changed** (+26 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/moonlight-server/api/endpoints.cpp` (+12 -8) 📝 `src/moonlight-server/events/reflectors.hpp` (+14 -8) </details> ### 📄 Description ### Problem API-created apps generate malformed GStreamer video producer pipelines due to missing `video_producer_buffer_caps` field in the API, while TOML-loaded apps work correctly. **Malformed pipeline example:** waylanddisplaysrc render_node=/dev/dri/renderD128 ! , width=3840, height=2160 (Note the stray comma from empty buffer_format parameter) ### Root Cause The API was missing `video_producer_buffer_caps` field in three critical places: 1. **API Schema** (reflectors.hpp): ReflType struct missing field 2. **Response Serialization** (reflectors.hpp): from() method omitting field 3. **Request Deserialization** (endpoints.cpp): endpoint_AddApp not populating field ### Solution #### 1. Make API Schema Match TOML Flexibility (reflectors.hpp) - **Add missing field**: `std::optional<std::string> video_producer_buffer_caps` - **Make all fields optional**: Changed required fields to `std::optional<>` to match TOML config behavior - `support_hdr`: `bool` → `std::optional<bool>` - `h264/hevc/av1_gst_pipeline`: `string` → `std::optional<string>` - `render_node`: `string` → `std::optional<string>` - `opus_gst_pipeline`: `string` → `std::optional<string>` - `start_virtual_compositor`: `bool` → `std::optional<bool>` - `start_audio_server`: `bool` → `std::optional<bool>` - **Add field to serialization**: Include `video_producer_buffer_caps` in from() method #### 2. Add Comprehensive Defaults (endpoints.cpp) - **video_producer_buffer_caps**: `"video/x-raw(memory:DMABuf)"` (NVIDIA GPU zero-copy) - **support_hdr**: `false` - **h264_gst_pipeline**: Full NVIDIA pipeline with nvh264enc - **hevc/av1_gst_pipeline**: `""` (empty when not available, matches TOML) - **render_node**: `"/dev/dri/renderD128"` - **opus_gst_pipeline**: Full audio pipeline with opusenc - **start_virtual_compositor**: `true` - **start_audio_server**: `true` ### Benefits - **Fixes streaming**: API-created apps now generate proper GStreamer pipelines - **TOML compatibility**: API behavior now matches TOML config defaults - **Backwards compatible**: Missing fields get sensible defaults - **GPU optimized**: Uses DMABuf for zero-copy performance on NVIDIA - **Robust**: Comprehensive defaults prevent malformed configurations ### Testing - ✅ TOML apps: Continue working as before - ✅ API apps: Now generate proper pipelines and stream successfully - ✅ Minimal requests: Work with comprehensive defaults - ✅ Full requests: Explicit values override defaults correctly --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 13:00:16 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/wolf#397
No description provided.