mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-04 18:29:45 +02:00
Merge branch 'dev' into tokio_migration
This commit is contained in:
commit
872fab62d8
23 changed files with 884 additions and 562 deletions
|
@ -67,7 +67,11 @@ impl Sink for PulseAudioSink {
|
|||
|
||||
fn write(&mut self, data: &[i16]) -> io::Result<()> {
|
||||
if let Some(s) = &self.s {
|
||||
let d: &[u8] = unsafe { std::mem::transmute(data) };
|
||||
// SAFETY: An i16 consists of two bytes, so that the given slice can be interpreted
|
||||
// as a byte array of double length. Each byte pointer is validly aligned, and so
|
||||
// is the newly created slice.
|
||||
let d: &[u8] =
|
||||
unsafe { std::slice::from_raw_parts(data.as_ptr() as *const u8, data.len() * 2) };
|
||||
|
||||
match s.write(d) {
|
||||
Ok(_) => Ok(()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue