rustdesk/rustdesk · error

not texture frame

Error message

not texture frame

What it means

The counterpart of [94]: `EncodeInput::texture()` (libs/scrap/src/common/mod.rs:225) only succeeds for Self::Texture and bails with `not texture frame` when the input wraps a plain YUV pixel buffer. Callers that need a GPU texture handle (ptr, size) for texture-based encoding get this error if the capture backend delivered a software YUV frame.

Source

Thrown at libs/scrap/src/common/mod.rs:225

}

pub enum EncodeInput<'a> {
    YUV(&'a [u8]),
    Texture((*mut c_void, usize)),
}

impl<'a> EncodeInput<'a> {
    pub fn yuv(&self) -> ResultType<&'_ [u8]> {
        match self {
            Self::YUV(f) => Ok(f),
            _ => bail!("not pixelfbuffer frame"),
        }
    }

    pub fn texture(&self) -> ResultType<(*mut c_void, usize)> {
        match self {
            Self::Texture(f) => Ok(*f),
            _ => bail!("not texture frame"),
        }
    }
}

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Pixfmt {
    BGRA,
    RGBA,
    RGB565LE,
    I420,
    NV12,
    I444,
}

impl Pixfmt {
    pub fn bpp(&self) -> usize {
        match self {
            Pixfmt::BGRA | Pixfmt::RGBA => 32,

View on GitHub (pinned to 91c9fccbb0)

Solutions

  1. Check the EncodeInput variant before calling texture(); use yuv() for YUV frames and fall back to a software encoder.
  2. Enable/verify the texture-capable capture backend (e.g. DXGI) when hardware texture encoding is required.
  3. Handle both variants in the encode loop with a match instead of assuming one frame type.

Example fix

// before
let (ptr, size) = input.texture()?;
tex_encoder.encode(ptr, size)?;
// after
if let EncodeInput::Texture(_) = input {
    let (ptr, size) = input.texture()?;
    tex_encoder.encode(ptr, size)?;
} else {
    sw_encoder.encode(input.yuv()?, ...)?;
}
Defensive patterns

Strategy: type-guard

Validate before calling

let (ptr, size) = match &input {
    EncodeInput::Texture(_) => input.texture()?,
    _ => return Err(/* use yuv() path instead */),
};

Type guard

fn is_texture_input(input: &EncodeInput) -> bool {
    matches!(input, EncodeInput::Texture(_))
}

Try / catch

match input.texture() {
    Ok((ptr, size)) => hw_encoder.encode(ptr, size)?,
    Err(_) => sw_encoder.encode(input.yuv()?)?,
}

Prevention

When it happens

Trigger: Calling `.texture()` on an EncodeInput::YUV — e.g. a texture/hardware encoder fed by a capture path that returned software frames (Wayland/X11 software capture, or GPU capture disabled), so there is no texture handle to pass to the encoder.

Common situations: Hardware (GPU) encoding configured on a system where capture produced a CPU pixel buffer; capture backend fallback silently switching from texture to YUV output; calling the wrong accessor for the frame type.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10). Data as JSON: /api/errors/b687aaa49d87721e. Report an issue: GitHub.