mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
clock: set rate correctly
The ticks multiplied by the rate should give the time in seconds.
This commit is contained in:
parent
d181574520
commit
26fa9eae39
5 changed files with 10 additions and 10 deletions
|
|
@ -571,7 +571,7 @@ static void alsa_on_playback_timeout_event(struct spa_source *source)
|
|||
|
||||
if (state->clock) {
|
||||
state->clock->nsec = SPA_TIMESPEC_TO_TIME(&state->now);
|
||||
state->clock->rate = SPA_FRACTION(state->rate, 1);
|
||||
state->clock->rate = SPA_FRACTION(1, state->rate);
|
||||
state->clock->position = state->sample_count;
|
||||
state->clock->delay = state->filled;
|
||||
}
|
||||
|
|
@ -643,7 +643,7 @@ static void alsa_on_capture_timeout_event(struct spa_source *source)
|
|||
|
||||
if (state->clock) {
|
||||
state->clock->nsec = SPA_TIMESPEC_TO_TIME(&state->now);
|
||||
state->clock->rate = SPA_FRACTION(state->rate, 1);
|
||||
state->clock->rate = SPA_FRACTION(1, state->rate);
|
||||
state->clock->position = state->sample_count;
|
||||
state->clock->delay = avail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -901,8 +901,8 @@ static int spa_v4l2_set_format(struct impl *this, struct spa_video_info *format,
|
|||
|
||||
size->width = fmt.fmt.pix.width;
|
||||
size->height = fmt.fmt.pix.height;
|
||||
framerate->num = streamparm.parm.capture.timeperframe.denominator;
|
||||
framerate->denom = streamparm.parm.capture.timeperframe.numerator;
|
||||
port->rate.denom = framerate->num = streamparm.parm.capture.timeperframe.denominator;
|
||||
port->rate.num = framerate->denom = streamparm.parm.capture.timeperframe.numerator;
|
||||
|
||||
port->fmt = fmt;
|
||||
port->info.flags = (port->export_buf ? SPA_PORT_INFO_FLAG_CAN_ALLOC_BUFFERS : 0) |
|
||||
|
|
@ -911,7 +911,6 @@ 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -342,8 +342,7 @@ static void reconfigure_session(struct session *sess)
|
|||
|
||||
sess->quantum_size = quantum_size;
|
||||
|
||||
sess->node->rt.quantum->rate.num = 1;
|
||||
sess->node->rt.quantum->rate.denom = sess->sample_rate;
|
||||
sess->node->rt.quantum->rate = SPA_FRACTION(1, sess->sample_rate);
|
||||
sess->node->rt.quantum->size = sess->quantum_size;
|
||||
|
||||
pw_log_info("module %p: driver node:%p quantum:%d/%d",
|
||||
|
|
|
|||
|
|
@ -644,8 +644,9 @@ static void node_process(void *data, int status)
|
|||
}
|
||||
impl->next_position += q->size;
|
||||
|
||||
pw_log_trace("node %p: run %"PRIu64" %"PRIu64" %"PRIi64" %d", node,
|
||||
q->nsec, q->position, q->delay, q->size);
|
||||
pw_log_trace("node %p: run %"PRIu64" %d/%d %"PRIu64" %"PRIi64" %d", node,
|
||||
q->nsec, q->rate.num, q->rate.denom,
|
||||
q->position, q->delay, q->size);
|
||||
|
||||
spa_graph_run(node->rt.driver);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1140,7 +1140,8 @@ int pw_stream_get_time(struct pw_stream *stream, struct pw_time *time)
|
|||
else
|
||||
time->queued = (int64_t)(impl->queued.incount - time->queued);
|
||||
|
||||
pw_log_trace("%ld %d/%d %ld", time->ticks, time->rate.num, time->rate.denom, time->queued);
|
||||
pw_log_trace("%ld %ld %d/%d %ld",
|
||||
time->now, time->ticks, time->rate.num, time->rate.denom, time->queued);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue