fix(android): a Linux gate that outlived its caller broke the build

`set_current_item` was `#[cfg(target_os = "linux")]` from when its caller was a
`#[cfg]` branch too. d3ecd8ee correctly replaced that branch with a runtime
question — "does this renderer draw the picture?" — which means the `else` arm
is now compiled on every platform, including ones where it never runs. The gate
stayed, so the Android build stopped compiling at that commit.

It went unnoticed because nothing built for Android afterwards. CI's Android
`cargo check` would have caught it; this branch has never been pushed.

Also adds the widget's allocation origin to the video-surface log. A GtkBox is
a no-window widget, so `widget.window()` is the parent's GdkWindow and the box
sits at an offset inside it; if `draw_from_gl` does not honour the cairo
translation GTK applied, the picture lands at the window origin instead of the
widget's — misaligned by exactly that offset, which is the shape of a letterbox
that does not line up. Logging the origin says whether that is what is
happening before anyone changes the geometry.
This commit is contained in:
2026-08-23 08:46:01 +02:00
parent d952a2ae55
commit 7d60f7ed9c
2 changed files with 19 additions and 2 deletions
+6 -1
View File
@@ -519,7 +519,12 @@ impl PlayerController {
/// Used on platforms where video is rendered outside the native backend /// Used on platforms where video is rendered outside the native backend
/// (Linux WebKitGTK HTML5 <video>): the queue/UI state must reflect the /// (Linux WebKitGTK HTML5 <video>): the queue/UI state must reflect the
/// item, but MPV must not start a redundant decode for it. /// item, but MPV must not start a redundant decode for it.
#[cfg(target_os = "linux")] ///
/// Not gated to Linux. Its caller stopped being a `#[cfg]` branch and became
/// a runtime question — "does this renderer draw the picture?" — so the
/// `else` arm is compiled on every platform even where it never runs. The
/// gate outliving its caller broke the Android build outright, which went
/// unnoticed because nothing built for Android afterwards.
pub fn set_current_item(&self, item: MediaItem) -> Result<(), PlayerError> { pub fn set_current_item(&self, item: MediaItem) -> Result<(), PlayerError> {
debug!( debug!(
"[PlayerController] set_current_item (no backend load): {}", "[PlayerController] set_current_item (no backend load): {}",
+13 -1
View File
@@ -377,7 +377,19 @@ fn draw(widget: &gtk::Box, cr: &gtk::cairo::Context, state: &Rc<RefCell<SurfaceS
if !s.logged_first_frame || s.logged_size != (width, height) { if !s.logged_first_frame || s.logged_size != (width, height) {
s.logged_first_frame = true; s.logged_first_frame = true;
s.logged_size = (width, height); s.logged_size = (width, height);
info!("[VideoSurface] rendering {width}x{height} (texture {texture})"); // The allocation *origin* matters as much as its size. A GtkBox is a
// no-window widget, so `widget.window()` is the parent's GdkWindow and
// the box sits at an offset inside it. `draw_from_gl` composites into
// that window; if it does not honour the cairo translation GTK applied
// for this widget, the picture lands at the window origin instead of
// the widget's — misaligned by exactly this offset, which is the shape
// of a letterbox that does not line up.
let alloc = widget.allocation();
info!(
"[VideoSurface] rendering {width}x{height} at widget origin ({}, {}) scale {scale} (texture {texture})",
alloc.x(),
alloc.y()
);
} }
unsafe { unsafe {