Use separate encoding and capture devices to enable parallel encoding and capture (#668)

This commit is contained in:
Cameron Gutman
2023-01-02 14:56:58 -06:00
committed by GitHub
parent 76ffa2a0b5
commit 0439d7a83a
4 changed files with 294 additions and 105 deletions

View File

@@ -441,11 +441,10 @@ static encoder_t nvenc {
std::make_optional<encoder_t::option_t>({ "qp"s, &config::video.qp }),
"h264_nvenc"s,
},
PARALLEL_ENCODING,
#ifdef _WIN32
DEFAULT,
dxgi_make_hwdevice_ctx
#else
PARALLEL_ENCODING,
cuda_make_hwdevice_ctx
#endif
};
@@ -486,7 +485,7 @@ static encoder_t amdvce {
std::make_optional<encoder_t::option_t>({ "qp_p"s, &config::video.qp }),
"h264_amf"s,
},
DEFAULT,
PARALLEL_ENCODING,
dxgi_make_hwdevice_ctx
};
#endif
@@ -1409,6 +1408,12 @@ void capture_async(
std::move(hwdevice),
ref->reinit_event, *ref->encoder_p,
channel_data);
// Free images that weren't consumed by the encoder before it quit.
// This is critical to allow the display_t to be freed correctly.
while(images->peek()) {
images->pop();
}
}
}