modules: disconnect streams before destroy

So that they are both stopped before being destroyed.
This commit is contained in:
Wim Taymans 2022-09-28 09:13:31 +02:00
parent 1e848fc299
commit 38e8e76f76
2 changed files with 10 additions and 0 deletions

View file

@ -2080,12 +2080,20 @@ static const struct pw_proxy_events core_proxy_events = {
static void impl_destroy(struct impl *impl) static void impl_destroy(struct impl *impl)
{ {
/* disconnect both streams before destroying any of them */
if (impl->capture)
pw_stream_disconnect(impl->capture);
if (impl->playback)
pw_stream_disconnect(impl->playback);
if (impl->capture) if (impl->capture)
pw_stream_destroy(impl->capture); pw_stream_destroy(impl->capture);
if (impl->playback) if (impl->playback)
pw_stream_destroy(impl->playback); pw_stream_destroy(impl->playback);
if (impl->core && impl->do_disconnect) if (impl->core && impl->do_disconnect)
pw_core_disconnect(impl->core); pw_core_disconnect(impl->core);
pw_properties_free(impl->capture_props); pw_properties_free(impl->capture_props);
pw_properties_free(impl->playback_props); pw_properties_free(impl->playback_props);
graph_free(&impl->graph); graph_free(&impl->graph);

View file

@ -414,8 +414,10 @@ static void impl_destroy(struct impl *impl)
pw_stream_destroy(impl->capture); pw_stream_destroy(impl->capture);
if (impl->playback) if (impl->playback)
pw_stream_destroy(impl->playback); pw_stream_destroy(impl->playback);
if (impl->core && impl->do_disconnect) if (impl->core && impl->do_disconnect)
pw_core_disconnect(impl->core); pw_core_disconnect(impl->core);
pw_properties_free(impl->capture_props); pw_properties_free(impl->capture_props);
pw_properties_free(impl->playback_props); pw_properties_free(impl->playback_props);
free(impl); free(impl);