9 Mar
2014
9 Mar
'14
9:37 p.m.
Takashi Sakamoto wrote:
For capturing PCM, this commit adds the functionality to handle in-stream. This is also applied for dual-wire mode.
+++ b/sound/firewire/amdtp.c @@ -200,16 +208,26 @@ void amdtp_stream_set_pcm_format(struct amdtp_stream *s,
if (s->direction == AMDTP_OUT_STREAM) {
if (s->dual_wire)
s->transfer_samples = amdtp_write_s32_dualwire;
else
s->transfer_samples = amdtp_write_s32;
} else if (s->dual_wire) {
s->transfer_samples = amdtp_read_s32_dualwire;
} else {
s->transfer_samples = amdtp_read_s32;
}
Please format the if/else branches in the same way.
+static void handle_in_packet(struct amdtp_stream *s, ...
- /* ignore empty CIP packet or NO-DATA AMDTP packet */
- if ((payload_quadlets < 3) ||
(((cip_header[1] & CIP_FDF_MASK) >> CIP_FDF_SFC_SHIFT) ==
AMDTP_FDF_NO_DATA))
(AMDTP_FDF_NO_DATA << CIP_FDF_SFC_SHIFT) would be a constant that could be computed at compile time.
- /* check packet continuity */
- s->data_block_counter = (s->data_block_counter + data_blocks) & 0xff;
- if (s->data_block_counter != data_block_counter) {
dev_info_ratelimited(&s->unit->device,
"Detect uncontinuity of CIP packets\n");
s->data_block_counter = data_block_counter;
return;
In practice, this error means that a packet was dropped. I guess this doesn't actually happen too often, but eventually, we should handle this either by inserting some samples or by stopping the stream.
Regards, Clemens