Debugging formatting
This commit is contained in:
parent
c5a42afd32
commit
12cd1bdd4b
2 changed files with 8 additions and 2 deletions
|
@ -50,7 +50,7 @@ impl AsRef<[u8]> for ClusterHead {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Chunk<B: AsRef<[u8]> = Vec<u8>> {
|
pub enum Chunk<B: AsRef<[u8]> = Vec<u8>> {
|
||||||
Headers {
|
Headers {
|
||||||
bytes: Arc<B>
|
bytes: Arc<B>
|
||||||
|
|
|
@ -28,12 +28,17 @@ impl<I: AsRef<[u8]>, S: Stream<Item = I>> WebmBuffer<S> {
|
||||||
|
|
||||||
pub fn try_decode(&mut self) -> Result<Async<Option<WebmElement>>, ParsingError<S::Error>> {
|
pub fn try_decode(&mut self) -> Result<Async<Option<WebmElement>>, ParsingError<S::Error>> {
|
||||||
match WebmElement::decode_element(&self.buffer) {
|
match WebmElement::decode_element(&self.buffer) {
|
||||||
Err(err) => return Err(ParsingError::EbmlError(err)),
|
Err(err) => {
|
||||||
|
//println!("EBML error: {:?}", err);
|
||||||
|
return Err(ParsingError::EbmlError(err))
|
||||||
|
},
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
|
//println!("Need refill");
|
||||||
// need to refill buffer
|
// need to refill buffer
|
||||||
return Ok(Async::NotReady);
|
return Ok(Async::NotReady);
|
||||||
},
|
},
|
||||||
Ok(Some((element, element_size))) => {
|
Ok(Some((element, element_size))) => {
|
||||||
|
//println!("Parsed element: {:?}", element);
|
||||||
self.last_read = element_size;
|
self.last_read = element_size;
|
||||||
return Ok(Async::Ready(Some(element)))
|
return Ok(Async::Ready(Some(element)))
|
||||||
}
|
}
|
||||||
|
@ -63,6 +68,7 @@ impl<I: AsRef<[u8]>, S: Stream<Item = I>> WebmBuffer<S> {
|
||||||
Ok(Async::Ready(Some(chunk))) => {
|
Ok(Async::Ready(Some(chunk))) => {
|
||||||
self.buffer.reserve(chunk.as_ref().len());
|
self.buffer.reserve(chunk.as_ref().len());
|
||||||
self.buffer.put_slice(chunk.as_ref());
|
self.buffer.put_slice(chunk.as_ref());
|
||||||
|
//println!("Read {} into Buffer", chunk.as_ref().len());
|
||||||
// ok can retry decoding now
|
// ok can retry decoding now
|
||||||
}
|
}
|
||||||
Err(err) => return Err(ParsingError::OtherError(err))
|
Err(err) => return Err(ParsingError::OtherError(err))
|
||||||
|
|
Loading…
Reference in a new issue