mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 11:31:06 +00:00
Buffer: fix instanstiation during deserialization
This commit is contained in:
parent
90b046fbcf
commit
693121bc55
1 changed files with 3 additions and 7 deletions
|
@ -50,12 +50,8 @@ struct BufferDe {
|
|||
}
|
||||
|
||||
impl From<BufferDe> for Buffer {
|
||||
fn from(mut buf_de: BufferDe) -> Self {
|
||||
// Move the `ByteBuff`'s byte array into the `gst::Buffer`
|
||||
// Are we really avoiding copies with that?
|
||||
let drained_buffer: &mut Vec<u8> = buf_de.buffer.as_mut();
|
||||
let mut buffer =
|
||||
Buffer::from_slice(drained_buffer.drain(..).collect::<Vec<u8>>()).unwrap();
|
||||
fn from(buf_de: BufferDe) -> Self {
|
||||
let mut buffer = Buffer::from_mut_slice(buf_de.buffer.to_vec()).unwrap();
|
||||
{
|
||||
let buffer = buffer.get_mut().unwrap();
|
||||
buffer.set_pts(buf_de.pts);
|
||||
|
@ -228,4 +224,4 @@ mod tests {
|
|||
assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue