ffmpeg: disable multithreading in favor of our own
Our renderer system is already heavily multithreaded and prioritized to keep the main thread active. As a result, FFmpeg receives little benefits from being multithreaded and is actually detrimental to our main thread as it hasn't been prioritized to keep the main thread as active as possible.
This commit is contained in:
@@ -47,7 +47,8 @@ FFmpegDecoder::FFmpegDecoder() :
|
||||
scale_ctx_(nullptr),
|
||||
pkt_(nullptr),
|
||||
frame_(nullptr),
|
||||
opts_(nullptr)
|
||||
opts_(nullptr),
|
||||
multithreading_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -125,8 +126,8 @@ bool FFmpegDecoder::Open()
|
||||
return false;
|
||||
}
|
||||
|
||||
// enable multithreading on decoding
|
||||
error_code = av_dict_set(&opts_, "threads", "auto", 0);
|
||||
// Set multithreading setting
|
||||
error_code = av_dict_set(&opts_, "threads", multithreading_ ? "auto" : "1", 0);
|
||||
|
||||
// Handle failure to set multithreaded decoding
|
||||
if (error_code < 0) {
|
||||
@@ -524,6 +525,11 @@ bool FFmpegDecoder::SupportsAudio()
|
||||
return true;
|
||||
}
|
||||
|
||||
void FFmpegDecoder::SetMultithreading(bool e)
|
||||
{
|
||||
multithreading_ = e;
|
||||
}
|
||||
|
||||
void FFmpegDecoder::ConformInternal(SwrContext* resampler, WaveOutput* output, const char* in_data, int in_sample_count)
|
||||
{
|
||||
// Determine how many samples the output will be
|
||||
|
||||
Reference in New Issue
Block a user