We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1cab5aa + c34c386 commit 01edce1Copy full SHA for 01edce1
src/mvextractor/video_cap.cpp
@@ -112,7 +112,9 @@ bool VideoCap::open(const char *url) {
112
if (avcodec_parameters_to_context(this->video_dec_ctx, st->codecpar) < 0)
113
goto error;
114
115
- this->video_dec_ctx->thread_count = std::thread::hardware_concurrency();
+ // FFmpeg recommends no more than 16 threads
116
+ auto thread_count = std::min(std::thread::hardware_concurrency(), 16u);
117
+ this->video_dec_ctx->thread_count = static_cast<int>(thread_count);
118
#ifdef DEBUG
119
std::cerr << "Using parallel processing with " << this->video_dec_ctx->thread_count << " threads" << std::endl;
120
#endif
0 commit comments