source-mirror: Fix crash with audio data on obs_shutdown (#22)

Due to the lack of checking aud and aoi, a rare race condition crash can be observed with audio mirroring enabled on closing OBS. In this case, aoi is used even though it is null, causing OBS to crash instead of closing normally.

Fixes #22
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-11-07 14:43:43 +01:00
parent b5339b4429
commit 16f55ca583

View file

@ -499,7 +499,13 @@ void Source::Mirror::audio_capture_cb(void*, const audio_data* audio, bool) {
}
audio_t* aud = obs_get_audio();
if (!aud) {
return;
}
audio_output_info const* aoi = audio_output_get_info(aud);
if (!aoi) {
return;
}
std::bitset<8> layout;
for (size_t plane = 0; plane < MAX_AV_PLANES; plane++) {