From de62ecabf3ac4bb7bcd38d9e7aed4bc2c34107d0 Mon Sep 17 00:00:00 2001 From: axel10 Date: Sat, 28 Mar 2026 22:53:05 +0800 Subject: [PATCH 1/3] fix: set default channels to 2 in Empty source to prevent channel shifting bug --- src/source/empty.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/source/empty.rs b/src/source/empty.rs index 13b6843b..a69b0e5f 100644 --- a/src/source/empty.rs +++ b/src/source/empty.rs @@ -42,7 +42,7 @@ impl Source for Empty { #[inline] fn channels(&self) -> ChannelCount { - nz!(1) + nz!(2) // Default to 2 (stereo) to prevent a 1-sample channel shifting bug in the Queue when swapping to stereo sources. } #[inline] From 93d43e4f4b027428962a0997f8ac0e70ddf05f42 Mon Sep 17 00:00:00 2001 From: axel10 Date: Sat, 28 Mar 2026 22:57:18 +0800 Subject: [PATCH 2/3] update changelog to include fix for 1-sample channel shift in Player --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ab0172..ae469f45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved queue, buffer, mixer and sample rate conversion performance. ### Fixed - +- Fixed a 1-sample channel shift (L/R swap) in Player when rapidly appending stereo sources to an empty queue. - Fixed `Player::skip_one` not decreasing the player's length immediately. - Fixed `Source::current_span_len()` to consistently return total span length. - Fixed `Source::size_hint()` to consistently report actual bounds based on current sources. From 2ebfe593f4bee06bf97cbd2361eadb69c0f0de4c Mon Sep 17 00:00:00 2001 From: axel10 Date: Sat, 28 Mar 2026 23:52:43 +0800 Subject: [PATCH 3/3] update test cases --- src/queue.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/queue.rs b/src/queue.rs index 18ef70b1..cf065500 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -394,8 +394,8 @@ mod tests { let (tx, rx) = queue::queue(keep_alive); assert_eq!( rx.channels(), - nz!(1), - "Initial channels should be 1 (keep_alive={keep_alive})" + nz!(2), + "Initial channels should be 2 (keep_alive={keep_alive})" ); assert_eq!( rx.sample_rate(),