module-stream-restore: respect preferred_sink/source on multiple stream
module-stream-restore: respect preferred_sink/source on multiple stream
When a stream is already set to a sink/source the
preferred_sink/preferred_source will be left NULL. That creates a
scenario in which the first stream of an application is assigned to
the right device, and following streams will fall back to NULL and
override the restoration db device entry in subscribe_callback (case
when sink_input->preferred_sink/source != NULL || !created_new_entry
).
Instead we can set the the stream preferred_sink/source to the currently
assigned one.
Fixes: #1063 (closed)
Test Case
- start the telegram desktop client and play a voice note
- assign the audio stream to a "new sink"
- this should be saved in the restoration db as
sink-input-by-application-name:telegram-desktop
with device "new sink" - play the voice note again and it will play on the "new sink" as expected from the restoration module
- check the restoration db value for device and it will be NULL
- play it yet another time and it will fallback to the default sink (device = null) in restoration db (case when it is already set to "new sink")