From 0162a9956e8bd083632af36980edbdf576fb7a5d Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 17 Jul 2012 15:46:37 +0200 Subject: asr: Define payload packet size to make it easier to adjust if needed --- src/asr.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/asr.c') diff --git a/src/asr.c b/src/asr.c index 7b08f55..cfa8fb3 100644 --- a/src/asr.c +++ b/src/asr.c @@ -29,6 +29,7 @@ #define ASR_PORT 12345 #define ASR_BUFFER_SIZE 65536 +#define ASR_PAYLOAD_PACKET_SIZE 1450 int asr_open_with_timeout(idevice_t device, idevice_connection_t* asr) { int i = 0; @@ -161,7 +162,7 @@ int asr_perform_validation(idevice_connection_t asr, const char* filesystem) { packet_info = plist_new_dict(); plist_dict_insert_item(packet_info, "FEC Slice Stride", plist_new_uint(40)); - plist_dict_insert_item(packet_info, "Packet Payload Size", plist_new_uint(1450)); + plist_dict_insert_item(packet_info, "Packet Payload Size", plist_new_uint(ASR_PAYLOAD_PACKET_SIZE)); plist_dict_insert_item(packet_info, "Packets Per FEC", plist_new_uint(25)); plist_dict_insert_item(packet_info, "Payload", payload_info); plist_dict_insert_item(packet_info, "Stream ID", plist_new_uint(1)); @@ -263,7 +264,7 @@ int asr_handle_oob_data_request(idevice_connection_t asr, plist_t packet, FILE* int asr_send_payload(idevice_connection_t asr, const char* filesystem) { int i = 0; - char data[1450]; + char data[ASR_PAYLOAD_PACKET_SIZE]; FILE* file = NULL; uint32_t bytes = 0; uint32_t count = 0; @@ -279,9 +280,9 @@ int asr_send_payload(idevice_connection_t asr, const char* filesystem) { length = ftell(file); fseek(file, 0, SEEK_SET); - for(i = length; i > 0; i -= 1450) { - int size = 1450; - if (i < 1450) { + for(i = length; i > 0; i -= ASR_PAYLOAD_PACKET_SIZE) { + int size = ASR_PAYLOAD_PACKET_SIZE; + if (i < ASR_PAYLOAD_PACKET_SIZE) { size = i; } -- cgit v1.1-32-gdbae