Skip to content

Commit

Permalink
Adding change by @anatawa12 from
Browse files Browse the repository at this point in the history
  • Loading branch information
Type1J committed Dec 21, 2023
1 parent 8c1e5f4 commit e0675fd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/io/mmap/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,21 @@ impl<'a> Arena<'a> {
// each plane has to be mapped separately
let mut planes = Vec::new();
for plane in &v4l2_planes {
let length = if !self.buf_type.planar() {
v4l2_buf.length as usize
} else {
plane.length as usize
};
let ptr = v4l2::mmap(
ptr::null_mut(),
plane.length as usize,
length,
libc::PROT_READ | libc::PROT_WRITE,
libc::MAP_SHARED,
self.handle.fd(),
plane.m.mem_offset as libc::off_t,
)?;

planes.push(slice::from_raw_parts_mut::<u8>(
ptr as *mut u8, plane.length as usize
ptr as *mut u8, length,
));
}

Expand Down

0 comments on commit e0675fd

Please sign in to comment.