screencast: re-negotiate format/modifier when size changes
This commit is contained in:
parent
b91c42aa38
commit
9595cc43ec
3 changed files with 46 additions and 20 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- Needs jay-compositor release.
|
||||||
|
|
||||||
# 1.9.0
|
# 1.9.0
|
||||||
|
|
||||||
- Needs jay-compositor release.
|
- Needs jay-compositor release.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- Various bugfixes.
|
||||||
|
|
||||||
# 1.9.0 (2025-01-27)
|
# 1.9.0 (2025-01-27)
|
||||||
|
|
||||||
This release replaces xkbcommon by the kbvm crate.
|
This release replaces xkbcommon by the kbvm crate.
|
||||||
|
|
|
||||||
|
|
@ -181,24 +181,7 @@ impl PwClientNodeOwner for StartingScreencast {
|
||||||
modifiers: vec![LINEAR_MODIFIER],
|
modifiers: vec![LINEAR_MODIFIER],
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
if let Some(ctx) = self.dpy.render_ctx.get() {
|
init_supported_formats(&mut supported_formats, &self.dpy);
|
||||||
if let Some(server_formats) = &ctx.server_formats {
|
|
||||||
supported_formats.formats.clear();
|
|
||||||
for format in server_formats.values() {
|
|
||||||
if format.write_modifiers.is_empty() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if format.format.pipewire == SPA_VIDEO_FORMAT_UNKNOWN {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let ptl_format = PwClientNodePortSupportedFormat {
|
|
||||||
format: format.format,
|
|
||||||
modifiers: format.write_modifiers.keys().copied().collect(),
|
|
||||||
};
|
|
||||||
supported_formats.formats.push(ptl_format);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let jsc_version = self.dpy.jc.version;
|
let jsc_version = self.dpy.jc.version;
|
||||||
let num_buffers = (jsc_version >= CLIENT_BUFFERS_SINCE).then_some(3);
|
let num_buffers = (jsc_version >= CLIENT_BUFFERS_SINCE).then_some(3);
|
||||||
let port = self.node.create_port(true, supported_formats, num_buffers);
|
let port = self.node.create_port(true, supported_formats, num_buffers);
|
||||||
|
|
@ -276,6 +259,12 @@ impl PwClientNodeOwner for StartedScreencast {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
log::debug!(
|
||||||
|
"Negotiated format {} with modifier 0x{modifier:08x} at size {}x{}",
|
||||||
|
fmt.name,
|
||||||
|
self.width.get(),
|
||||||
|
self.height.get(),
|
||||||
|
);
|
||||||
self.port.supported_formats.borrow_mut().formats = vec![PwClientNodePortSupportedFormat {
|
self.port.supported_formats.borrow_mut().formats = vec![PwClientNodePortSupportedFormat {
|
||||||
format: fmt,
|
format: fmt,
|
||||||
modifiers: vec![modifier],
|
modifiers: vec![modifier],
|
||||||
|
|
@ -701,17 +690,50 @@ impl UsrJayScreencastOwner for StartedScreencast {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn config(&self, config: UsrJayScreencastServerConfig) {
|
fn config(&self, config: UsrJayScreencastServerConfig) {
|
||||||
self.width.set(config.width.max(1));
|
let mut changed = false;
|
||||||
self.height.set(config.height.max(1));
|
let width = config.width.max(1);
|
||||||
|
let height = config.height.max(1);
|
||||||
|
changed |= self.width.replace(width) != width;
|
||||||
|
changed |= self.height.replace(height) != height;
|
||||||
self.port.supported_formats.borrow_mut().video_size = Some(PwPodRectangle {
|
self.port.supported_formats.borrow_mut().video_size = Some(PwPodRectangle {
|
||||||
width: self.width.get() as _,
|
width: self.width.get() as _,
|
||||||
height: self.height.get() as _,
|
height: self.height.get() as _,
|
||||||
});
|
});
|
||||||
|
if changed && self.dpy.jc.version >= CLIENT_BUFFERS_SINCE {
|
||||||
|
self.fixated.set(false);
|
||||||
|
init_supported_formats(&mut self.port.supported_formats.borrow_mut(), &self.dpy);
|
||||||
|
}
|
||||||
self.node.send_port_update(&self.port, self.fixated.get());
|
self.node.send_port_update(&self.port, self.fixated.get());
|
||||||
self.node.send_active(true);
|
self.node.send_active(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn init_supported_formats(
|
||||||
|
supported_formats: &mut PwClientNodePortSupportedFormats,
|
||||||
|
dpy: &PortalDisplay,
|
||||||
|
) {
|
||||||
|
let Some(ctx) = dpy.render_ctx.get() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let Some(server_formats) = &ctx.server_formats else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
supported_formats.formats.clear();
|
||||||
|
for format in server_formats.values() {
|
||||||
|
if format.write_modifiers.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if format.format.pipewire == SPA_VIDEO_FORMAT_UNKNOWN {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let ptl_format = PwClientNodePortSupportedFormat {
|
||||||
|
format: format.format,
|
||||||
|
modifiers: format.write_modifiers.keys().copied().collect(),
|
||||||
|
};
|
||||||
|
supported_formats.formats.push(ptl_format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl UsrLinuxBufferParamsOwner for StartedScreencast {
|
impl UsrLinuxBufferParamsOwner for StartedScreencast {
|
||||||
fn created(&self, buffer: Rc<UsrWlBuffer>) {
|
fn created(&self, buffer: Rc<UsrWlBuffer>) {
|
||||||
self.buffers_valid.set(true);
|
self.buffers_valid.set(true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue