mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
fix android get raw data (#8171)
If `std::ptr::copy_nonoverlapping` is not in `take`, it's not protected by the lock. Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -36,13 +36,7 @@ impl Capturer {
|
||||
|
||||
impl crate::TraitCapturer for Capturer {
|
||||
fn frame<'a>(&'a mut self, _timeout: Duration) -> io::Result<Frame<'a>> {
|
||||
if let Some(buf) = get_video_raw() {
|
||||
crate::would_block_if_equal(&mut self.saved_raw_data, buf)?;
|
||||
// Is it safe to directly return buf without copy?
|
||||
self.rgba.resize(buf.len(), 0);
|
||||
unsafe {
|
||||
std::ptr::copy_nonoverlapping(buf.as_ptr(), self.rgba.as_mut_ptr(), buf.len())
|
||||
};
|
||||
if get_video_raw(&mut self.rgba, &mut self.saved_raw_data).is_some() {
|
||||
Ok(Frame::PixelBuffer(PixelBuffer::new(
|
||||
&self.rgba,
|
||||
self.width(),
|
||||
|
||||
Reference in New Issue
Block a user