Skip to content

Display and control your Android device

Fix H.265 hardware decoding on Windows

Romain Vimontf6dce15c3671
diff --git a/app/src/hwdec.c b/app/src/hwdec.c
index f34e92d9..edbdbe64 100644
--- a/app/src/hwdec.c
+++ b/app/src/hwdec.c
@@ -200,9 +200,13 @@ sc_hwdec_configure(struct sc_hwdec *hwdec, AVCodecContext *ctx) {
return false;
}
- // Some backends do not expose plain Baseline (only Constrained Baseline).
- // Hardware supporting Main/High can still decode Baseline.
- ctx->hwaccel_flags |= AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH;
+ if (ctx->codec_id == AV_CODEC_ID_H264) {
+ // Some backends do not expose plain Baseline (only Constrained
+ // Baseline). Hardware supporting Main/High can still decode Baseline.
+ // Do not set it for other codecs: for H.265, FFmpeg would select the
+ // Main10 D3D11VA decoder for a Main stream.
+ ctx->hwaccel_flags |= AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH;
+ }
if (hwdec->hw_forced) {
// By default, FFmpeg falls back to a software format if the hardware