[GH-ISSUE #449] Disconnecting output device halts playback permanently #281

Open
opened 2026-02-28 14:31:52 +03:00 by kerem · 4 comments
Owner

Originally created by @HookedBehemoth on GitHub (Jan 18, 2024).
Original GitHub issue: https://github.com/jpochyla/psst/issues/449

Describe the bug
I'm using bluetooth headphones which automatically turn off when placed back in their case. This halts playback entirely and only restarting the entire application fixes it.
Down below is an application log, stripped of absolute paths.
Maybe related: Switching the output device through the OS doesn't change it in psst.

To Reproduce

  • connect bluetooth headphones
  • launch psst
  • start playback
  • disconnect headphones
  • connect headphones again
  • try to unpause or play any other song

Expected behavior
Playback should be allowed to resume on the current primary output device or psst should offer an option to select a target device.

Screenshots
(No images provided as I don't see the reason here)

Environment

Additional context
Log of the hang

[2024-01-18T14:06:48Z INFO  psst_core::audio::output::cpal] using audio device: "Kopfhörer (2- WF-1000XM4)"
[2024-01-18T14:06:48Z INFO  psst_core::cache] using cache: "%APPDATA%\\Local\\Psst"
[2024-01-18T14:06:48Z INFO  psst_core::audio::output::cpal] opening output stream: StreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Default }
[2024-01-18T14:06:48Z INFO  psst_gui::data::config] saved config: "%APPDATA%\\Roaming\\Psst\\config.json"
[2024-01-18T14:06:48Z INFO  psst_gui::data::config] saved config: "%APPDATA%\\Roaming\\Psst\\config.json"
[2024-01-18T14:06:48Z INFO  psst_core::session::access_token] access token expired, requesting
[2024-01-18T14:06:50Z INFO  symphonia_format_ogg::demuxer] starting new physical stream
[2024-01-18T14:06:50Z INFO  symphonia_format_ogg::demuxer] selected vorbis mapper for stream with serial=0x0
[2024-01-18T14:06:50Z INFO  psst_core::player] starting playback
[2024-01-18T14:06:50Z INFO  audio_thread_priority::rt_win] task 1317 bumped to real time priority.
[2024-01-18T14:11:26Z INFO  symphonia_format_ogg::demuxer] starting new physical stream
[2024-01-18T14:11:26Z INFO  symphonia_format_ogg::demuxer] selected vorbis mapper for stream with serial=0x0
[2024-01-18T14:11:26Z INFO  psst_core::player] preloaded audio file
[2024-01-18T14:11:50Z INFO  psst_core::player] pausing playback
[2024-01-18T14:11:53Z INFO  psst_core::player] resuming playback
[2024-01-18T14:11:56Z INFO  psst_core::player] pausing playback
[2024-01-18T14:11:57Z ERROR psst_core::audio::output::cpal] audio output error: The requested device is no longer available. For example, it has been unplugged.
[2024-01-18T14:12:21Z INFO  psst_core::player] resuming playback
[2024-01-18T14:12:21Z ERROR psst_core::audio::output::cpal] output stream actor is dead
[2024-01-18T14:12:21Z ERROR psst_core::audio::output::cpal] failed to start stream: the device associated with the stream is no longer available
[2024-01-18T14:12:26Z INFO  psst_core::player] pausing playback
[2024-01-18T14:12:26Z ERROR psst_core::audio::output::cpal] output stream actor is dead
[2024-01-18T14:12:26Z ERROR psst_core::audio::output::cpal] failed to stop stream: the device associated with the stream is no longer available
Originally created by @HookedBehemoth on GitHub (Jan 18, 2024). Original GitHub issue: https://github.com/jpochyla/psst/issues/449 **Describe the bug** I'm using bluetooth headphones which automatically turn off when placed back in their case. This halts playback entirely and only restarting the entire application fixes it. Down below is an application log, stripped of absolute paths. Maybe related: Switching the output device through the OS doesn't change it in psst. **To Reproduce** - connect bluetooth headphones - launch psst - start playback - disconnect headphones - connect headphones again - try to unpause or play any other song **Expected behavior** Playback should be allowed to resume on the current primary output device or psst should offer an option to select a target device. **Screenshots** (No images provided as I don't see the reason here) **Environment** - OS: Windows 11 - Version: c70ace5 **Additional context** Log of the hang <details> ``` [2024-01-18T14:06:48Z INFO psst_core::audio::output::cpal] using audio device: "Kopfhörer (2- WF-1000XM4)" [2024-01-18T14:06:48Z INFO psst_core::cache] using cache: "%APPDATA%\\Local\\Psst" [2024-01-18T14:06:48Z INFO psst_core::audio::output::cpal] opening output stream: StreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Default } [2024-01-18T14:06:48Z INFO psst_gui::data::config] saved config: "%APPDATA%\\Roaming\\Psst\\config.json" [2024-01-18T14:06:48Z INFO psst_gui::data::config] saved config: "%APPDATA%\\Roaming\\Psst\\config.json" [2024-01-18T14:06:48Z INFO psst_core::session::access_token] access token expired, requesting [2024-01-18T14:06:50Z INFO symphonia_format_ogg::demuxer] starting new physical stream [2024-01-18T14:06:50Z INFO symphonia_format_ogg::demuxer] selected vorbis mapper for stream with serial=0x0 [2024-01-18T14:06:50Z INFO psst_core::player] starting playback [2024-01-18T14:06:50Z INFO audio_thread_priority::rt_win] task 1317 bumped to real time priority. [2024-01-18T14:11:26Z INFO symphonia_format_ogg::demuxer] starting new physical stream [2024-01-18T14:11:26Z INFO symphonia_format_ogg::demuxer] selected vorbis mapper for stream with serial=0x0 [2024-01-18T14:11:26Z INFO psst_core::player] preloaded audio file [2024-01-18T14:11:50Z INFO psst_core::player] pausing playback [2024-01-18T14:11:53Z INFO psst_core::player] resuming playback [2024-01-18T14:11:56Z INFO psst_core::player] pausing playback [2024-01-18T14:11:57Z ERROR psst_core::audio::output::cpal] audio output error: The requested device is no longer available. For example, it has been unplugged. [2024-01-18T14:12:21Z INFO psst_core::player] resuming playback [2024-01-18T14:12:21Z ERROR psst_core::audio::output::cpal] output stream actor is dead [2024-01-18T14:12:21Z ERROR psst_core::audio::output::cpal] failed to start stream: the device associated with the stream is no longer available [2024-01-18T14:12:26Z INFO psst_core::player] pausing playback [2024-01-18T14:12:26Z ERROR psst_core::audio::output::cpal] output stream actor is dead [2024-01-18T14:12:26Z ERROR psst_core::audio::output::cpal] failed to stop stream: the device associated with the stream is no longer available ``` </details>
Author
Owner

@ll01 commented on GitHub (Mar 21, 2024):

I have a similar issue too.

<!-- gh-comment-id:2013124418 --> @ll01 commented on GitHub (Mar 21, 2024): I have a similar issue too.
Author
Owner

@TheMargarineMan commented on GitHub (Apr 10, 2024):

This issue is replicated by disabling devices in windows sound settings. This issue seems to stem from how psst handles its audio devices, initializing a stream on the default device at start. To change this to handle switching between audio sources and disconnects may require a large amount of effort.

<!-- gh-comment-id:2047725393 --> @TheMargarineMan commented on GitHub (Apr 10, 2024): This issue is replicated by disabling devices in windows sound settings. This issue seems to stem from how psst handles its audio devices, initializing a stream on the default device at start. To change this to handle switching between audio sources and disconnects may require a large amount of effort.
Author
Owner

@sidit77 commented on GitHub (May 29, 2024):

Around a year ago, I created https://github.com/RustAudio/cpal/pull/754 to fix this issue, but it got no traction.
If anyone is interested in a quick fix for psst simply go to psst-core/Cargo.toml and replace

cpal = { version = "0.15.2", optional = true }

with

cpal = { git="https://github.com/sidit77/cpal", optional = true }
<!-- gh-comment-id:2138058946 --> @sidit77 commented on GitHub (May 29, 2024): Around a year ago, I created https://github.com/RustAudio/cpal/pull/754 to fix this issue, but it got no traction. If anyone is interested in a quick fix for psst simply go to `psst-core/Cargo.toml` and replace ```toml cpal = { version = "0.15.2", optional = true } ``` with ```toml cpal = { git="https://github.com/sidit77/cpal", optional = true } ```
Author
Owner

@vvuk commented on GitHub (Sep 25, 2024):

Ah, this probably also affects things like SteelSeries Sonar that lets you do per-application routing. Trying to change the route for psst always results in "[...] did not allow Sonar to change the audio settings". Sounds like the issue is in cpal.

<!-- gh-comment-id:2375336213 --> @vvuk commented on GitHub (Sep 25, 2024): Ah, this probably also affects things like SteelSeries Sonar that lets you do per-application routing. Trying to change the route for psst always results in "[...] did not allow Sonar to change the audio settings". Sounds like the issue is in `cpal`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/psst#281
No description provided.