mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-01-18 22:09:35 +08:00
option decode-buf
This commit is contained in:
parent
f992434063
commit
a5c26c5814
@ -17,6 +17,8 @@ const int decode_fast_send=1;
|
||||
int short_packet_optimize=1;
|
||||
int header_overhead=40;
|
||||
|
||||
u32_t fec_buff_num=2000;// how many packet can fec_decode_manager hold. shouldnt be very large,or it will cost huge memory
|
||||
|
||||
blob_encode_t::blob_encode_t()
|
||||
{
|
||||
clear();
|
||||
@ -465,11 +467,6 @@ int fec_encode_manager_t::output(int &n,char ** &s_arr,int *&len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
fec_decode_manager_t::fec_decode_manager_t()
|
||||
{
|
||||
re_init();
|
||||
}
|
||||
|
||||
int fec_decode_manager_t::re_init()
|
||||
{
|
||||
for(int i=0;i<(int)fec_buff_num;i++)
|
||||
|
@ -12,11 +12,11 @@
|
||||
#include "log.h"
|
||||
#include "lib/rs.h"
|
||||
|
||||
const int max_blob_packet_num=20000;//how many packet can be contain in a blob_t ,can be set very large
|
||||
const u32_t anti_replay_buff_size=20000;//can be set very large
|
||||
const int max_blob_packet_num=30000;//how many packet can be contain in a blob_t ,can be set very large
|
||||
const u32_t anti_replay_buff_size=30000;//can be set very large
|
||||
|
||||
const int max_fec_packet_num=255;// this is the limitation of the rs lib
|
||||
const u32_t fec_buff_num=2000;// how many packet can fec_decode_manager hold. shouldnt be very large,or it will cost huge memory
|
||||
extern u32_t fec_buff_num;
|
||||
|
||||
|
||||
struct anti_replay_t
|
||||
@ -162,20 +162,34 @@ struct fec_group_t
|
||||
class fec_decode_manager_t
|
||||
{
|
||||
anti_replay_t anti_replay;
|
||||
fec_data_t fec_data[fec_buff_num+10];
|
||||
fec_data_t *fec_data;
|
||||
int index;
|
||||
unordered_map<u32_t, fec_group_t> mp;
|
||||
blob_decode_t blob_decode;
|
||||
|
||||
|
||||
|
||||
int output_n;
|
||||
char ** output_s_arr;
|
||||
int * output_len_arr;
|
||||
char *output_s_arr_buf[max_fec_packet_num+100];
|
||||
int output_len_arr_buf[max_fec_packet_num+100];
|
||||
int ready_for_output;
|
||||
|
||||
public:
|
||||
fec_decode_manager_t();
|
||||
fec_decode_manager_t()
|
||||
{
|
||||
fec_data=new fec_data_t[fec_buff_num+5];
|
||||
re_init();
|
||||
}
|
||||
fec_decode_manager_t(const fec_decode_manager_t &b)
|
||||
{
|
||||
assert(0==1);//not allowed to copy
|
||||
}
|
||||
~fec_decode_manager_t()
|
||||
{
|
||||
delete fec_data;
|
||||
}
|
||||
int re_init();
|
||||
int input(char *s,int len);
|
||||
int output(int &n,char ** &s_arr,int* &len_arr);
|
||||
|
14
main.cpp
14
main.cpp
@ -1183,6 +1183,7 @@ void print_help()
|
||||
printf(" -j ,--jitter jmin:jmax similiar to -j above,but create jitter randomly between jmin and jmax\n");
|
||||
printf(" -i,--interval imin:imax similiar to -i above,but scatter randomly between imin and imax\n");
|
||||
printf(" -q,--queue-len <number> max fec queue len,only for mode 1\n");
|
||||
printf(" --decode-buf <number> size of buffer of fec decoder,unit:packet,default:2000\n");
|
||||
printf(" --fix-latency <number> try to stabilize latency,only for mode 1\n");
|
||||
printf(" --delay-capacity <number> max number of delayed packets\n");
|
||||
printf(" --disable-fec <number> completely disable fec,turn the program into a normal udp tunnel\n");
|
||||
@ -1218,9 +1219,11 @@ void process_arg(int argc, char *argv[])
|
||||
{"mtu", required_argument, 0, 1},
|
||||
{"mode", required_argument, 0,1},
|
||||
{"timeout", required_argument, 0,1},
|
||||
{"--decode-buf", required_argument, 0,1},
|
||||
{"queue-len", required_argument, 0,'q'},
|
||||
{"fec", required_argument, 0,'f'},
|
||||
{"jitter", required_argument, 0,'j'},
|
||||
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
int option_index = 0;
|
||||
@ -1456,6 +1459,7 @@ void process_arg(int argc, char *argv[])
|
||||
mylog(log_fatal,"random_drop must be between 0 10000 \n");
|
||||
myexit(-1);
|
||||
}
|
||||
mylog(log_info,"random_drop=%d\n",random_drop);
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"delay-capacity")==0)
|
||||
{
|
||||
@ -1491,6 +1495,16 @@ void process_arg(int argc, char *argv[])
|
||||
myexit(-1);
|
||||
}
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"decode-buf")==0)
|
||||
{
|
||||
sscanf(optarg,"%d",&fec_buff_num);
|
||||
if(fec_buff_num<100 || fec_buff_num>20000)
|
||||
{
|
||||
mylog(log_fatal,"decode-buf value must be between 100 and 20000 (kbyte) \n");
|
||||
myexit(-1);
|
||||
}
|
||||
mylog(log_info,"decode-buf=%d\n",fec_buff_num);
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"mode")==0)
|
||||
{
|
||||
sscanf(optarg,"%d",&fec_type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user