mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-01-18 13:59:34 +08:00
fix last commit
This commit is contained in:
parent
25da3a2b03
commit
3e248b414c
@ -20,7 +20,7 @@
|
||||
|
||||
fec_parameter_t g_fec_par;
|
||||
|
||||
int debug_fec=1;
|
||||
int debug_fec=0;
|
||||
//int dynamic_update_fec=1;
|
||||
|
||||
const int encode_fast_send=1;
|
||||
@ -288,15 +288,18 @@ int fec_encode_manager_t::input(char *s,int len/*,int &is_first_packet*/)
|
||||
if(fec_par.mode==0)
|
||||
{
|
||||
|
||||
actual_data_num=fec_par.get_tail().x;
|
||||
actual_redundant_num=fec_par.get_tail().y;
|
||||
|
||||
int tail_x=fec_par.get_tail().x;
|
||||
int tail_y=fec_par.get_tail().y;
|
||||
actual_data_num=tail_x;
|
||||
actual_redundant_num=tail_y;
|
||||
|
||||
if(short_packet_optimize)
|
||||
{
|
||||
u32_t best_len=(blob_encode.get_shard_len(actual_data_num,0)+header_overhead)*(actual_data_num+actual_redundant_num);
|
||||
int best_data_num=actual_data_num;
|
||||
assert(actual_data_num<=fec_par.rs_cnt);
|
||||
for(int i=1;i<actual_data_num;i++)
|
||||
u32_t best_len=(blob_encode.get_shard_len(tail_x,0)+header_overhead)*(tail_x+tail_y);
|
||||
int best_data_num=tail_x;
|
||||
assert(tail_x<=fec_par.rs_cnt);
|
||||
for(int i=1;i<tail_x;i++)
|
||||
{
|
||||
assert(fec_par.rs_par[i-1].x==i);
|
||||
int tmp_x=fec_par.rs_par[i-1].x;
|
||||
@ -315,14 +318,10 @@ int fec_encode_manager_t::input(char *s,int len/*,int &is_first_packet*/)
|
||||
actual_data_num=best_data_num;
|
||||
assert(best_data_num>=1&&best_data_num<=fec_par.rs_cnt);
|
||||
actual_redundant_num=fec_par.rs_par[best_data_num-1].y;
|
||||
|
||||
if(debug_fec)
|
||||
mylog(log_debug,"actual_data_num=%d actual_redundant_num=%d len=%d\n",actual_data_num,actual_redundant_num,blob_encode.get_shard_len(actual_data_num,0));
|
||||
else
|
||||
mylog(log_trace,"actual_data_num=%d actual_redundant_num=%d\n",actual_data_num,actual_redundant_num);
|
||||
}
|
||||
|
||||
assert(blob_encode.output(actual_data_num,blob_output,fec_len)==0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -337,7 +336,11 @@ int fec_encode_manager_t::input(char *s,int len/*,int &is_first_packet*/)
|
||||
}
|
||||
|
||||
}
|
||||
mylog(log_trace,"%d %d %d\n",actual_data_num,actual_redundant_num,fec_len);
|
||||
if(debug_fec)
|
||||
mylog(log_debug,"x=%d y=%d len=%d\n",actual_data_num,actual_redundant_num,fec_len);
|
||||
else
|
||||
mylog(log_trace,"x=%d y=%d len=%d\n",actual_data_num,actual_redundant_num,fec_len);
|
||||
//mylog(log_trace,"%d %d %d\n",actual_data_num,actual_redundant_num,fec_len);
|
||||
|
||||
char *tmp_output_buf[max_fec_packet_num+5]={0};
|
||||
for(int i=0;i<actual_data_num+actual_redundant_num;i++)
|
||||
|
@ -19,6 +19,8 @@ const int max_fec_packet_num=255;// this is the limitation of the rs lib
|
||||
extern u32_t fec_buff_num;
|
||||
|
||||
const int rs_str_len=max_fec_packet_num*10+100;
|
||||
extern int header_overhead;
|
||||
extern int debug_fec;
|
||||
|
||||
struct fec_parameter_t
|
||||
{
|
||||
@ -50,7 +52,7 @@ struct fec_parameter_t
|
||||
mylog(log_warn,"failed to parse [%s]\n",tmp_str.c_str());
|
||||
return -1;
|
||||
}
|
||||
if(x<1||y<1||x+y>max_fec_packet_num)
|
||||
if(x<1||y<0||x+y>max_fec_packet_num)
|
||||
{
|
||||
mylog(log_warn,"invaild value x=%d y=%d\n",x,y);
|
||||
return -1;
|
||||
|
13
misc.cpp
13
misc.cpp
@ -650,6 +650,8 @@ void process_arg(int argc, char *argv[])
|
||||
{"queue-len", required_argument, 0,'q'},
|
||||
{"fec", required_argument, 0,'f'},
|
||||
{"jitter", required_argument, 0,'j'},
|
||||
{"header-overhead", required_argument, 0, 1},
|
||||
{"debug-fec", no_argument, 0, 1},
|
||||
{"fifo", required_argument, 0, 1},
|
||||
{"sub-net", required_argument, 0, 1},
|
||||
{"tun-dev", required_argument, 0, 1},
|
||||
@ -660,6 +662,7 @@ void process_arg(int argc, char *argv[])
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
int option_index = 0;
|
||||
assert(g_fec_par.rs_from_str((char *)"20:10")==0);
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
@ -939,6 +942,11 @@ void process_arg(int argc, char *argv[])
|
||||
}
|
||||
g_fec_par.timeout*=1000;
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"debug-fec")==0)
|
||||
{
|
||||
debug_fec=1;
|
||||
mylog(log_info,"debug_fec enabled\n");
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"fifo")==0)
|
||||
{
|
||||
sscanf(optarg,"%s",fifo_file);
|
||||
@ -969,6 +977,11 @@ void process_arg(int argc, char *argv[])
|
||||
sscanf(optarg,"%d",&tun_mtu);
|
||||
mylog(log_warn,"changed tun_mtu,tun_mtu=%d\n",tun_mtu);
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"header-overhead")==0)
|
||||
{
|
||||
sscanf(optarg,"%d",&header_overhead);
|
||||
mylog(log_warn,"changed header_overhead,header_overhead=%d\n",header_overhead);
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"disable-mssfix")==0)
|
||||
{
|
||||
mssfix=0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user