mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-15 11:33:27 +01:00
Avoid leaking the cubeb input stream
This commit is contained in:
parent
51dfc46d3f
commit
f9750875e3
@ -37,7 +37,7 @@ CubebInput::~CubebInput() {
|
||||
if (!impl->ctx)
|
||||
return;
|
||||
|
||||
if (cubeb_stream_stop(impl->stream) != CUBEB_OK) {
|
||||
if (impl->stream && cubeb_stream_stop(impl->stream) != CUBEB_OK) {
|
||||
LOG_ERROR(Audio, "Error stopping cubeb input stream.");
|
||||
}
|
||||
|
||||
@ -103,8 +103,11 @@ void CubebInput::StartSampling(const Frontend::Mic::Parameters& params) {
|
||||
}
|
||||
|
||||
void CubebInput::StopSampling() {
|
||||
// TODO(xperia64): Destroy the stream for now to avoid a leak because StartSampling reinitializes the stream every time
|
||||
if (impl->stream) {
|
||||
cubeb_stream_stop(impl->stream);
|
||||
cubeb_stream_destroy(impl->stream);
|
||||
impl->stream = nullptr;
|
||||
}
|
||||
is_sampling = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user