screencast: send pesentation timestamp via PipeWire

This commit is contained in:
columbarius 2022-06-01 01:08:52 +02:00 committed by Simon Ser
parent b5491df0c0
commit 0bbd652c1c
2 changed files with 4 additions and 2 deletions

View file

@ -409,12 +409,14 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) {
cast->err = 1;
}
logprint(TRACE, "********************");
struct spa_meta_header *h;
if ((h = spa_buffer_find_meta_data(spa_buf, SPA_META_Header, sizeof(*h)))) {
h->pts = -1;
h->pts = SPA_TIMESPEC_TO_NSEC(&cast->current_frame);
h->flags = buffer_corrupt ? SPA_META_HEADER_FLAG_CORRUPTED : 0;
h->seq = cast->seq++;
h->dts_offset = 0;
logprint(TRACE, "pipewire: timestamp %"PRId64, h->pts);
}
if (buffer_corrupt) {
@ -427,7 +429,6 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) {
}
}
logprint(TRACE, "********************");
for (uint32_t plane = 0; plane < spa_buf->n_datas; plane++) {
logprint(TRACE, "pipewire: plane %d", plane);
logprint(TRACE, "pipewire: fd %u", d[plane].fd);

View file

@ -217,6 +217,7 @@ static void wlr_frame_ready(void *data, struct zwlr_screencopy_frame_v1 *frame,
cast->current_frame.tv_sec = ((((uint64_t)tv_sec_hi) << 32) | tv_sec_lo);
cast->current_frame.tv_nsec = tv_nsec;
logprint(TRACE, "wlroots: timestamp %"PRIu64":%"PRIu32, cast->current_frame.tv_sec, cast->current_frame.tv_nsec);
cast->frame_state = XDPW_FRAME_STATE_SUCCESS;