mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-16 21:05:15 +00:00
Fix up Adapter's WouldBlock error message
With the correct values of requested and available bytes.
This commit is contained in:
parent
9158c2c8e1
commit
768b68f94a
1 changed files with 9 additions and 9 deletions
|
@ -258,21 +258,21 @@ impl Adapter {
|
|||
|
||||
impl io::Read for Adapter {
|
||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
|
||||
let mut len = self.get_available();
|
||||
let mut len = self.size;
|
||||
|
||||
if len == 0 {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::WouldBlock,
|
||||
format!("Missing data: requesting {} but only got {}.",
|
||||
buf.len(), len)));
|
||||
}
|
||||
|
||||
if buf.len() < len {
|
||||
len = buf.len();
|
||||
}
|
||||
|
||||
if self.size == 0 {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::WouldBlock,
|
||||
format!("Missing data: requesting {} but only got {}.",
|
||||
len, self.size)));
|
||||
}
|
||||
|
||||
Self::copy_data(&self.deque, self.skip, buf, len);
|
||||
self.flush(len);
|
||||
self.flush(len).unwrap();
|
||||
Ok(len)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue