From 5eed00bb66e0476f3db85ec5312ad3722bd6523a Mon Sep 17 00:00:00 2001 From: columbarius Date: Thu, 19 Aug 2021 01:20:44 +0200 Subject: [PATCH] screencast: use asserts for fatal errors --- src/screencast/pipewire_screencast.c | 5 +---- src/screencast/wlr_screencast.c | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/screencast/pipewire_screencast.c b/src/screencast/pipewire_screencast.c index e48eedf..d85d795 100644 --- a/src/screencast/pipewire_screencast.c +++ b/src/screencast/pipewire_screencast.c @@ -201,10 +201,7 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) { struct pw_buffer *pw_buf = cast->current_frame.current_pw_buffer; bool buffer_corrupt = cast->frame_state != XDPW_FRAME_STATE_SUCCESS; - if (!pw_buf) { - logprint(TRACE, "pipewire: no pipewire buffer to queue"); - return; - } + assert(pw_buf); struct spa_buffer *spa_buf = pw_buf->buffer; struct spa_data *d = spa_buf->datas; diff --git a/src/screencast/wlr_screencast.c b/src/screencast/wlr_screencast.c index 4b24f15..fe89da6 100644 --- a/src/screencast/wlr_screencast.c +++ b/src/screencast/wlr_screencast.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "screencast.h" @@ -151,10 +152,7 @@ static void wlr_frame_buffer_done(void *data, return; } - if (cast->current_frame.buffer == NULL) { - logprint(ERROR, "wlroots: imported buffer doesn't contain a wlr_buffer"); - abort(); - } + assert(cast->current_frame.buffer); zwlr_screencopy_frame_v1_copy_with_damage(frame, cast->current_frame.buffer); logprint(TRACE, "wlroots: frame copied");