Skip to content

activeVideoDecoder reports "libavcodec HEVC (SW)" on the software path even when VideoToolbox hardware decoding is in use #753

Closed

Description

@ijuniorfu

What happened?

Summary

On the software playback path, AetherEngine.activeVideoDecoder is derived from which path was taken, not from which decoder was opened. For HEVC sources that the software host decodes with HardwareVideoDecoder (VideoToolbox), the label still says libavcodec HEVC (SW). Hosts that show this label (a "HW / SW" badge, a stats overlay) report software decoding for a stream that is hardware-decoded.

Observed

Playing an HEVC source that is served by the software host. The session log shows hardware decoding:

[SWHost] selected HardwareVideoDecoder (VT HEVC) for codec_id=173
[HardwareVideoDecoder] opened HEVC 3840x1610 10-bit transfer=16

but the published value is:

activeVideoDecoder == "libavcodec HEVC (SW)"

Expected

activeVideoDecoder names the decoder that is actually decoding, e.g. VideoToolbox HEVC (HW) for the case above.

Cause

The label comes from videoDecoderLabel(codecID:isSoftware:) (AetherEngine+Probe.swift):

  • isSoftware == false -> VideoToolbox <codec> (HW)
  • isSoftware == true, AV1 -> dav1d AV1 (SW)
  • isSoftware == true, anything else -> libavcodec <codec> (SW)

Both software-path call sites pass a constant isSoftware: true:

  • AetherEngine.swift (load): activeVideoDecoder = Self.videoDecoderLabel(codecID: detectedCodecID, isSoftware: true)
  • AetherEngine+Loading.swift (reload): activeVideoDecoder = Self.videoDecoderLabel(codecID: preservedVideoCodec, isSoftware: true)

They only know that the software host was used. The actual choice is made later, inside SoftwarePlaybackHost.load:

if codec_id == AV_CODEC_ID_HEVC,
   VTCapabilityProbe.hardwareDecodeVerdict(codecpar: codecpar).opensHardwareDecoder {
    videoDecoder = HardwareVideoDecoder()      // VideoToolbox
} else {
    videoDecoder = SoftwareVideoDecoder()      // libavcodec / dav1d
}

and that result is never reported back. So every HEVC session on the software path that VideoToolbox can decode is mislabelled. This covers any HEVC source routed to the software host, whether by a forced software path or by an escalation to it.

Proposed fix

Report the decoder the host actually selected.

  1. Expose the choice on SoftwarePlaybackHost:
/// Whether the video is decoded by VideoToolbox (`HardwareVideoDecoder`) rather than libavcodec / dav1d.
/// Decided in `load`, so only meaningful once that has returned.
var usesHardwareVideoDecoder: Bool { videoDecoder is HardwareVideoDecoder }
  1. Use it at both software-path call sites, after loadSoftware has returned:
activeVideoDecoder = Self.videoDecoderLabel(
    codecID: detectedCodecID,
    isSoftware: !(softwareHost?.usesHardwareVideoDecoder ?? false)
)

(same change for preservedVideoCodec in the reload path).

Resulting labels:

Session Label
Native path VideoToolbox HEVC (HW) (unchanged)
Software path, VT hardware decoder selected VideoToolbox HEVC (HW) (was libavcodec HEVC (SW))
Software path, libavcodec / dav1d libavcodec ... (SW) / dav1d AV1 (SW) (unchanged)

The change is 3 files, about 6 lines, and does not alter any decode or routing behaviour.

Alternative

If the (HW) / (SW) suffix is meant to stay a path indicator, expose the decoder kind separately (for example a videoDecodingIsHardware: Bool published next to activeVideoDecoder), so hosts don't have to parse the label string. Parsing the label is fragile either way, so a typed value would be the more robust API.

Notes

  • Reproduced on commit b77e24a1.
  • If the host ever swaps decoders after load, the label would need refreshing at that point. I did not find such a swap in the code I read.

Steps to reproduce

none

AetherEngine version or commit SHA

23f548c

Host app

Custom / my own integration

Platform

iOS

OS version

26

Device / chip

iPhone

Playback path

Not sure / not a playback bug

Source media (for playback bugs)

No response

Error codes / log lines


Anything else

No response

Activity

  1. added
    bug
    on Oct 12, 2026
  2. andreencar commented on Oct 13, 2026

    @andreencar
    Contributor

    I'm picking this up. I have a focused fix that reports the decoder actually selected by the software host on initial load and reload, with regression coverage. I'll open a PR shortly with the media and device validation details.

  3. superuser404notfound commented on Oct 14, 2026

    @superuser404notfound
    Owner

    Fixed by #760 (merged as d1af20f): on the software path activeVideoDecoder now names the decoder the host actually opened, so VideoToolbox HEVC reports VideoToolbox HEVC (HW) on load and reload. Thanks @ijuniorfu for the precise report and the proposed fix, which is what landed. It will be in the next AetherEngine release; if the label still looks wrong on a build that includes it, please reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions