mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-02-16 02:30:52 +00:00
Don't set pix_fmt for hwaccel decoders
This works around a bug in the AV1 Vulkan decoding code in FFmpeg that causes it to incorrectly skip hwaccel init. Fixes #1511
This commit is contained in:
@@ -519,9 +519,19 @@ bool FFmpegVideoDecoder::completeInitialization(const AVCodec* decoder, enum AVP
|
||||
// Setup decoding parameters
|
||||
m_VideoDecoderCtx->width = params->width;
|
||||
m_VideoDecoderCtx->height = params->height;
|
||||
m_VideoDecoderCtx->pix_fmt = requiredFormat != AV_PIX_FMT_NONE ? requiredFormat : m_FrontendRenderer->getPreferredPixelFormat(params->videoFormat);
|
||||
m_VideoDecoderCtx->get_format = ffGetFormat;
|
||||
|
||||
// For non-hwaccel decoders, set the pix_fmt to hint to the decoder which
|
||||
// format should be used. This is necessary for certain decoders like the
|
||||
// out-of-tree nvv4l2dec decoders for L4T platforms. We do not do this
|
||||
// for hwaccel decoders because it causes the AV1 Vulkan video decoder in
|
||||
// FFmpeg 7.0-8.0 to incorrectly believe ff_get_format() was called.
|
||||
// See #1511.
|
||||
if (m_HwDecodeCfg == nullptr) {
|
||||
m_VideoDecoderCtx->pix_fmt = (requiredFormat != AV_PIX_FMT_NONE) ?
|
||||
requiredFormat : m_FrontendRenderer->getPreferredPixelFormat(params->videoFormat);
|
||||
}
|
||||
|
||||
AVDictionary* options = nullptr;
|
||||
|
||||
// Allow the backend renderer to attach data to this decoder
|
||||
|
||||
Reference in New Issue
Block a user