Commit 693121bc authored by François Laignel's avatar François Laignel Committed by Sebastian Dröge

Buffer: fix instanstiation during deserialization

parent 90b046fb
......@@ -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());
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment