mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-23 16:15:02 +00:00
Allow h264_v4l2m2m to be used in RPi builds if manually specified
This commit is contained in:
parent
9d73aa6b4a
commit
2127e1d90b
2 changed files with 40 additions and 11 deletions
|
@ -937,17 +937,6 @@ bool FFmpegVideoDecoder::tryInitializeRendererForUnknownDecoder(const AVCodec* d
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAL
|
||||
// Only enable V4L2M2M by default on non-MMAL (RPi) builds. The performance
|
||||
// of the V4L2M2M wrapper around MMAL is not enough for 1080p 60 FPS, so we
|
||||
// would rather show the missing hardware acceleration warning when the user
|
||||
// is in Full KMS mode rather than try to use a poorly performing hwaccel.
|
||||
// See discussion on https://github.com/jc-kynesim/rpi-ffmpeg/pull/25
|
||||
if (strcmp(decoder->name, "h264_v4l2m2m") == 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tryHwAccel) {
|
||||
// This might be a hwaccel decoder, so try any hw configs first
|
||||
for (int i = 0;; i++) {
|
||||
|
@ -1039,6 +1028,24 @@ bool FFmpegVideoDecoder::tryInitializeRendererForUnknownDecoder(const AVCodec* d
|
|||
return false;
|
||||
}
|
||||
|
||||
bool FFmpegVideoDecoder::isDecoderIgnored(const AVCodec *decoder)
|
||||
{
|
||||
Q_UNUSED(decoder);
|
||||
|
||||
#ifdef HAVE_MMAL
|
||||
// Only enable V4L2M2M by default on non-MMAL (RPi) builds. The performance
|
||||
// of the V4L2M2M wrapper around MMAL is not enough for 1080p 60 FPS, so we
|
||||
// would rather show the missing hardware acceleration warning when the user
|
||||
// is in Full KMS mode rather than try to use a poorly performing hwaccel.
|
||||
// See discussion on https://github.com/jc-kynesim/rpi-ffmpeg/pull/25
|
||||
if (strcmp(decoder->name, "h264_v4l2m2m") == 0) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
||||
{
|
||||
// Increase log level until the first frame is decoded
|
||||
|
@ -1130,6 +1137,11 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Skip ignored decoders
|
||||
if (isDecoderIgnored(decoder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Look for the first matching hwaccel hardware decoder (pass 0)
|
||||
for (int i = 0;; i++) {
|
||||
const AVCodecHWConfig *config = avcodec_get_hw_config(decoder, i);
|
||||
|
@ -1166,6 +1178,11 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Skip ignored decoders
|
||||
if (isDecoderIgnored(decoder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to initialize this decoder both as hwaccel and non-hwaccel
|
||||
if (tryInitializeRendererForUnknownDecoder(decoder, params, true)) {
|
||||
return true;
|
||||
|
@ -1187,6 +1204,11 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Skip ignored decoders
|
||||
if (isDecoderIgnored(decoder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Look for the first matching hwaccel hardware decoder (pass 1)
|
||||
// This picks up "second-tier" hwaccels like CUDA.
|
||||
for (int i = 0;; i++) {
|
||||
|
@ -1231,6 +1253,11 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Skip ignored decoders
|
||||
if (isDecoderIgnored(decoder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try this decoder without hwaccel
|
||||
if (tryInitializeRendererForUnknownDecoder(decoder, params, false)) {
|
||||
return true;
|
||||
|
|
|
@ -44,6 +44,8 @@ private:
|
|||
|
||||
bool createFrontendRenderer(PDECODER_PARAMETERS params, bool useAlternateFrontend);
|
||||
|
||||
bool isDecoderIgnored(const AVCodec* decoder);
|
||||
|
||||
bool tryInitializeRendererForUnknownDecoder(const AVCodec* decoder,
|
||||
PDECODER_PARAMETERS params,
|
||||
bool tryHwAccel);
|
||||
|
|
Loading…
Reference in a new issue