Skip to content

Commit a4faacb

Browse files
committed
Disable nonexistent channel on OpenBSD, fix runtime panic
This fixes the following whenever I try playin a file: ``` $ RUST_BACKTRACE=full ./target/release/psst-gui [2021-11-30T00:10:07Z INFO psst_gui::data::config] loading config: "/home/kn/.config/Psst/config.json" [2021-11-30T00:10:07Z INFO psst_core::audio::output] using audio device: "sndio default device" [2021-11-30T00:10:07Z INFO psst_core::cache] using cache: "/home/kn/.cache/Psst" [2021-11-30T00:10:07Z INFO psst_core::audio::output] opening output stream: StreamConfig { channels: 1, sample_rate: SampleRate(48000), buffer_size: Default } [2021-11-30T00:10:07Z INFO psst_gui::data::config] saved config: "/home/kn/.config/Psst/config.json" [2021-11-30T00:10:07Z INFO psst_core::session::access_token] access token expired, requesting [2021-11-30T00:10:09Z INFO symphonia_format_ogg::demuxer] starting new physical stream [2021-11-30T00:10:09Z INFO symphonia_format_ogg::demuxer] selected vorbis mapper for stream with serial=0x0 [2021-11-30T00:10:09Z INFO psst_core::player] starting playback [2021-11-30T00:10:09Z INFO psst_gui::controller::playback] playing thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', psst-core/src/audio/source.rs:65:13 stack backtrace: 0: 0x33b342e3bbc - <unknown> 1: 0x33b3431ca6b - <unknown> 2: 0x33b342d32e3 - <unknown> 3: 0x33b342d686b - <unknown> 4: 0x33b342d63f7 - <unknown> 5: 0x33b342d6f56 - <unknown> 6: 0x33b342e43a5 - <unknown> 7: 0x33b342e3d07 - <unknown> 8: 0x33b342d6a26 - <unknown> 9: 0x33b34311150 - <unknown> 10: 0x33b34311117 - <unknown> 11: 0x33b340700ce - <unknown> 12: 0x33b34066cc8 - <unknown> 13: 0x33b3406e41a - <unknown> 14: 0x33b341e6be0 - <unknown> 15: 0x33b340a63da - <unknown> 16: 0x33b3403339a - <unknown> 17: 0x33b342de179 - <unknown> 18: 0x33d46e136a1 - <unknown> 19: 0x33e0cc4808a - <unknown># Please enter the commit message for your changes. Lines starting ``` With this, `psst` plays audio fine on OpenBSD; the playback speed is back to normal!
1 parent a7c1fec commit a4faacb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

psst-core/src/audio/source.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ where
6262
let output_frames = output.chunks_exact_mut(self.output_channels);
6363
for (i, o) in input_frames.zip(output_frames) {
6464
o[0] = i[0];
65-
o[1] = i[1];
65+
// XXX on OpenBSD, there is only one channel.
66+
//o[1] = i[1];
6667
// Assume the rest is is implicitly silence.
6768
}
6869
output.len()

0 commit comments

Comments
 (0)