Fix crash caused by screen capturer or mouse controller init failed on Linux and MacOS

This commit is contained in:
dijunkun
2024-05-23 15:48:10 +08:00
parent 70be1d8afc
commit 8807636372
7 changed files with 49 additions and 15 deletions

View File

@@ -91,12 +91,15 @@ int ScreenCapturerX11::Init(const RECORD_DESKTOP_RECT &rect, const int fps,
pFrame_->width, pFrame_->height, pCodecCtx_->pix_fmt, pFrameNv12_->width,
pFrameNv12_->height, AV_PIX_FMT_NV12, SWS_BICUBIC, NULL, NULL, NULL);
inited_ = true;
return 0;
}
int ScreenCapturerX11::Destroy() {
if (capture_thread_->joinable()) {
if (inited_ && capture_thread_->joinable()) {
capture_thread_->join();
inited_ = false;
}
return 0;