diff --git a/fec_manager.cpp b/fec_manager.cpp index 8515273..3efc84a 100644 --- a/fec_manager.cpp +++ b/fec_manager.cpp @@ -13,6 +13,10 @@ const int encode_fast_send=1; const int decode_fast_send=1; + +int short_packet_optimize=1; +int header_overhead=40; + blob_encode_t::blob_encode_t() { clear(); @@ -247,9 +251,28 @@ int fec_encode_manager_t::input(char *s,int len/*,int &is_first_packet*/) if(type==0) { + actual_data_num=fec_data_num; actual_redundant_num=fec_redundant_num; + if(short_packet_optimize) + { + u32_t best_len=(blob_encode.get_shard_len(fec_data_num,0)+header_overhead)*(fec_data_num+fec_redundant_num); + int best_data_num=fec_data_num; + for(int i=1;i