From 62b40efe5aca1fd519827a873f399ac311dcd748 Mon Sep 17 00:00:00 2001 From: Salman Malik Date: Sat, 24 Sep 2022 00:09:38 +0000 Subject: [PATCH] base_pipwire_capturer: Stop stream upon destruction Shared screencast stream is tied to desktop capturer options, which may outlive capturer itself. This leads to a case where one may attempt to restart the stream in the capturer. This causes the previous pipewire objects to leak (as observed in `pw-top` output) and seems to appear as frozen screen for clients. This CL ensures that the shared screen cast stream, which is started in this capturer, is also stopped when the capturer is destroyed. Bug: chromium:1291247 Change-Id: I5f2b22e54e916549a5280ec457cd76360e42e48a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276640 Commit-Queue: Salman Malik Reviewed-by: Alexander Cooper Cr-Commit-Position: refs/heads/main@{#38187} --- .../desktop_capture/linux/wayland/base_capturer_pipewire.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc index 8bf0662166..2a63fc7a3c 100644 --- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc +++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc @@ -44,7 +44,9 @@ BaseCapturerPipeWire::BaseCapturerPipeWire( source_id_ = RestoreTokenManager::GetInstance().GetUnusedId(); } -BaseCapturerPipeWire::~BaseCapturerPipeWire() {} +BaseCapturerPipeWire::~BaseCapturerPipeWire() { + options_.screencast_stream()->StopScreenCastStream(); +} void BaseCapturerPipeWire::OnScreenCastRequestResult(RequestResponse result, uint32_t stream_node_id,