summaryrefslogtreecommitdiff
path: root/spa/plugins/bluez5/sco-source.c
diff options
context:
space:
mode:
Diffstat (limited to 'spa/plugins/bluez5/sco-source.c')
-rw-r--r--spa/plugins/bluez5/sco-source.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/spa/plugins/bluez5/sco-source.c b/spa/plugins/bluez5/sco-source.c
index 5d3dcf15..975247f9 100644
--- a/spa/plugins/bluez5/sco-source.c
+++ b/spa/plugins/bluez5/sco-source.c
@@ -335,6 +335,9 @@ static void sco_on_ready_read(struct spa_source *source)
}
datas = port->current_buffer->buf->datas;
+ /* update the current pts */
+ spa_system_clock_gettime(this->data_system, CLOCK_MONOTONIC, &this->now);
+
/* read */
size_read = read_data(this, (uint8_t *)datas[0].data + port->ready_offset, this->transport->read_mtu);
if (size_read < 0) {
@@ -353,6 +356,14 @@ static void sco_on_ready_read(struct spa_source *source)
this->sample_count += datas[0].chunk->size / port->frame_size;
spa_list_append(&port->ready, &port->current_buffer->link);
port->current_buffer = NULL;
+
+ if (this->clock) {
+ this->clock->nsec = SPA_TIMESPEC_TO_NSEC(&this->now);
+ this->clock->position = this->sample_count;
+ this->clock->delay = 0;
+ this->clock->rate_diff = 1.0f;
+ this->clock->next_nsec = this->clock->nsec;
+ }
}
/* done if there are no buffers ready */