mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-25 23:45:58 +01:00
screencast: drop imported PipeWire buffer on remove_buffer
PipeWire can request to destroy the allocated buffers anytime. This isn't a problem for us, since the screencopy protocol can handle disappearing buffers. The only thing we have to do is not to use a destroyed buffer.
This commit is contained in:
parent
66db43ea0e
commit
35cba50409
1 changed files with 7 additions and 0 deletions
|
@ -150,9 +150,16 @@ static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pwr_handle_stream_remove_buffer(void *data, struct pw_buffer *buffer) {
|
static void pwr_handle_stream_remove_buffer(void *data, struct pw_buffer *buffer) {
|
||||||
|
struct xdpw_screencast_instance *cast = data;
|
||||||
|
|
||||||
logprint(TRACE, "pipewire: remove buffer event handle");
|
logprint(TRACE, "pipewire: remove buffer event handle");
|
||||||
|
|
||||||
struct spa_data *d = buffer->buffer->datas;
|
struct spa_data *d = buffer->buffer->datas;
|
||||||
|
if (cast->current_frame.current_pw_buffer == buffer) {
|
||||||
|
logprint(TRACE, "pipewire: remove buffer currently in use");
|
||||||
|
cast->current_frame.current_pw_buffer = NULL;
|
||||||
|
cast->current_frame.buffer = NULL;
|
||||||
|
}
|
||||||
switch (d[0].type) {
|
switch (d[0].type) {
|
||||||
case SPA_DATA_MemFd:
|
case SPA_DATA_MemFd:
|
||||||
wl_buffer_destroy(buffer->user_data);
|
wl_buffer_destroy(buffer->user_data);
|
||||||
|
|
Loading…
Reference in a new issue