Skip to content

Commit

Permalink
stop()でのポインタ配慮 (#1)
Browse files Browse the repository at this point in the history
* stop()でのポインタ配慮
* refix
  • Loading branch information
asaday authored Mar 25, 2024
1 parent d452a64 commit 91e5449
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions nair-rtvc-source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,11 @@ namespace {
HRESULT Start() {
HRESULT hr = S_OK;

if (device_count_ <= 0) {
OBS_ERROR("could not found input devices");
return E_FAIL;
}

if (hEvtAudioCaptureSamplesReady_) {
::CloseHandle(hEvtAudioCaptureSamplesReady_);
hEvtAudioCaptureSamplesReady_ = nullptr;
Expand Down Expand Up @@ -554,10 +559,12 @@ namespace {

::SetEvent(hEvtShutdown_);
::WaitForSingleObject(hAudioThread_, INFINITE);
if FAILED(hr = pAudioClientIn_->Stop()) {
std::string const& msg = std::system_category().message(hr);
OBS_ERROR("Unable to stop audio pAudioClientIn: %s (%x)", msg.c_str(), hr);
return hr;
if (pAudioClientIn_) {
if FAILED(hr = pAudioClientIn_->Stop()) {
std::string const& msg = std::system_category().message(hr);
OBS_ERROR("Unable to stop audio pAudioClientIn: %s (%x)", msg.c_str(), hr);
return hr;
}
}

if (hEvtAudioCaptureSamplesReady_) {
Expand Down

0 comments on commit 91e5449

Please sign in to comment.