Avoid slicing for hardware decoders that use SDL as the renderer

This commit is contained in:
Cameron Gutman
2020-01-26 14:13:42 -08:00
parent b282c7d815
commit 956e6e3638
3 changed files with 12 additions and 12 deletions

View File

@@ -127,16 +127,6 @@ bool SdlRenderer::isRenderThreadSupported()
return true;
}
int SdlRenderer::getDecoderCapabilities()
{
// Slice up to 4 times for parallel decode, 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);
return CAPABILITY_SLICES_PER_FRAME(slices);
}
bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
{
Uint32 rendererFlags = SDL_RENDERER_ACCELERATED;

View File

@@ -13,7 +13,6 @@ public:
virtual void renderFrame(AVFrame* frame) override;
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
virtual bool isRenderThreadSupported() override;
virtual int getDecoderCapabilities() override;
private:
void renderOverlay(Overlay::OverlayType type);

View File

@@ -47,7 +47,18 @@ bool FFmpegVideoDecoder::isHardwareAccelerated()
int FFmpegVideoDecoder::getDecoderCapabilities()
{
return m_BackendRenderer->getDecoderCapabilities();
int 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);
}
return capabilities;
}
int FFmpegVideoDecoder::getDecoderColorspace()