diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index 0e953bf96..a3e0be964 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -72,7 +72,7 @@ impl Buffer { drop(slice); } - pub fn from_mut_slice + Send + 'static>(slice: T) -> Option { + pub fn from_mut_slice + Send + 'static>(slice: T) -> Self { assert_initialized_main_thread!(); unsafe { @@ -94,7 +94,7 @@ impl Buffer { } } - pub fn from_slice + Send + 'static>(slice: T) -> Option { + pub fn from_slice + Send + 'static>(slice: T) -> Self { assert_initialized_main_thread!(); unsafe { @@ -684,7 +684,7 @@ mod tests { fn test_writability() { ::init().unwrap(); - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let data = buffer.map_readable().unwrap(); assert_eq!(data.as_slice(), vec![1, 2, 3, 4].as_slice()); diff --git a/gstreamer/src/buffer_serde.rs b/gstreamer/src/buffer_serde.rs index 34c628f29..958e7a0a4 100644 --- a/gstreamer/src/buffer_serde.rs +++ b/gstreamer/src/buffer_serde.rs @@ -57,7 +57,7 @@ struct BufferDe { impl From for Buffer { fn from(buf_de: BufferDe) -> Self { - let mut buffer = Buffer::from_mut_slice(buf_de.buffer.to_vec()).unwrap(); + let mut buffer = Buffer::from_mut_slice(buf_de.buffer.to_vec()); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(buf_de.pts); @@ -90,7 +90,7 @@ mod tests { fn test_serialize() { ::init().unwrap(); - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(1.into()); @@ -230,7 +230,7 @@ mod tests { fn test_serde_roundtrip() { ::init().unwrap(); - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(1.into()); diff --git a/gstreamer/src/bufferlist_serde.rs b/gstreamer/src/bufferlist_serde.rs index 2b10782af..d6d82797c 100644 --- a/gstreamer/src/bufferlist_serde.rs +++ b/gstreamer/src/bufferlist_serde.rs @@ -80,7 +80,7 @@ mod tests { { let buffer_list = buffer_list.get_mut().unwrap(); - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(1.into()); @@ -90,7 +90,7 @@ mod tests { } buffer_list.add(buffer); - let mut buffer = Buffer::from_slice(vec![5, 6]).unwrap(); + let mut buffer = Buffer::from_slice(vec![5, 6]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(5.into()); @@ -196,7 +196,7 @@ mod tests { { let buffer_list = buffer_list.get_mut().unwrap(); - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(1.into()); @@ -206,7 +206,7 @@ mod tests { } buffer_list.add(buffer); - let mut buffer = Buffer::from_slice(vec![5, 6]).unwrap(); + let mut buffer = Buffer::from_slice(vec![5, 6]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(5.into()); diff --git a/gstreamer/src/sample_serde.rs b/gstreamer/src/sample_serde.rs index c3be5c8d7..1fe5953ef 100644 --- a/gstreamer/src/sample_serde.rs +++ b/gstreamer/src/sample_serde.rs @@ -93,7 +93,7 @@ mod tests { pretty_config.new_line = "".to_string(); let sample = { - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(1.into()); @@ -179,7 +179,7 @@ mod tests { ); let sample = { - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(1.into()); @@ -323,7 +323,7 @@ mod tests { // Segment present let sample = { - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_pts(1.into()); diff --git a/gstreamer/src/tags_serde.rs b/gstreamer/src/tags_serde.rs index dd388a0b9..e37c15d4f 100644 --- a/gstreamer/src/tags_serde.rs +++ b/gstreamer/src/tags_serde.rs @@ -270,7 +270,7 @@ mod tests { tags.add::(&::DateTime::new_ymd(2018, 5, 28), TagMergeMode::Append); let sample = { - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_offset(0); @@ -452,7 +452,7 @@ mod tests { tags.add::(&::DateTime::new_ymd(2018, 5, 28), TagMergeMode::Append); let sample = { - let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]).unwrap(); + let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]); { let buffer = buffer.get_mut().unwrap(); buffer.set_offset(0);