Skip to content

Commit

Permalink
screencast: pipewire move buffer information from pwr_on_event to pwr…
Browse files Browse the repository at this point in the history
…_handle_stream_add_buffer
  • Loading branch information
columbarius committed Jul 2, 2021
1 parent f02bb49 commit fbef279
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/screencast/pipewire_screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ static void pwr_on_event(void *data, uint64_t expirations) {
h->dts_offset = 0;
}

d[0].type = SPA_DATA_MemPtr;
d[0].maxsize = cast->simple_frame.size;
d[0].mapoffset = 0;
d[0].chunk->size = cast->simple_frame.size;
d[0].chunk->stride = cast->simple_frame.stride;
d[0].chunk->offset = 0;
d[0].flags = 0;
d[0].fd = -1;

writeFrameData(d[0].data, cast->simple_frame.data, cast->simple_frame.height,
cast->simple_frame.stride, cast->simple_frame.y_invert);

Expand Down Expand Up @@ -178,6 +169,18 @@ static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {
} else {
logprint(ERROR, "pipewire: unsupported buffer type");
cast->err = 1;
return;
}

// Prepare buffer for choosen type
if (d[0].type == SPA_DATA_MemPtr) {
d[0].maxsize = cast->simple_frame.size;
d[0].mapoffset = 0;
d[0].chunk->size = cast->simple_frame.size;
d[0].chunk->stride = cast->simple_frame.stride;
d[0].chunk->offset = 0;
d[0].flags = 0;
d[0].fd = -1;
}
}

Expand Down

0 comments on commit fbef279

Please sign in to comment.