mirror of
https://github.com/electron/electron.git
synced 2026-01-10 16:08:06 -05:00
XDG Desktop Portal provides restore tokens to restore a previously selected PipeWire stream instead of prompting the user again. This restore token is single use only and it has to be replaced when the stream is completed/stopped. BaseCapturerPipewire maintains two source IDs: one is initialized by the constructor for new sources (source_id_) and another is for capturing previously selected sources (selected_source_id_). The restore token was always being stored under `source_id_`, even if the capture was ongoing for `selected_source_id_`. This prevents a stream from being restored more than once. Fix that by storing the restore token under the selected source ID if it exists.