closedcaption: Don't needlessly create a full-range subslice of a slice

This commit is contained in:
Sebastian Dröge 2021-03-25 22:59:14 +02:00
parent 9acacbb320
commit bb8931c39b
3 changed files with 3 additions and 3 deletions

View file

@ -118,7 +118,7 @@ Time Code Rate=30DF\r\n\
.unwrap();
let buf = {
let mut buf = gst::Buffer::from_mut_slice(Vec::from(&input[..]));
let mut buf = gst::Buffer::from_mut_slice(Vec::from(input));
let buf_ref = buf.get_mut().unwrap();
gst_video::VideoTimeCodeMeta::add(buf_ref, &tc);
buf_ref.set_pts(gst::ClockTime::from_seconds(0));

View file

@ -144,7 +144,7 @@ fn test_encode_multiple_packets() {
let mut buffers = input2
.chunks(2)
.map(move |bytes| {
let mut buf = gst::Buffer::from_mut_slice(Vec::from(&bytes[..]));
let mut buf = gst::Buffer::from_mut_slice(Vec::from(bytes));
let buf_ref = buf.get_mut().unwrap();
gst_video::VideoTimeCodeMeta::add(buf_ref, &t);
t.increment_frame();

View file

@ -157,7 +157,7 @@ fn test_timecodes() {
let mut checksum = 0u32;
let mut expected_timecode = valid_timecodes.pop_front().unwrap();
let buf = gst::Buffer::from_mut_slice(Vec::from(&data[..]));
let buf = gst::Buffer::from_mut_slice(Vec::from(data));
assert_eq!(h.push(buf), Ok(gst::FlowSuccess::Ok));
while let Some(buf) = h.try_pull() {
output_len += buf.get_size();