diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 868be9bfd..6c582b7ba 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -1036,7 +1036,7 @@ static int impl_node_process_input(void *object) struct stream *impl = object; struct pw_stream *stream = &impl->this; struct spa_io_buffers *io = impl->io; - struct buffer *b; + struct buffer *b = NULL; if (io == NULL) return -EIO; @@ -1055,6 +1055,8 @@ static int impl_node_process_input(void *object) } copy_position(impl, impl->dequeued.incount); + if (b != NULL) + b->this.time = impl->time.now; if (!queue_is_empty(impl, &impl->dequeued)) call_process(impl); diff --git a/src/pipewire/stream.h b/src/pipewire/stream.h index 51668642c..9f44e821a 100644 --- a/src/pipewire/stream.h +++ b/src/pipewire/stream.h @@ -187,7 +187,7 @@ enum pw_stream_state { }; /** a buffer structure obtained from pw_stream_dequeue_buffer(). The size of this - * structure can grow as more field are added in the future */ + * structure can grow as more fields are added in the future */ struct pw_buffer { struct spa_buffer *buffer; /**< the spa buffer */ void *user_data; /**< user data attached to the buffer. The user of @@ -197,7 +197,7 @@ struct pw_buffer { * event. The user data is returned unmodified each * time a buffer is dequeued. */ uint64_t size; /**< This field is set by the user and the sum of - * all queued buffer is returned in the time info. + * all queued buffers is returned in the time info. * For audio, it is advised to use the number of * samples in the buffer for this field. */ uint64_t requested; /**< For playback streams, this field contains the @@ -205,6 +205,11 @@ struct pw_buffer { * streams this will be the amount of samples * required by the resampler. This field is 0 * when no suggestion is provided. Since 0.3.49 */ + uint64_t time; /**< For capture streams, this field contains the + * cycle time in nanoseconds when this buffer was + * queued in the stream. It can be compared against + * the pw_time values or pw_stream_get_nsec() + * Since 1.0.5 */ }; struct pw_stream_control {