mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-01-18 22:09:35 +08:00
doesnt work any more,no idea
This commit is contained in:
parent
1a4149eef2
commit
8fd5118e6c
@ -172,20 +172,21 @@ int fec_encode_manager_t::input(char *s,int len/*,int &is_first_packet*/)
|
||||
buf[i][tmp_idx++]=(unsigned char)fec_data_num;
|
||||
buf[i][tmp_idx++]=(unsigned char)fec_redundant_num;
|
||||
buf[i][tmp_idx++]=(unsigned char)i;
|
||||
output_buf[i]=buf[i]+tmp_idx;
|
||||
output_buf[i]=buf[i]+tmp_idx; //////caution ,trick here.
|
||||
output_len[i]=tmp_idx+blob_len;
|
||||
if(i<fec_data_num)
|
||||
{
|
||||
memcpy(buf[i]+tmp_idx,blob_output[i],blob_len);
|
||||
tmp_idx+=blob_len;
|
||||
}
|
||||
}
|
||||
output_len=blob_len+sizeof(u32_t)+4*sizeof(char);/////remember to change this 4,if modified the protocol
|
||||
//output_len=blob_len+sizeof(u32_t)+4*sizeof(char);/////remember to change this 4,if modified the protocol
|
||||
|
||||
rs_encode2(fec_data_num,fec_data_num+fec_redundant_num,output_buf,blob_len);
|
||||
|
||||
for(int i=0;i<fec_data_num+fec_redundant_num;i++)
|
||||
{
|
||||
output_buf[i]=buf[i];
|
||||
output_buf[i]=buf[i];//////caution ,trick here.
|
||||
}
|
||||
|
||||
ready_for_output=1;
|
||||
@ -211,12 +212,12 @@ int fec_encode_manager_t::input(char *s,int len/*,int &is_first_packet*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fec_encode_manager_t::output(int &n,char ** &s_arr,int &len)
|
||||
int fec_encode_manager_t::output(int &n,char ** &s_arr,int *&len)
|
||||
{
|
||||
if(!ready_for_output)
|
||||
{
|
||||
n=-1;
|
||||
len=-1;
|
||||
len=0;
|
||||
s_arr=0;
|
||||
}
|
||||
else
|
||||
|
@ -35,7 +35,7 @@ struct anti_replay_t
|
||||
|
||||
if(st.find(seq)!=st.end() )
|
||||
{
|
||||
mylog(log_trace,"seq %llx exist\n",seq);
|
||||
mylog(log_trace,"seq %u exist\n",seq);
|
||||
return;
|
||||
//return 0;
|
||||
}
|
||||
@ -101,7 +101,7 @@ class fec_encode_manager_t
|
||||
int fec_pending_time;
|
||||
char buf[max_fec_packet_num+5][buf_len+100];
|
||||
char *output_buf[max_fec_packet_num+5];
|
||||
int output_len;
|
||||
int output_len[max_fec_packet_num+5];
|
||||
int ready_for_output;
|
||||
u32_t seq;
|
||||
int counter;
|
||||
@ -116,7 +116,7 @@ public:
|
||||
u64_t get_timer_fd64();
|
||||
int re_init(int data_num,int redundant_num,int mtu,int pending_num,int pending_time);
|
||||
int input(char *s,int len/*,int &is_first_packet*/);
|
||||
int output(int &n,char ** &s_arr,int &len);
|
||||
int output(int &n,char ** &s_arr,int *&len);
|
||||
};
|
||||
struct fec_data_t
|
||||
{
|
||||
|
25
main.cpp
25
main.cpp
@ -121,10 +121,10 @@ int delay_send(my_time_t delay,const dest_t &dest,char *data,int len)
|
||||
int from_normal_to_fec(conn_info_t & conn_info,char *data,int len,int & out_n,char **&out_arr,int *&out_len,int *&out_delay)
|
||||
{
|
||||
static int out_delay_buf[max_fec_packet_num+100]={0};
|
||||
static int out_len_buf[max_fec_packet_num+100]={0};
|
||||
//static int out_len_buf[max_fec_packet_num+100]={0};
|
||||
static int counter=0;
|
||||
out_delay=out_delay_buf;
|
||||
out_len=out_len_buf;
|
||||
//out_len=out_len_buf;
|
||||
|
||||
if(0)
|
||||
{
|
||||
@ -150,14 +150,9 @@ int from_normal_to_fec(conn_info_t & conn_info,char *data,int len,int & out_n,ch
|
||||
//char **s_arr;
|
||||
//int s_len;
|
||||
|
||||
int tmp_out_len;
|
||||
conn_info.fec_encode_manager.output(out_n,out_arr,tmp_out_len);
|
||||
|
||||
for(int i=0;i<out_n;i++)
|
||||
{
|
||||
out_len_buf[i]=tmp_out_len;
|
||||
// out_delay_buf[i]=100*i;
|
||||
}
|
||||
conn_info.fec_encode_manager.output(out_n,out_arr,out_len);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -900,15 +895,15 @@ int unit_test()
|
||||
|
||||
int n;
|
||||
char **s_arr;
|
||||
int len;
|
||||
int *len;
|
||||
|
||||
|
||||
fec_encode_manager.output(n,s_arr,len);
|
||||
printf("<n:%d,len:%d>",n,len);
|
||||
printf("<n:%d,len:%d>",n,len[0]);
|
||||
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
fec_decode_manager.input(s_arr[i],len);
|
||||
fec_decode_manager.input(s_arr[i],len[i]);
|
||||
}
|
||||
|
||||
{
|
||||
@ -937,16 +932,16 @@ int unit_test()
|
||||
|
||||
int n;
|
||||
char **s_arr;
|
||||
int len;
|
||||
int * len;
|
||||
|
||||
|
||||
fec_encode_manager.output(n,s_arr,len);
|
||||
printf("<n:%d,len:%d>",n,len);
|
||||
printf("<n:%d,len:%d>",n,len[0]);
|
||||
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
if(i==1||i==3||i==5||i==0)
|
||||
fec_decode_manager.input(s_arr[i],len);
|
||||
fec_decode_manager.input(s_arr[i],len[i]);
|
||||
}
|
||||
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user