clock: set rate correctly

The ticks multiplied by the rate should give the time in seconds.
This commit is contained in:
Wim Taymans 2018-08-15 21:31:59 +02:00
parent d181574520
commit 26fa9eae39
5 changed files with 10 additions and 10 deletions

View file

@ -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;
}

View file

@ -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;
}