summaryrefslogtreecommitdiff
path: root/pipewire
diff options
context:
space:
mode:
authorRobert Mader <robert.mader@collabora.com>2023-04-19 18:46:43 +0200
committerRobert Mader <robert.mader@posteo.de>2023-04-20 12:32:49 +0000
commit445ff6728b9d6e6007159b0baf9e24770f8c5a88 (patch)
tree28284f955084ab45c368c013ace2a978af218b83 /pipewire
parent34400d7d1686d53ceaf79ff1142349a1a171db68 (diff)
pipewire-[backend|plugin]: Add timestamps to buffers
In Pipewire and Gstreamer terminology Weston is a "live" source (as we do not explicitly set PW_KEY_STREAM_IS_LIVE to false). Such sources, be it compositors, cameras or microphones, usually set the current system time as timestamps on buffers in order to make life easier for consumers. Thus let's do so as well. This notably helps when recording using `gstpipewiresrc` with the `keepalive-time` property set. Signed-off-by: Robert Mader <robert.mader@collabora.com>
Diffstat (limited to 'pipewire')
-rw-r--r--pipewire/pipewire-plugin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pipewire/pipewire-plugin.c b/pipewire/pipewire-plugin.c
index 748ba492..cb07521a 100644
--- a/pipewire/pipewire-plugin.c
+++ b/pipewire/pipewire-plugin.c
@@ -192,7 +192,10 @@ pipewire_output_handle_frame(struct pipewire_output *output, int fd,
if ((h = spa_buffer_find_meta_data(spa_buffer, SPA_META_Header,
sizeof(struct spa_meta_header)))) {
- h->pts = -1;
+ struct timespec ts;
+
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ h->pts = SPA_TIMESPEC_TO_NSEC(&ts);
h->flags = 0;
h->seq = output->seq++;
h->dts_offset = 0;