mirror of
https://github.com/citra-emu/citra-nightly.git
synced 2024-12-26 08:35:38 +00:00
Merge pull request #5356 from xperia64/cubeb_avoid_leak
Avoid leaking cubeb input stream
This commit is contained in:
commit
c4ba7b3626
|
@ -37,10 +37,14 @@ CubebInput::~CubebInput() {
|
||||||
if (!impl->ctx)
|
if (!impl->ctx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (impl->stream) {
|
||||||
if (cubeb_stream_stop(impl->stream) != CUBEB_OK) {
|
if (cubeb_stream_stop(impl->stream) != CUBEB_OK) {
|
||||||
LOG_ERROR(Audio, "Error stopping cubeb input stream.");
|
LOG_ERROR(Audio, "Error stopping cubeb input stream.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cubeb_stream_destroy(impl->stream);
|
||||||
|
}
|
||||||
|
|
||||||
cubeb_destroy(impl->ctx);
|
cubeb_destroy(impl->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,8 +107,12 @@ void CubebInput::StartSampling(const Frontend::Mic::Parameters& params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubebInput::StopSampling() {
|
void CubebInput::StopSampling() {
|
||||||
|
// TODO(xperia64): Destroy the stream for now to avoid a leak because StartSampling
|
||||||
|
// reinitializes the stream every time
|
||||||
if (impl->stream) {
|
if (impl->stream) {
|
||||||
cubeb_stream_stop(impl->stream);
|
cubeb_stream_stop(impl->stream);
|
||||||
|
cubeb_stream_destroy(impl->stream);
|
||||||
|
impl->stream = nullptr;
|
||||||
}
|
}
|
||||||
is_sampling = false;
|
is_sampling = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue