[alsa-devel] [PATCH 10/17] firewire-lib: Add transfer delay to synchronized duplex streams
Takashi Sakamoto
o-takashi at sakamocchi.jp
Sat Nov 23 07:07:57 CET 2013
Currently, when duplex streams with synchronization mode, this module just pass
'presentation timestamp' from transmitted packets to out packets. This is
enough to handle actual device but logically it should include 'transfer delay'
and 'processing time'. This means the timestamp in out packet should be at
future.
To be simple, this commit add only 'transfer delay'.
Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
sound/firewire/amdtp.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c
index d02ccac..bc21276 100644
--- a/sound/firewire/amdtp.c
+++ b/sound/firewire/amdtp.c
@@ -856,6 +856,15 @@ static void packet_sort(struct sort_table *tbl, unsigned int len)
} while (i < len);
}
+static inline void add_transfer_delay(struct amdtp_stream *s, unsigned int *syt)
+{
+ if (*syt != CIP_SYT_NO_INFO) {
+ *syt += (s->transfer_delay / TICKS_PER_CYCLE) << 12;
+ *syt += s->transfer_delay % TICKS_PER_CYCLE;
+ *syt &= CIP_SYT_MASK;
+ }
+}
+
static void out_stream_callback(struct fw_iso_context *context, u32 cycle,
size_t header_length, void *header,
void *private_data)
@@ -927,6 +936,7 @@ static void in_stream_callback(struct fw_iso_context *context, u32 cycle,
(s->flags & CIP_SYNC_TO_DEVICE) &&
s->sync_slave->callbacked) {
syt = be32_to_cpu(buffer[1]) & CIP_SYT_MASK;
+ add_transfer_delay(s, &syt);
handle_out_packet(s->sync_slave, syt);
}
handle_in_packet(s, tbl[i].payload_size / 4, buffer);
--
1.8.3.2
More information about the Alsa-devel
mailing list