mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Bound thread count at 4 (same as max slices) and don't use HEVC with the software decoder due to lack of slicing support in common-c
This commit is contained in:
@@ -112,7 +112,11 @@ Session::Session(NvComputer* computer, NvApp& app)
|
|||||||
{
|
{
|
||||||
case StreamingPreferences::VCC_AUTO:
|
case StreamingPreferences::VCC_AUTO:
|
||||||
// TODO: Determine if HEVC is better depending on the decoder
|
// TODO: Determine if HEVC is better depending on the decoder
|
||||||
m_StreamConfig.supportsHevc = true;
|
// NOTE: HEVC currently uses only 1 slice regardless of what
|
||||||
|
// we provide in CAPABILITY_SLICES_PER_FRAME(), so we should
|
||||||
|
// never use it for software decoding (unless common-c starts
|
||||||
|
// respecting it for HEVC).
|
||||||
|
m_StreamConfig.supportsHevc = false;
|
||||||
m_StreamConfig.enableHdr = false;
|
m_StreamConfig.enableHdr = false;
|
||||||
break;
|
break;
|
||||||
case StreamingPreferences::VCC_FORCE_H264:
|
case StreamingPreferences::VCC_FORCE_H264:
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ AVPacket Session::s_Pkt;
|
|||||||
AVCodecContext* Session::s_VideoDecoderCtx;
|
AVCodecContext* Session::s_VideoDecoderCtx;
|
||||||
QByteArray Session::s_DecodeBuffer;
|
QByteArray Session::s_DecodeBuffer;
|
||||||
|
|
||||||
|
#define MAX_SLICES 4
|
||||||
|
|
||||||
int Session::getDecoderCapabilities()
|
int Session::getDecoderCapabilities()
|
||||||
{
|
{
|
||||||
int caps = 0;
|
int caps = 0;
|
||||||
@@ -13,7 +15,7 @@ int Session::getDecoderCapabilities()
|
|||||||
caps |= CAPABILITY_DIRECT_SUBMIT;
|
caps |= CAPABILITY_DIRECT_SUBMIT;
|
||||||
|
|
||||||
// Slice up to 4 times for parallel decode, once slice per core
|
// Slice up to 4 times for parallel decode, once slice per core
|
||||||
caps |= CAPABILITY_SLICES_PER_FRAME(std::min(4, SDL_GetCPUCount()));
|
caps |= CAPABILITY_SLICES_PER_FRAME(std::min(MAX_SLICES, SDL_GetCPUCount()));
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
@@ -51,7 +53,7 @@ int Session::drSetup(int videoFormat, int width, int height, int /* frameRate */
|
|||||||
// Enable slice multi-threading for software decoding
|
// Enable slice multi-threading for software decoding
|
||||||
s_VideoDecoderCtx->flags |= AV_CODEC_FLAG_LOW_DELAY;
|
s_VideoDecoderCtx->flags |= AV_CODEC_FLAG_LOW_DELAY;
|
||||||
s_VideoDecoderCtx->thread_type = FF_THREAD_SLICE;
|
s_VideoDecoderCtx->thread_type = FF_THREAD_SLICE;
|
||||||
s_VideoDecoderCtx->thread_count = SDL_GetCPUCount();
|
s_VideoDecoderCtx->thread_count = std::min(MAX_SLICES, SDL_GetCPUCount());
|
||||||
|
|
||||||
// Setup decoding parameters
|
// Setup decoding parameters
|
||||||
s_VideoDecoderCtx->width = width;
|
s_VideoDecoderCtx->width = width;
|
||||||
|
|||||||
Reference in New Issue
Block a user