mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-05 15:58:46 +00:00
Add environment variable for overriding decoder capabilities
This commit is contained in:
parent
21edcc8113
commit
704ce4ff0c
1 changed files with 22 additions and 9 deletions
|
@ -70,18 +70,31 @@ void FFmpegVideoDecoder::setHdrMode(bool enabled)
|
||||||
|
|
||||||
int FFmpegVideoDecoder::getDecoderCapabilities()
|
int FFmpegVideoDecoder::getDecoderCapabilities()
|
||||||
{
|
{
|
||||||
int capabilities = m_BackendRenderer->getDecoderCapabilities();
|
bool ok;
|
||||||
|
|
||||||
if (!isHardwareAccelerated()) {
|
int capabilities = qEnvironmentVariableIntValue("DECODER_CAPS", &ok);
|
||||||
// Slice up to 4 times for parallel CPU decoding, once slice per core
|
if (ok) {
|
||||||
int slices = qMin(MAX_SLICES, SDL_GetCPUCount());
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
"Using decoder capability override: 0x%x",
|
||||||
"Encoder configured for %d slices per frame",
|
capabilities);
|
||||||
slices);
|
}
|
||||||
capabilities |= CAPABILITY_SLICES_PER_FRAME(slices);
|
else {
|
||||||
|
// Start with the backend renderer's capabilities
|
||||||
|
capabilities = m_BackendRenderer->getDecoderCapabilities();
|
||||||
|
|
||||||
|
if (!isHardwareAccelerated()) {
|
||||||
|
// Slice up to 4 times for parallel CPU decoding, once slice per core
|
||||||
|
int slices = qMin(MAX_SLICES, SDL_GetCPUCount());
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Encoder configured for %d slices per frame",
|
||||||
|
slices);
|
||||||
|
capabilities |= CAPABILITY_SLICES_PER_FRAME(slices);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We use our own decoder thread with the "pull" model
|
// We use our own decoder thread with the "pull" model. This cannot
|
||||||
|
// be overridden using the by the user because it is critical to
|
||||||
|
// our operation.
|
||||||
capabilities |= CAPABILITY_PULL_RENDERER;
|
capabilities |= CAPABILITY_PULL_RENDERER;
|
||||||
|
|
||||||
return capabilities;
|
return capabilities;
|
||||||
|
|
Loading…
Reference in a new issue