Skip to content

[Bug] Bluetooth A2DP: whole-track pitch shift/slowdown after toggling audio output mode (WASAPI shared/exclusive, Win11) #437

Open

Description

@himasadek09-hub

Environment

  • SPlayer-Next 1.2.1-nightly.1052 (1.2.0-nightly.990 also affected), Windows 11 Pro 22631 x64
  • Output: Bluetooth A2DP headset "ROSE CAMBRIAN" (Intel Wireless Bluetooth 24.70.0.4; HFP/Hands-Free disabled)
  • Reproduces in both shared and exclusive output modes
  • Controls: Realtek wired output OK; Windows built-in player OK; another BT headset with fixed 44.1k endpoint OK

Symptom

Playing a local file, the entire track sounds pitched down / slowed. During playback, background loops audibly slow down and then speed up to catch up. Toggling Settings → Playback → Audio output mode (shared ↔ exclusive) reproduces it quickly.

Files are ruled out:

  • downloaded file matches the online stream byte-for-byte (correlation 1.000, same duration);
  • loopback capture of the app's output matched the source at scale 1.000 on Realtek;
  • a 440 Hz tone stays 440.00 Hz after 44.1k→48k resampling on Realtek.

Steps

  1. Connect the BT headset in A2DP mode (HFP disabled)
  2. Play any local audio file
  3. Toggle audio output mode shared/exclusive
  4. Whole track is detuned; background loops drift and catch up

Log excerpts (native/audio-engine)

18:18:55 独占模式格式协商成功 rate=48000 channels=2 bits=16
19:38:42 独占模式格式协商成功 rate=44100 channels=2 bits=16
18:19:05 WARN 独占输出唤醒间隔超过两个设备周期 late_wakes=1 longest_gap_ms=21.5972 period_ms=10.0
18:21:38 音频输出流因设备切换失效,准备重建
18:25:36 输出重建失败,播放器进入暂停态 error=audio error kind: Device
19:56:18 切换音频输出模式 enabled=true / 重新初始化音频输出设备
19:56:30 切换音频输出模式 enabled=false / 重新初始化音频输出设备

Engine strings found in audio-engine.node: 输出格式变化后重建重采样器失败, 构建 FFT 重采样器失败, 独占模式开流失败,尝试共享模式

Hypothesis

The Bluetooth endpoint's actual rate flips between 44.1k and 48k (exclusive negotiation vs shared default). When the FFT resampler is rebuilt after an output format change, the ratio may not follow the actual stream format, detuning the whole track; the internal clock correction then produces the "slow down, then catch up" effect.

Expected

  • rebuild the resampler using the actual output stream format;
  • fall back to shared mode if rebuild fails;
  • avoid hot format switching during playback (reload the stream after device/mode change).

Full audio-engine logs and settings.json can be provided if needed.

Activity

  1. github-actions commented on Nov 1, 2026

    @github-actions

    👋 @himasadek09-hub

    感谢提交 Issue!我们已经收到您的反馈,会尽快确认您的问题。

    Thanks for opening this issue! We have received your report and will review it as soon as possible.

  2. himasadek09-hub commented on Nov 1, 2026

    @himasadek09-hub
    Author

    Complete report (all details in one place)

    Environment

    • SPlayer-Next 1.2.1-nightly.1052 (also reproduced on 1.2.0-nightly.990), Windows 11 Pro 22631 x64
    • Output: Bluetooth A2DP headset "ROSE CAMBRIAN" (Intel Wireless Bluetooth 24.70.0.4); HFP/Hands-Free disabled
    • Reproduces in both shared and exclusive output modes; also after disabling "Allow applications to take exclusive control" for the endpoint
    • Controls: Realtek wired output OK; Windows built-in player OK; another BT headset with fixed 44.1k endpoint OK

    Symptom

    1. Playing a local file, the whole track sounds pitched down / slowed. Background loops audibly slow down and then catch up.
    2. Toggling Settings → Playback → Audio output mode (shared ↔ exclusive) reproduces it 100%.
    3. New: after disabling exclusive control, tracks sometimes start detuned and gradually return to correct pitch after a few seconds ("warm-up").
    4. Files are ruled out: downloaded file matches the online stream byte-for-byte (correlation 1.000); loopback capture of app output matched the source at scale 1.000 on Realtek; 440Hz tone stays 440.00Hz after 44.1→48k resampling on Realtek.

    Steps to reproduce

    1. Connect the BT headset in A2DP mode (HFP disabled)
    2. Play any local audio file
    3. Toggle audio output mode shared/exclusive
    4. Whole track is detuned; background loops drift and catch up

    Key log excerpts

    18:18:55 INFO  audio_engine::output::wasapi::format: 独占模式格式协商成功 rate=48000 channels=2 bits=16
    19:38:42 INFO  audio_engine::output::wasapi::format: 独占模式格式协商成功 rate=44100 channels=2 bits=16
    18:19:05 WARN  audio_engine::output::wasapi: 独占输出唤醒间隔超过两个设备周期 late_wakes=1 longest_gap_ms=21.5972 period_ms=10.0
    18:21:38 INFO  audio_engine::output::cpal_stream: 音频输出流因设备切换失效,准备重建
    18:25:36 WARN  audio_engine::bindings::player::device: 输出重建失败,播放器进入暂停态 error=audio error kind: Device
    19:56:18 INFO  audio_engine::player: 切换音频输出模式 enabled=true
    19:56:18 INFO  audio_engine::bindings::player::device: 重新初始化音频输出设备
    20:05:51 WARN  audio_engine::output::device: 独占模式协商失败,回退共享模式 reason="formatUnsupported" error=format unsupported
    20:08:25 DEBUG audio_engine::decoder::reader: 解码线程异常结束 error=FFmpeg error -1094995529: Invalid data found when processing input
    

    Engine strings found in audio-engine.node: 输出格式变化后重建重采样器失败, 构建 FFT 重采样器失败, 独占模式开流失败,尝试共享模式

    Hypothesis
    The BT endpoint's actual rate flips between 44.1k and 48k. After any output re-initialization (mode switch, device switch, output rebuild), the resampler ratio is not initialized from the actual stream format; it starts wrong and converges via adaptive clock correction, producing a detuned start and a "slow down, then catch up" effect.

    Expected

    • Initialize/rebuild the resampler from the actual output stream format;
    • On failure, keep a correct fallback (and avoid silently continuing with a wrong ratio);
    • Avoid hot format switching during playback / reload the stream after device or mode changes.

    Attachments
    Full filtered native audio-engine log and application log are attached in splayer-next-bt-audio-logs.zip.

    splayer-next-bt-audio-logs.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions