#endif
libusb_set_iso_packet_lengths(iso_transfer, iso_packet_size);
- HashTable_Add(pdev->request_queue, (void*)(size_t)streamID, iso_transfer);
+ if ((HashTable_Contains(pdev->request_queue, (void*)(size_t)streamID)) ||
+ (HashTable_Add(pdev->request_queue, (void*)(size_t)streamID, iso_transfer) < 0))
+ {
+ WLog_Print(urbdrc->log, WLOG_WARN,
+ "Failed to queue iso transfer, streamID %08" PRIx32 " already in use!",
+ streamID);
+ async_transfer_user_data_free(user_data);
+ libusb_free_transfer(iso_transfer);
+ return -1;
+ }
return libusb_submit_transfer(iso_transfer);
}
#else
user_data->streamID = streamID;
#endif
- HashTable_Add(pdev->request_queue, (void*)(size_t)streamID, transfer);
+ if ((HashTable_Contains(pdev->request_queue, (void*)(size_t)streamID)) ||
+ (HashTable_Add(pdev->request_queue, (void*)(size_t)streamID, transfer) < 0))
+ {
+ WLog_Print(urbdrc->log, WLOG_WARN,
+ "Failed to queue transfer, streamID %08" PRIx32 " already in use!", streamID);
+ async_transfer_user_data_free(user_data);
+ libusb_free_transfer(transfer);
+ return -1;
+ }
return libusb_submit_transfer(transfer);
}