if single-threaded brotli, retain artificial number set in BrotliHandler (0) - always prefer it for .br format, otherwise -mmt1 causes that it'd use brotli-mt and the stream is incompatible; -mmt=n with n >= 2 forces multi-threaded compression/decompression (therefore incompatible with standard brotli)

This commit is contained in:
sebres
2023-09-07 20:26:17 +02:00
parent 32ac26a4e7
commit 2b48366507
2 changed files with 8 additions and 0 deletions

View File

@@ -100,6 +100,10 @@ STDMETHODIMP CDecoder::SetNumberOfThreads(UInt32 numThreads)
const UInt32 kNumThreadsMax = BROTLIMT_THREAD_MAX;
if (numThreads < 0) numThreads = 0;
if (numThreads > kNumThreadsMax) numThreads = kNumThreadsMax;
// if single-threaded, retain artificial number set in BrotliHandler (always prefer .br format):
if (_numThreads == 0 && numThreads == 1) {
numThreads = 0;
}
_numThreads = numThreads;
return S_OK;
}