mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
Lots of little cosmetic cleanups
This commit is contained in:
@@ -98,9 +98,13 @@
|
|||||||
#include <spandsp/v29tx.h>
|
#include <spandsp/v29tx.h>
|
||||||
#include <spandsp/v17rx.h>
|
#include <spandsp/v17rx.h>
|
||||||
#include <spandsp/v17tx.h>
|
#include <spandsp/v17tx.h>
|
||||||
|
#include <spandsp/v32bis.h>
|
||||||
#include <spandsp/v22bis.h>
|
#include <spandsp/v22bis.h>
|
||||||
#include <spandsp/v27ter_rx.h>
|
#include <spandsp/v27ter_rx.h>
|
||||||
#include <spandsp/v27ter_tx.h>
|
#include <spandsp/v27ter_tx.h>
|
||||||
|
#if defined(SPANDSP_SUPPORT_V34)
|
||||||
|
#include <spandsp/v34.h>
|
||||||
|
#endif
|
||||||
#include <spandsp/v18.h>
|
#include <spandsp/v18.h>
|
||||||
#include <spandsp/timezone.h>
|
#include <spandsp/timezone.h>
|
||||||
#include <spandsp/t4_rx.h>
|
#include <spandsp/t4_rx.h>
|
||||||
|
@@ -274,7 +274,8 @@ extern "C"
|
|||||||
__inline float rintf(float flt)
|
__inline float rintf(float flt)
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{ fld flt
|
{
|
||||||
|
fld flt
|
||||||
frndint
|
frndint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,6 @@ SPAN_DECLARE(void) t81_t82_arith_encode(t81_t82_arith_encode_state_t *s, int cx,
|
|||||||
|
|
||||||
SPAN_DECLARE(void) t81_t82_arith_encode_flush(t81_t82_arith_encode_state_t *s);
|
SPAN_DECLARE(void) t81_t82_arith_encode_flush(t81_t82_arith_encode_state_t *s);
|
||||||
|
|
||||||
|
|
||||||
SPAN_DECLARE(t81_t82_arith_decode_state_t *) t81_t82_arith_decode_init(t81_t82_arith_decode_state_t *s);
|
SPAN_DECLARE(t81_t82_arith_decode_state_t *) t81_t82_arith_decode_init(t81_t82_arith_decode_state_t *s);
|
||||||
|
|
||||||
SPAN_DECLARE(int) t81_t82_arith_decode_restart(t81_t82_arith_decode_state_t *s, int reuse_st);
|
SPAN_DECLARE(int) t81_t82_arith_decode_restart(t81_t82_arith_decode_state_t *s, int reuse_st);
|
||||||
|
@@ -278,7 +278,6 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max
|
|||||||
tree = s->levels[--s->level];
|
tree = s->levels[--s->level];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return samples;
|
return samples;
|
||||||
}
|
}
|
||||||
|
@@ -1105,6 +1105,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
|
|||||||
span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message);
|
span_log(logging, SPAN_LOG_FLOW, "%s\n", escape.error_message);
|
||||||
else
|
else
|
||||||
span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n");
|
span_log(logging, SPAN_LOG_FLOW, "Unspecified libjpeg error.\n");
|
||||||
|
printf("Error %s.\n", escape.error_message);
|
||||||
if (scan_line_out)
|
if (scan_line_out)
|
||||||
free(scan_line_out);
|
free(scan_line_out);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
@@ -1134,14 +1135,17 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
|
|||||||
if (!is_itu_fax(logging, s, decompressor.marker_list))
|
if (!is_itu_fax(logging, s, decompressor.marker_list))
|
||||||
{
|
{
|
||||||
span_log(logging, SPAN_LOG_FLOW, "Is not an ITU FAX.\n");
|
span_log(logging, SPAN_LOG_FLOW, "Is not an ITU FAX.\n");
|
||||||
return FALSE;
|
printf("Is not an ITU FAX 1.\n");
|
||||||
|
//return FALSE;
|
||||||
}
|
}
|
||||||
/* Copy size, resolution, etc */
|
/* Copy size, resolution, etc */
|
||||||
*width = decompressor.image_width;
|
*width = decompressor.image_width;
|
||||||
*height = decompressor.image_height;
|
*height = decompressor.image_height;
|
||||||
|
printf("Is %d x %d\n", decompressor.image_width, decompressor.image_height);
|
||||||
|
|
||||||
jpeg_start_decompress(&decompressor);
|
jpeg_start_decompress(&decompressor);
|
||||||
|
|
||||||
|
printf("Is %d x %d x %d.\n", decompressor.output_width, decompressor.output_height, decompressor.num_components);
|
||||||
if ((scan_line_in = (JSAMPROW) malloc(decompressor.output_width*decompressor.num_components)) == NULL)
|
if ((scan_line_in = (JSAMPROW) malloc(decompressor.output_width*decompressor.num_components)) == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -1151,6 +1155,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
|
|||||||
jpeg_read_scanlines(&decompressor, &scan_line_in, 1);
|
jpeg_read_scanlines(&decompressor, &scan_line_in, 1);
|
||||||
lab_to_srgb(s, scan_line_out, scan_line_in, decompressor.output_width);
|
lab_to_srgb(s, scan_line_out, scan_line_in, decompressor.output_width);
|
||||||
}
|
}
|
||||||
|
printf("Next %d\n", decompressor.output_scanline);
|
||||||
|
|
||||||
free(scan_line_in);
|
free(scan_line_in);
|
||||||
jpeg_finish_decompress(&decompressor);
|
jpeg_finish_decompress(&decompressor);
|
||||||
@@ -1159,6 +1164,7 @@ SPAN_DECLARE(int) t42_itulab_to_srgb(logging_state_t *logging, lab_params_t *s,
|
|||||||
|
|
||||||
*dstlen = pos;
|
*dstlen = pos;
|
||||||
|
|
||||||
|
printf("Next2 %d\n", decompressor.output_scanline);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
@@ -75,7 +75,6 @@ static __inline__ int flag_is_changeable_p(uint32_t flag)
|
|||||||
" popfl\n"
|
" popfl\n"
|
||||||
: "=&r" (f1), "=&r" (f2)
|
: "=&r" (f1), "=&r" (f2)
|
||||||
: "ir" (flag));
|
: "ir" (flag));
|
||||||
|
|
||||||
return ((f1^f2) & flag) != 0;
|
return ((f1^f2) & flag) != 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
@@ -23,10 +23,6 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED.
|
|
||||||
Currently it performs the core compression and decompression functions OK.
|
|
||||||
However, a number of the bells and whistles in V.42bis are incomplete. */
|
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
#if defined(HAVE_CONFIG_H)
|
||||||
|
@@ -83,189 +83,189 @@ struct
|
|||||||
T4_X_RESOLUTION_R8,
|
T4_X_RESOLUTION_R8,
|
||||||
T4_Y_RESOLUTION_FINE,
|
T4_Y_RESOLUTION_FINE,
|
||||||
T4_WIDTH_R8_A4,
|
T4_WIDTH_R8_A4,
|
||||||
2200
|
1100*2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R8_77_B4.tif",
|
"R8_77_B4.tif",
|
||||||
T4_X_RESOLUTION_R8,
|
T4_X_RESOLUTION_R8,
|
||||||
T4_Y_RESOLUTION_FINE,
|
T4_Y_RESOLUTION_FINE,
|
||||||
T4_WIDTH_R8_B4,
|
T4_WIDTH_R8_B4,
|
||||||
2400
|
1200*2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R8_77_A3.tif",
|
"R8_77_A3.tif",
|
||||||
T4_X_RESOLUTION_R8,
|
T4_X_RESOLUTION_R8,
|
||||||
T4_Y_RESOLUTION_FINE,
|
T4_Y_RESOLUTION_FINE,
|
||||||
T4_WIDTH_R8_A3,
|
T4_WIDTH_R8_A3,
|
||||||
3111
|
1556*2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R8_154_A4.tif",
|
"R8_154_A4.tif",
|
||||||
T4_X_RESOLUTION_R8,
|
T4_X_RESOLUTION_R8,
|
||||||
T4_Y_RESOLUTION_SUPERFINE,
|
T4_Y_RESOLUTION_SUPERFINE,
|
||||||
T4_WIDTH_R8_A4,
|
T4_WIDTH_R8_A4,
|
||||||
4400
|
1100*4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R8_154_B4.tif",
|
"R8_154_B4.tif",
|
||||||
T4_X_RESOLUTION_R8,
|
T4_X_RESOLUTION_R8,
|
||||||
T4_Y_RESOLUTION_SUPERFINE,
|
T4_Y_RESOLUTION_SUPERFINE,
|
||||||
T4_WIDTH_R8_B4,
|
T4_WIDTH_R8_B4,
|
||||||
4800
|
1200*4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R8_154_A3.tif",
|
"R8_154_A3.tif",
|
||||||
T4_X_RESOLUTION_R8,
|
T4_X_RESOLUTION_R8,
|
||||||
T4_Y_RESOLUTION_SUPERFINE,
|
T4_Y_RESOLUTION_SUPERFINE,
|
||||||
T4_WIDTH_R8_A3,
|
T4_WIDTH_R8_A3,
|
||||||
6222
|
1556*4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R300_300_A4.tif",
|
"R300_300_A4.tif",
|
||||||
T4_X_RESOLUTION_300,
|
T4_X_RESOLUTION_300,
|
||||||
T4_Y_RESOLUTION_300,
|
T4_Y_RESOLUTION_300,
|
||||||
T4_WIDTH_300_A4,
|
T4_WIDTH_300_A4,
|
||||||
4400
|
1100*3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R300_300_B4.tif",
|
"R300_300_B4.tif",
|
||||||
T4_X_RESOLUTION_300,
|
T4_X_RESOLUTION_300,
|
||||||
T4_Y_RESOLUTION_300,
|
T4_Y_RESOLUTION_300,
|
||||||
T4_WIDTH_300_B4,
|
T4_WIDTH_300_B4,
|
||||||
4800
|
1200*3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R300_300_A3.tif",
|
"R300_300_A3.tif",
|
||||||
T4_X_RESOLUTION_300,
|
T4_X_RESOLUTION_300,
|
||||||
T4_Y_RESOLUTION_300,
|
T4_Y_RESOLUTION_300,
|
||||||
T4_WIDTH_300_A3,
|
T4_WIDTH_300_A3,
|
||||||
6222
|
1556*3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R300_600_A4.tif",
|
"R300_600_A4.tif",
|
||||||
T4_X_RESOLUTION_300,
|
T4_X_RESOLUTION_300,
|
||||||
T4_Y_RESOLUTION_600,
|
T4_Y_RESOLUTION_600,
|
||||||
T4_WIDTH_300_A4,
|
T4_WIDTH_300_A4,
|
||||||
4400
|
1100*6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R300_600_B4.tif",
|
"R300_600_B4.tif",
|
||||||
T4_X_RESOLUTION_300,
|
T4_X_RESOLUTION_300,
|
||||||
T4_Y_RESOLUTION_600,
|
T4_Y_RESOLUTION_600,
|
||||||
T4_WIDTH_300_B4,
|
T4_WIDTH_300_B4,
|
||||||
4800
|
1200*6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R300_600_A3.tif",
|
"R300_600_A3.tif",
|
||||||
T4_X_RESOLUTION_300,
|
T4_X_RESOLUTION_300,
|
||||||
T4_Y_RESOLUTION_600,
|
T4_Y_RESOLUTION_600,
|
||||||
T4_WIDTH_300_A3,
|
T4_WIDTH_300_A3,
|
||||||
6222
|
1556*6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R16_154_A4.tif",
|
"R16_154_A4.tif",
|
||||||
T4_X_RESOLUTION_R16,
|
T4_X_RESOLUTION_R16,
|
||||||
T4_Y_RESOLUTION_SUPERFINE,
|
T4_Y_RESOLUTION_SUPERFINE,
|
||||||
T4_WIDTH_R16_A4,
|
T4_WIDTH_R16_A4,
|
||||||
4400
|
1100*4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R16_154_B4.tif",
|
"R16_154_B4.tif",
|
||||||
T4_X_RESOLUTION_R16,
|
T4_X_RESOLUTION_R16,
|
||||||
T4_Y_RESOLUTION_SUPERFINE,
|
T4_Y_RESOLUTION_SUPERFINE,
|
||||||
T4_WIDTH_R16_B4,
|
T4_WIDTH_R16_B4,
|
||||||
4800
|
1200*4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R16_154_A3.tif",
|
"R16_154_A3.tif",
|
||||||
T4_X_RESOLUTION_R16,
|
T4_X_RESOLUTION_R16,
|
||||||
T4_Y_RESOLUTION_SUPERFINE,
|
T4_Y_RESOLUTION_SUPERFINE,
|
||||||
T4_WIDTH_R16_A3,
|
T4_WIDTH_R16_A3,
|
||||||
6222
|
1556*4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R16_800_A4.tif",
|
"R16_800_A4.tif",
|
||||||
T4_X_RESOLUTION_R16,
|
T4_X_RESOLUTION_R16,
|
||||||
T4_Y_RESOLUTION_800,
|
T4_Y_RESOLUTION_800,
|
||||||
T4_WIDTH_R16_A4,
|
T4_WIDTH_R16_A4,
|
||||||
4400
|
1100*8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R16_800_B4.tif",
|
"R16_800_B4.tif",
|
||||||
T4_X_RESOLUTION_R16,
|
T4_X_RESOLUTION_R16,
|
||||||
T4_Y_RESOLUTION_800,
|
T4_Y_RESOLUTION_800,
|
||||||
T4_WIDTH_R16_B4,
|
T4_WIDTH_R16_B4,
|
||||||
4800
|
1200*8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R16_800_A3.tif",
|
"R16_800_A3.tif",
|
||||||
T4_X_RESOLUTION_R16,
|
T4_X_RESOLUTION_R16,
|
||||||
T4_Y_RESOLUTION_800,
|
T4_Y_RESOLUTION_800,
|
||||||
T4_WIDTH_R16_A3,
|
T4_WIDTH_R16_A3,
|
||||||
6222
|
1556*8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R600_600_A4.tif",
|
"R600_600_A4.tif",
|
||||||
T4_X_RESOLUTION_600,
|
T4_X_RESOLUTION_600,
|
||||||
T4_Y_RESOLUTION_600,
|
T4_Y_RESOLUTION_600,
|
||||||
T4_WIDTH_600_A4,
|
T4_WIDTH_600_A4,
|
||||||
4400
|
1100*6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R600_600_B4.tif",
|
"R600_600_B4.tif",
|
||||||
T4_X_RESOLUTION_600,
|
T4_X_RESOLUTION_600,
|
||||||
T4_Y_RESOLUTION_600,
|
T4_Y_RESOLUTION_600,
|
||||||
T4_WIDTH_600_B4,
|
T4_WIDTH_600_B4,
|
||||||
4800
|
1200*6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R600_600_A3.tif",
|
"R600_600_A3.tif",
|
||||||
T4_X_RESOLUTION_600,
|
T4_X_RESOLUTION_600,
|
||||||
T4_Y_RESOLUTION_600,
|
T4_Y_RESOLUTION_600,
|
||||||
T4_WIDTH_600_A3,
|
T4_WIDTH_600_A3,
|
||||||
6222
|
1556*6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R600_1200_A4.tif",
|
"R600_1200_A4.tif",
|
||||||
T4_X_RESOLUTION_600,
|
T4_X_RESOLUTION_600,
|
||||||
T4_Y_RESOLUTION_1200,
|
T4_Y_RESOLUTION_1200,
|
||||||
T4_WIDTH_600_A4,
|
T4_WIDTH_600_A4,
|
||||||
4400
|
1100*12
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R600_1200_B4.tif",
|
"R600_1200_B4.tif",
|
||||||
T4_X_RESOLUTION_600,
|
T4_X_RESOLUTION_600,
|
||||||
T4_Y_RESOLUTION_1200,
|
T4_Y_RESOLUTION_1200,
|
||||||
T4_WIDTH_600_B4,
|
T4_WIDTH_600_B4,
|
||||||
4800
|
1200*12
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R600_1200_A3.tif",
|
"R600_1200_A3.tif",
|
||||||
T4_X_RESOLUTION_600,
|
T4_X_RESOLUTION_600,
|
||||||
T4_Y_RESOLUTION_1200,
|
T4_Y_RESOLUTION_1200,
|
||||||
T4_WIDTH_600_A3,
|
T4_WIDTH_600_A3,
|
||||||
6222
|
1556*12
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R1200_1200_A4.tif",
|
"R1200_1200_A4.tif",
|
||||||
T4_X_RESOLUTION_1200,
|
T4_X_RESOLUTION_1200,
|
||||||
T4_Y_RESOLUTION_1200,
|
T4_Y_RESOLUTION_1200,
|
||||||
T4_WIDTH_1200_A4,
|
T4_WIDTH_1200_A4,
|
||||||
4400
|
1100*12
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R1200_1200_B4.tif",
|
"R1200_1200_B4.tif",
|
||||||
T4_X_RESOLUTION_1200,
|
T4_X_RESOLUTION_1200,
|
||||||
T4_Y_RESOLUTION_1200,
|
T4_Y_RESOLUTION_1200,
|
||||||
T4_WIDTH_1200_B4,
|
T4_WIDTH_1200_B4,
|
||||||
4800
|
1200*12
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"R1200_1200_A3.tif",
|
"R1200_1200_A3.tif",
|
||||||
T4_X_RESOLUTION_1200,
|
T4_X_RESOLUTION_1200,
|
||||||
T4_Y_RESOLUTION_1200,
|
T4_Y_RESOLUTION_1200,
|
||||||
T4_WIDTH_1200_A3,
|
T4_WIDTH_1200_A3,
|
||||||
6222
|
1556*12
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
|
@@ -858,6 +858,7 @@ int main(int argc, char *argv[])
|
|||||||
| T30_SUPPORT_300_600_RESOLUTION
|
| T30_SUPPORT_300_600_RESOLUTION
|
||||||
| T30_SUPPORT_400_800_RESOLUTION
|
| T30_SUPPORT_400_800_RESOLUTION
|
||||||
| T30_SUPPORT_600_1200_RESOLUTION);
|
| T30_SUPPORT_600_1200_RESOLUTION);
|
||||||
|
//t30_set_rx_encoding(t30_state[i], T4_COMPRESSION_ITU_T85);
|
||||||
t30_set_ecm_capability(t30_state[i], use_ecm);
|
t30_set_ecm_capability(t30_state[i], use_ecm);
|
||||||
if (use_ecm)
|
if (use_ecm)
|
||||||
{
|
{
|
||||||
|
@@ -287,6 +287,9 @@ int pcap_scan_pkts(const char *file,
|
|||||||
fprintf(stderr, "Truncated packet - total len = %d, captured len = %d\n", pkthdr->len, pkthdr->caplen);
|
fprintf(stderr, "Truncated packet - total len = %d, captured len = %d\n", pkthdr->len, pkthdr->caplen);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
printf("%d:%d -> %d:%d\n", ntohl(iphdr->saddr), ntohs(udphdr->source), ntohl(iphdr->daddr), ntohs(udphdr->dest));
|
||||||
|
#endif
|
||||||
body = (const uint8_t *) udphdr;
|
body = (const uint8_t *) udphdr;
|
||||||
body += sizeof(struct udphdr);
|
body += sizeof(struct udphdr);
|
||||||
body_len = pktlen - sizeof(struct udphdr);
|
body_len = pktlen - sizeof(struct udphdr);
|
||||||
|
@@ -287,7 +287,7 @@ int main(int argc, char *argv[])
|
|||||||
||
|
||
|
||||||
saturated_mul16_32(32767, 32767) != 2147352578
|
saturated_mul16_32(32767, 32767) != 2147352578
|
||||||
||
|
||
|
||||||
saturated_mul16_32(-32768, -32768) != -2147483648)
|
saturated_mul16_32(-32768, -32768) != INT32_MAX)
|
||||||
{
|
{
|
||||||
printf("Test failed.\n");
|
printf("Test failed.\n");
|
||||||
exit(2);
|
exit(2);
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Written by Steve Underwood <steveu@coppice.org>
|
* Written by Steve Underwood <steveu@coppice.org>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005 Steve Underwood
|
* Copyright (C) 2005, 2009, 2012 Steve Underwood
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -381,6 +381,8 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
|
|||||||
int len;
|
int len;
|
||||||
int limit;
|
int limit;
|
||||||
int high_tide;
|
int high_tide;
|
||||||
|
int len_before_entries;
|
||||||
|
int previous_len;
|
||||||
|
|
||||||
/* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their
|
/* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their
|
||||||
maximum length. */
|
maximum length. */
|
||||||
@@ -425,16 +427,28 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
|
|||||||
entries = s->error_correction_entries;
|
entries = s->error_correction_entries;
|
||||||
else
|
else
|
||||||
entries = s->tx_seq_no;
|
entries = s->tx_seq_no;
|
||||||
|
len_before_entries = len;
|
||||||
/* The number of entries will always be small, so it is pointless allowing
|
/* The number of entries will always be small, so it is pointless allowing
|
||||||
for the fragmented case here. */
|
for the fragmented case here. */
|
||||||
if (encode_length(buf, &len, entries) < 0)
|
if (encode_length(buf, &len, entries) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/* Encode the elements */
|
/* Encode the elements */
|
||||||
for (i = 0; i < entries; i++)
|
for (m = 0; m < entries; m++)
|
||||||
{
|
{
|
||||||
j = (entry - i - 1) & UDPTL_BUF_MASK;
|
previous_len = len;
|
||||||
|
j = (entry - m - 1) & UDPTL_BUF_MASK;
|
||||||
if (encode_open_type(buf, &len, s->tx[j].buf, s->tx[j].buf_len) < 0)
|
if (encode_open_type(buf, &len, s->tx[j].buf, s->tx[j].buf_len) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* If we have exceeded the far end's max datagram size, don't include this last chunk,
|
||||||
|
and stop trying to add more. */
|
||||||
|
if (len > s->far_max_datagram_size)
|
||||||
|
{
|
||||||
|
len = previous_len;
|
||||||
|
if (encode_length(buf, &len_before_entries, m) < 0)
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UDPTL_ERROR_CORRECTION_FEC:
|
case UDPTL_ERROR_CORRECTION_FEC:
|
||||||
@@ -455,9 +469,11 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
|
|||||||
buf[len++] = span;
|
buf[len++] = span;
|
||||||
/* The number of entries is defined as a length, but will only ever be a small
|
/* The number of entries is defined as a length, but will only ever be a small
|
||||||
value. Treat it as such. */
|
value. Treat it as such. */
|
||||||
|
len_before_entries = len;
|
||||||
buf[len++] = entries;
|
buf[len++] = entries;
|
||||||
for (m = 0; m < entries; m++)
|
for (m = 0; m < entries; m++)
|
||||||
{
|
{
|
||||||
|
previous_len = len;
|
||||||
/* Make an XOR'ed entry the maximum length */
|
/* Make an XOR'ed entry the maximum length */
|
||||||
limit = (entry + m) & UDPTL_BUF_MASK;
|
limit = (entry + m) & UDPTL_BUF_MASK;
|
||||||
high_tide = 0;
|
high_tide = 0;
|
||||||
@@ -479,6 +495,15 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
|
|||||||
}
|
}
|
||||||
if (encode_open_type(buf, &len, fec, high_tide) < 0)
|
if (encode_open_type(buf, &len, fec, high_tide) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* If we have exceeded the far end's max datagram size, don't include this last chunk,
|
||||||
|
and stop trying to add more. */
|
||||||
|
if (len > s->far_max_datagram_size)
|
||||||
|
{
|
||||||
|
len = previous_len;
|
||||||
|
buf[len_before_entries] = (uint8_t) m;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -373,7 +373,6 @@ int main(int argc, char *argv[])
|
|||||||
bert_set_report(&endpoint[i].bert_rx, 10000, reporter, &endpoint[i]);
|
bert_set_report(&endpoint[i].bert_rx, 10000, reporter, &endpoint[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(ENABLE_GUI)
|
#if defined(ENABLE_GUI)
|
||||||
if (use_gui)
|
if (use_gui)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user