pw-cat: keep our own time

Don't try to use the time from the io_position, it is updated in
the RT thread and might be slightly wrong for our purposes.
This commit is contained in:
Wim Taymans 2020-02-19 10:19:59 +01:00
parent ea911f2e3f
commit 7df66cd6ad

View file

@ -144,7 +144,7 @@ struct data {
struct spa_io_position *position; struct spa_io_position *position;
bool drained; bool drained;
uint64_t clock_start; uint64_t clock_time;
struct { struct {
int fd; int fd;
@ -968,11 +968,9 @@ static int midi_play(struct data *d, void *src, unsigned int n_frames)
spa_pod_builder_push_sequence(&b, &f, 0); spa_pod_builder_push_sequence(&b, &f, 0);
if (d->clock_start == 0) first_frame = d->clock_time;
d->clock_start = d->position->clock.position;
first_frame = d->position->clock.position - d->clock_start;
last_frame = first_frame + d->position->clock.duration; last_frame = first_frame + d->position->clock.duration;
d->clock_time = last_frame;
while (1) { while (1) {
uint32_t frame, offset; uint32_t frame, offset;