fix, mac hwcodec decoding align use dst_align (#8215)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-05-30 23:40:25 +08:00
committed by GitHub
Unverified
parent d4dda94e2a
commit 8919ea65e3
7 changed files with 114 additions and 246 deletions

View File

@@ -1052,7 +1052,7 @@ impl VideoHandler {
log::info!("new video handler for display #{_display}, format: {format:?}, luid: {luid:?}");
VideoHandler {
decoder: Decoder::new(format, luid),
rgb: ImageRgb::new(ImageFormat::ARGB, crate::get_dst_stride_rgba()),
rgb: ImageRgb::new(ImageFormat::ARGB, crate::get_dst_align_rgba()),
texture: std::ptr::null_mut(),
recorder: Default::default(),
record: false,
@@ -1105,7 +1105,7 @@ impl VideoHandler {
/// Reset the decoder, change format if it is Some
pub fn reset(&mut self, format: Option<CodecFormat>) {
#[cfg(target_os = "macos")]
self.rgb.set_stride(crate::get_dst_stride_rgba());
self.rgb.set_align(crate::get_dst_align_rgba());
let luid = Self::get_adapter_luid();
let format = format.unwrap_or(self.decoder.format());
self.decoder = Decoder::new(format, luid);

View File

@@ -1617,7 +1617,7 @@ fn read_custom_client_advanced_settings(
#[inline]
#[cfg(target_os = "macos")]
pub fn get_dst_stride_rgba() -> usize {
pub fn get_dst_align_rgba() -> usize {
// https://developer.apple.com/forums/thread/712709
// Memory alignment should be multiple of 64.
if crate::ui_interface::use_texture_render() {
@@ -1629,7 +1629,7 @@ pub fn get_dst_stride_rgba() -> usize {
#[inline]
#[cfg(not(target_os = "macos"))]
pub fn get_dst_stride_rgba() -> usize {
pub fn get_dst_align_rgba() -> usize {
1
}

View File

@@ -445,7 +445,7 @@ impl VideoRenderer {
rgba.raw.len() as _,
rgba.w as _,
rgba.h as _,
rgba.stride() as _,
rgba.align() as _,
)
};
}

View File

@@ -3,7 +3,6 @@ use crate::{
common::{is_keyboard_mode_supported, make_fd_to_json},
flutter::{
self, session_add, session_add_existed, session_start_, sessions, try_sync_peer_option,
FlutterHandler,
},
input::*,
ui_interface::{self, *},