Commit 0d8d9eae authored by Wei Shi's avatar Wei Shi
Browse files

trunk: set socket options SO_REUSEADDR for online-audio-server-decode-faster

git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@4602 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
parent 21bbdab1
......@@ -147,7 +147,7 @@ void ExtractWindow(const VectorBase<BaseFloat> &wave,
if (opts.dither != 0.0) Dither(&window_part, opts.dither);
if (opts.remove_dc_offset != 0.0)
if (opts.remove_dc_offset)
window_part.Add(-window_part.Sum() / frame_length);
if (log_energy_pre_window != NULL) {
......
......@@ -4116,7 +4116,7 @@ static void UnitTestExtractCompressedMatrix() {
MatrixIndexT sub_num_rows = Rand() % (num_rows - row_offset) + 1,
sub_num_cols = Rand() % (num_cols - col_offset) + 1;
KALDI_VLOG(3) << "Whole matrix size: " << num_rows << "," << num_cols;
KALDI_VLOG(4) << "Sub-matrix size: " << sub_num_rows << "," << sub_num_cols
KALDI_VLOG(3) << "Sub-matrix size: " << sub_num_rows << "," << sub_num_cols
<< " with offsets " << row_offset << "," << col_offset;
CompressedMatrix cmat2(cmat, row_offset, sub_num_rows, //take a subset of
col_offset, sub_num_cols); // the compressed matrix
......
......@@ -354,6 +354,13 @@ bool TcpServer::Listen(int32 port) {
return false;
}
int32 flag = 1;
int32 len = sizeof(int32);
if( setsockopt(server_desc_, SOL_SOCKET, SO_REUSEADDR, &flag, len) == -1){
KALDI_ERR << "Cannot set socket options!\n";
return false;
}
if (bind(server_desc_, (struct sockaddr*) &h_addr_, sizeof(h_addr_)) == -1) {
KALDI_ERR << "Cannot bind to port: " << port << " (is it taken?)";
return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment