mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
spa: use clock info
Use the port clock io area to get timing info and use this as the time in the graph when we wake up.
This commit is contained in:
parent
2b1b356455
commit
d3c203b744
10 changed files with 134 additions and 15 deletions
|
|
@ -911,6 +911,7 @@ static int spa_v4l2_set_format(struct impl *this, struct spa_video_info *format,
|
|||
SPA_PORT_INFO_FLAG_PHYSICAL |
|
||||
SPA_PORT_INFO_FLAG_TERMINAL;
|
||||
port->info.rate = streamparm.parm.capture.timeperframe.denominator;
|
||||
port->rate = *framerate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1156,14 +1157,13 @@ static int mmap_read(struct impl *this)
|
|||
if (xioctl(port->fd, VIDIOC_DQBUF, &buf) < 0)
|
||||
return -errno;
|
||||
|
||||
port->last_ticks = (int64_t) buf.timestamp.tv_sec * SPA_USEC_PER_SEC +
|
||||
(uint64_t) buf.timestamp.tv_usec;
|
||||
pts = port->last_ticks * 1000;
|
||||
pts = SPA_TIMEVAL_TO_TIME(&buf.timestamp);
|
||||
|
||||
if (buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC)
|
||||
port->last_monotonic = pts;
|
||||
else
|
||||
port->last_monotonic = SPA_TIME_INVALID;
|
||||
if (port->clock) {
|
||||
port->clock->nsec = pts;
|
||||
port->clock->rate = port->rate;
|
||||
port->clock->position = buf.sequence;
|
||||
}
|
||||
|
||||
b = &port->buffers[buf.index];
|
||||
if (b->h) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue