aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-11-24 12:36:37 +0900
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-11-24 12:45:20 +0900
commit618aea150ef1889871ed97b92c2d8446a9223eb6 (patch)
tree663c2e001973e4a3ce8cb9ea1c1766d93e33ae51
parent4fa8a249244593a6a6db15e8a0e2247715b6464b (diff)
downloadlibhinoko-618aea150ef1889871ed97b92c2d8446a9223eb6.tar.gz
fw_iso_rx_single: fix wrong calculation for length of available payload data
When the length of context header is greater than 8, the part of payload of isochronous packet is put into context header separated from context payload. The length of context header is the length of context header minus 8. In the case, the length of context payload is less than the length of payload of isochronous packet by the length of context header minus 8. Current implementation has wrong calculation for the length of context payload. When the length of context header is greater than 8, the result of calculation is always greater than actual length by 8. This commit fixes the bug. Fixes: 6887a02c07dc ("fw_iso_rx_single: add a method to retrieve packet payload for an abstract method") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--src/fw_iso_rx_single.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/fw_iso_rx_single.c b/src/fw_iso_rx_single.c
index a032e9a..cb8af63 100644
--- a/src/fw_iso_rx_single.c
+++ b/src/fw_iso_rx_single.c
@@ -407,6 +407,8 @@ void hinoko_fw_iso_rx_single_get_payload(HinokoFwIsoRxSingle *self, guint index,
pos = index * priv->header_size / 4;
iso_header = GUINT32_FROM_BE(priv->ev->header[pos]);
*length = ieee1394_iso_header_to_data_length(iso_header);
+ if (priv->header_size > 8)
+ *length -= priv->header_size - 8;
if (*length > bytes_per_chunk)
*length = bytes_per_chunk;