jpochyla / jpochyla/psst

Disconnecting output device halts playback permanently

Open
#449 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
9.5k
Forks
268
PR merge metrics
No merged PRs in 30d

Description

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

[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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the device disconnect sequence on Windows and inspect the psst_core::audio::output::cpal and psst_core::player paths shown in the log. Trace how the unavailable device and dead output stream are handled; done means playback can resume after reconnecting or switching to the current primary output device without restarting psst.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
audio-video-rtc, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.