Skip to content

Commit

Permalink
Disable nonexistent channel on OpenBSD, fix runtime panic
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
klemensn committed Nov 30, 2021
1 parent a7c1fec commit a4faacb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion psst-core/src/audio/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ where
let output_frames = output.chunks_exact_mut(self.output_channels);
for (i, o) in input_frames.zip(output_frames) {
o[0] = i[0];
o[1] = i[1];
// XXX on OpenBSD, there is only one channel.
//o[1] = i[1];
// Assume the rest is is implicitly silence.
}
output.len()
Expand Down

0 comments on commit a4faacb

Please sign in to comment.