Skip to content

Commit ac20e1e

Browse files
committed
Improved data stream header handling
1 parent fa3fd58 commit ac20e1e

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ log = "0.4.27"
2020
notify-rust = { version = "4.11.7", default-features = false, optional = true, features = [
2121
"dbus",
2222
] }
23-
pulse = { package = "libpulse-binding", version = "2.29.0", optional = true }
23+
pulse = { package = "libpulse-binding", version = "2.30.1", optional = true }
2424
rodio = { version = "0.20.1", optional = true, default-features = false, features = [
2525
"crossbeam-channel",
2626
] }

src/decode.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::{
2-
io::{BufRead, BufReader, Write},
2+
io::{BufRead, Write},
33
mem,
44
net::{Ipv4Addr, TcpStream},
55
sync::{Arc, Mutex},
@@ -372,8 +372,16 @@ pub fn make_decoder(
372372

373373
stream_in.send(PlayerMsg::Connected).ok();
374374

375-
let mut data_stream = BufReader::new(data_stream);
376-
375+
let mut data_stream = SlimBuffer::with_capacity(
376+
threshold as usize * 1024,
377+
data_stream,
378+
status.clone(),
379+
threshold,
380+
None,
381+
);
382+
383+
stream_in.send(PlayerMsg::BufferThreshold).ok();
384+
377385
// Read until we encounter the end of headers (a blank line: "\r\n\r\n")
378386
{
379387
let mut line = String::new();
@@ -387,16 +395,9 @@ pub fn make_decoder(
387395
}
388396

389397
let mss = MediaSourceStream::new(
390-
Box::new(ReadOnlySource::new(SlimBuffer::with_capacity(
391-
threshold as usize * 1024,
392-
data_stream,
393-
status,
394-
threshold,
395-
None,
396-
))),
398+
Box::new(ReadOnlySource::new(data_stream)),
397399
Default::default(),
398400
);
399-
stream_in.send(PlayerMsg::BufferThreshold).ok();
400401

401402
Ok((
402403
Decoder::try_new(mss, format, pcmsamplerate, pcmchannels)?,

src/proto.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ pub fn run(
3232
// update server details when a Serv message is received
3333
'outer: loop {
3434
let mut caps = Capabilities::default();
35+
36+
let version = env!("CARGO_PKG_VERSION");
37+
caps.add_name(version);
38+
3539
caps.add(Capability::Maxsamplerate(192000));
3640
if syncgroupid.len() > 0 {
3741
info!("Joining sync group: {syncgroupid}");

0 commit comments

Comments
 (0)