diff --git a/src/audio_core/cubeb_input.cpp b/src/audio_core/cubeb_input.cpp index c96e13395..04d89e525 100644 --- a/src/audio_core/cubeb_input.cpp +++ b/src/audio_core/cubeb_input.cpp @@ -37,8 +37,12 @@ CubebInput::~CubebInput() { if (!impl->ctx) return; - if (impl->stream && cubeb_stream_stop(impl->stream) != CUBEB_OK) { - LOG_ERROR(Audio, "Error stopping cubeb input stream."); + if (impl->stream) { + if (cubeb_stream_stop(impl->stream) != CUBEB_OK) { + LOG_ERROR(Audio, "Error stopping cubeb input stream."); + } + + cubeb_stream_destroy(impl->stream); } cubeb_destroy(impl->ctx); @@ -103,7 +107,8 @@ 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 + // 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);