fix android bit rate

This commit is contained in:
csf
2022-06-01 17:52:21 +08:00
parent 20f6bdb8e7
commit 16fd96aa96
7 changed files with 51 additions and 21 deletions

View File

@@ -19,7 +19,7 @@ cfg_if! {
} else if #[cfg(dxgi)] {
mod dxgi;
pub use self::dxgi::*;
} else if #[cfg(android)] {
} else if #[cfg(target_os = "android")] {
mod android;
pub use self::android::*;
}else {
@@ -36,13 +36,11 @@ mod vpx;
#[inline]
pub fn would_block_if_equal(old: &mut Vec<u128>, b: &[u8]) -> std::io::Result<()> {
let b = unsafe {
std::slice::from_raw_parts::<u128>(b.as_ptr() as _, b.len() / 16)
};
let b = unsafe { std::slice::from_raw_parts::<u128>(b.as_ptr() as _, b.len() / 16) };
if b == &old[..] {
return Err(std::io::ErrorKind::WouldBlock.into());
}
old.resize(b.len(), 0);
old.copy_from_slice(b);
Ok(())
}
}