mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-30 05:21:05 +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 {
|
impl From<BufferDe> for Buffer {
|
||||||
fn from(mut buf_de: BufferDe) -> Self {
|
fn from(buf_de: BufferDe) -> Self {
|
||||||
// Move the `ByteBuff`'s byte array into the `gst::Buffer`
|
let mut buffer = Buffer::from_mut_slice(buf_de.buffer.to_vec()).unwrap();
|
||||||
// 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();
|
|
||||||
{
|
{
|
||||||
let buffer = buffer.get_mut().unwrap();
|
let buffer = buffer.get_mut().unwrap();
|
||||||
buffer.set_pts(buf_de.pts);
|
buffer.set_pts(buf_de.pts);
|
||||||
|
|
Loading…
Reference in a new issue