mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Be a bit less verbose
This commit is contained in:
parent
24471eef9b
commit
decce02373
4 changed files with 1 additions and 16 deletions
|
@ -106,11 +106,8 @@ impl audio_file2::Handler for AudioFileInternal {
|
||||||
bitmap.insert(index);
|
bitmap.insert(index);
|
||||||
self.shared.cond.notify_all();
|
self.shared.cond.notify_all();
|
||||||
|
|
||||||
println!("{}/{} {:?}", bitmap.len(), self.chunk_count, *bitmap);
|
|
||||||
|
|
||||||
// If all blocks are complete when can stop
|
// If all blocks are complete when can stop
|
||||||
if bitmap.len() >= self.chunk_count {
|
if bitmap.len() >= self.chunk_count {
|
||||||
println!("All good");
|
|
||||||
drop(bitmap);
|
drop(bitmap);
|
||||||
self.write_file.seek(SeekFrom::Start(0)).unwrap();
|
self.write_file.seek(SeekFrom::Start(0)).unwrap();
|
||||||
self.complete_tx.complete(self.write_file);
|
self.complete_tx.complete(self.write_file);
|
||||||
|
@ -145,10 +142,6 @@ impl audio_file2::Handler for AudioFileInternal {
|
||||||
bitmap.insert(index);
|
bitmap.insert(index);
|
||||||
self.shared.cond.notify_all();
|
self.shared.cond.notify_all();
|
||||||
|
|
||||||
println!("{:?}", *bitmap);
|
|
||||||
|
|
||||||
println!("{} {}", bitmap.len(), self.chunk_count);
|
|
||||||
|
|
||||||
// If all blocks are complete when can stop
|
// If all blocks are complete when can stop
|
||||||
if bitmap.len() >= self.chunk_count {
|
if bitmap.len() >= self.chunk_count {
|
||||||
drop(bitmap);
|
drop(bitmap);
|
||||||
|
|
|
@ -61,7 +61,6 @@ impl <H: Handler> stream::Handler for AudioFile<H> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_header(mut self, header_id: u8, header_data: &[u8], session: &Session) -> stream::Response<Self> {
|
fn on_header(mut self, header_id: u8, header_data: &[u8], session: &Session) -> stream::Response<Self> {
|
||||||
//println!("on_header");
|
|
||||||
match self.handler.on_header(header_id, header_data, session) {
|
match self.handler.on_header(header_id, header_data, session) {
|
||||||
Response::Continue(handler) => {
|
Response::Continue(handler) => {
|
||||||
self.handler = handler;
|
self.handler = handler;
|
||||||
|
@ -77,7 +76,6 @@ impl <H: Handler> stream::Handler for AudioFile<H> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_data(mut self, data: &[u8], session: &Session) -> stream::Response<Self> {
|
fn on_data(mut self, data: &[u8], session: &Session) -> stream::Response<Self> {
|
||||||
//println!("on_data");
|
|
||||||
match self.handler.on_data(self.offset, data, session) {
|
match self.handler.on_data(self.offset, data, session) {
|
||||||
Response::Continue(handler) => {
|
Response::Continue(handler) => {
|
||||||
self.handler = handler;
|
self.handler = handler;
|
||||||
|
@ -85,7 +83,6 @@ impl <H: Handler> stream::Handler for AudioFile<H> {
|
||||||
stream::Response::Continue(self)
|
stream::Response::Continue(self)
|
||||||
}
|
}
|
||||||
Response::Seek(handler, offset) => {
|
Response::Seek(handler, offset) => {
|
||||||
println!("seek request {}", offset);
|
|
||||||
self.handler = handler;
|
self.handler = handler;
|
||||||
self.offset = offset;
|
self.offset = offset;
|
||||||
stream::Response::Spawn(self)
|
stream::Response::Spawn(self)
|
||||||
|
@ -100,11 +97,9 @@ impl <H: Handler> stream::Handler for AudioFile<H> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_error(mut self, session: &Session) -> stream::Response<Self> {
|
fn on_error(mut self, session: &Session) -> stream::Response<Self> {
|
||||||
println!("on_error");
|
|
||||||
match self.handler.on_eof(session) {
|
match self.handler.on_eof(session) {
|
||||||
Response::Continue(_) => stream::Response::Close,
|
Response::Continue(_) => stream::Response::Close,
|
||||||
Response::Seek(handler, offset) => {
|
Response::Seek(handler, offset) => {
|
||||||
println!("seek request {}", offset);
|
|
||||||
self.handler = handler;
|
self.handler = handler;
|
||||||
self.offset = offset;
|
self.offset = offset;
|
||||||
stream::Response::Spawn(self)
|
stream::Response::Spawn(self)
|
||||||
|
|
|
@ -285,14 +285,11 @@ impl PlayerInternal {
|
||||||
Some(PlayerCommand::SeekAt(position, measured_at)) => {
|
Some(PlayerCommand::SeekAt(position, measured_at)) => {
|
||||||
let position = (util::now_ms() - measured_at + position as i64) as u32;
|
let position = (util::now_ms() - measured_at + position as i64) as u32;
|
||||||
|
|
||||||
let before = util::now_ms();
|
|
||||||
vorbis_time_seek_ms(decoder.as_mut().unwrap(), position as i64).unwrap();
|
vorbis_time_seek_ms(decoder.as_mut().unwrap(), position as i64).unwrap();
|
||||||
self.update(|state| {
|
self.update(|state| {
|
||||||
state.position_ms = vorbis_time_tell_ms(decoder.as_mut().unwrap()).unwrap() as u32;
|
state.position_ms = vorbis_time_tell_ms(decoder.as_mut().unwrap()).unwrap() as u32;
|
||||||
state.position_measured_at = util::now_ms();
|
state.position_measured_at = util::now_ms();
|
||||||
|
|
||||||
println!("SEEK: {} {} {}", before, util::now_ms(), util::now_ms() - before);
|
|
||||||
|
|
||||||
true
|
true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ impl Channel {
|
||||||
packet.read_u16::<BigEndian>().unwrap(); // Skip channel id
|
packet.read_u16::<BigEndian>().unwrap(); // Skip channel id
|
||||||
|
|
||||||
if cmd == 0xa {
|
if cmd == 0xa {
|
||||||
println!("error: {} {}", data.len(), packet.read_u16::<BigEndian>().unwrap());
|
error!("error: {} {}", data.len(), packet.read_u16::<BigEndian>().unwrap());
|
||||||
return match handler.box_on_error(session) {
|
return match handler.box_on_error(session) {
|
||||||
Response::Continue(_) => Response::Close,
|
Response::Continue(_) => Response::Close,
|
||||||
Response::Spawn(f) => Response::Spawn(f),
|
Response::Spawn(f) => Response::Spawn(f),
|
||||||
|
|
Loading…
Reference in a new issue