Fix crash if capture is stopped before completing startup

This commit is contained in:
Cameron Gutman 2023-05-04 21:08:51 -05:00
parent df1286ac88
commit 10ea67719e

View File

@ -775,9 +775,12 @@ namespace video {
}
}
if (auto capture_ctx = capture_ctx_queue->pop()) {
capture_ctxs.emplace_back(std::move(*capture_ctx));
// Wait for the initial capture context or a request to stop the queue
auto initial_capture_ctx = capture_ctx_queue->pop();
if (!initial_capture_ctx) {
return;
}
capture_ctxs.emplace_back(std::move(*initial_capture_ctx));
auto disp = platf::display(map_base_dev_type(encoder.base_dev_type), display_names[display_p], capture_ctxs.front().config);
if (!disp) {