screencast: pipewire move buffer information from pwr_on_event to pwr_handle_stream_add_buffer

This commit is contained in:
columbarius 2020-10-26 03:22:06 +01:00 committed by Simon Ser
parent 03146fa1d7
commit 6a3832277f
1 changed files with 12 additions and 9 deletions

View File

@ -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);
@ -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;
}
}