Skip to content

Commit

Permalink
screencast: set type of all planes, not only first plane
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferdi265 authored and columbarius committed Mar 22, 2023
1 parent 1a344b7 commit 6737c20
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/screencast/pipewire_screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ static void pwr_handle_stream_param_changed(void *data, uint32_t id,
static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {
struct xdpw_screencast_instance *cast = data;
struct spa_data *d;
enum spa_data_type t;

logprint(DEBUG, "pipewire: add buffer event handle");

Expand All @@ -347,17 +348,17 @@ static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {
// Select buffer type from negotiation result
if ((d[0].type & (1u << SPA_DATA_MemFd)) > 0) {
assert(cast->buffer_type == WL_SHM);
d[0].type = SPA_DATA_MemFd;
t = SPA_DATA_MemFd;
} else if ((d[0].type & (1u << SPA_DATA_DmaBuf)) > 0) {
assert(cast->buffer_type == DMABUF);
d[0].type = SPA_DATA_DmaBuf;
t = SPA_DATA_DmaBuf;
} else {
logprint(ERROR, "pipewire: unsupported buffer type");
cast->err = 1;
return;
}

logprint(TRACE, "pipewire: selected buffertype %u", d[0].type);
logprint(TRACE, "pipewire: selected buffertype %u", t);

struct xdpw_buffer *xdpw_buffer = xdpw_buffer_create(cast, cast->buffer_type, &cast->screencopy_frame_info[cast->buffer_type]);
if (xdpw_buffer == NULL) {
Expand All @@ -370,6 +371,7 @@ static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {

assert(xdpw_buffer->plane_count >= 0 && buffer->buffer->n_datas == (uint32_t)xdpw_buffer->plane_count);
for (uint32_t plane = 0; plane < buffer->buffer->n_datas; plane++) {
d[plane].type = t;
d[plane].maxsize = xdpw_buffer->size[plane];
d[plane].mapoffset = 0;
d[plane].chunk->size = xdpw_buffer->size[plane];
Expand Down

0 comments on commit 6737c20

Please sign in to comment.