diff --git a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp index f9a77f00..373e5525 100644 --- a/app/streaming/video/ffmpeg-renderers/d3d11va.cpp +++ b/app/streaming/video/ffmpeg-renderers/d3d11va.cpp @@ -421,8 +421,9 @@ bool D3D11VARenderer::initialize(PDECODER_PARAMETERS params) return false; } - // Surfaces must be 128 pixel aligned for HEVC and 16 pixel aligned for H.264 - m_TextureAlignment = (params->videoFormat & VIDEO_FORMAT_MASK_H265) ? 128 : 16; + // Surfaces must be 16 pixel aligned for H.264 and 128 pixel aligned for everything else + // https://github.com/FFmpeg/FFmpeg/blob/a234e5cd80224c95a205c1f3e297d8c04a1374c3/libavcodec/dxva2.c#L609-L616 + m_TextureAlignment = (params->videoFormat & VIDEO_FORMAT_MASK_H264) ? 16 : 128; if (!setupRenderingResources()) { return false; diff --git a/app/streaming/video/ffmpeg-renderers/dxva2.cpp b/app/streaming/video/ffmpeg-renderers/dxva2.cpp index 93919da2..27116519 100644 --- a/app/streaming/video/ffmpeg-renderers/dxva2.cpp +++ b/app/streaming/video/ffmpeg-renderers/dxva2.cpp @@ -784,17 +784,21 @@ bool DXVA2Renderer::initialize(PDECODER_PARAMETERS params) int alignment; - // HEVC using DXVA requires 128 pixel alignment, however Intel GPUs decoding HEVC - // using StretchRect() to render draw a translucent green line at the top of + // HEVC and AV1 using DXVA requires 128 pixel alignment, however this causes Intel GPUs + // using StretchRect() and HEVC to render draw a translucent green line at the top of // the screen in full-screen mode at 720p/1080p unless we use 32 pixel alignment. // This appears to work without issues on AMD and Nvidia GPUs too, so we will // do it unconditionally for now. - if (!(m_VideoFormat & VIDEO_FORMAT_MASK_H264)) { + // https://github.com/FFmpeg/FFmpeg/blob/a234e5cd80224c95a205c1f3e297d8c04a1374c3/libavcodec/dxva2.c#L609-L616 + if (m_VideoFormat & VIDEO_FORMAT_MASK_H265) { alignment = 32; } - else { + else if (m_VideoFormat & VIDEO_FORMAT_MASK_H264) { alignment = 16; } + else { + alignment = 128; + } m_Desc.SampleWidth = FFALIGN(m_VideoWidth, alignment); m_Desc.SampleHeight = FFALIGN(m_VideoHeight, alignment);