Search
 
 

Display results as :
 


Rechercher Advanced Search

Top posting users this month

GeoMap

Use the asynchronous AEC API of Speex with cautions! e.g. speex_echo_palyback() and speex_echo_capture()

View previous topic View next topic Go down

Use the asynchronous AEC API of Speex with cautions! e.g. speex_echo_palyback() and speex_echo_capture()

Post  halala on Sat Aug 01, 2015 4:27 pm

The echo_diagnostic.m has bugs to run under both Octave and Matlab. I tried to info the developer community by the mailing list , but there seems no one is responsible for it.

The asynchronous AEC API speex_echo_palyback() and speex_echo_capture() is influence by a magic number
Code:

#define PLAYBACK_DELAY 2
Under most occasions, this number is not adequate. For example, your sound card may play 3 buffers before a captured buffer or vice vesa. This will cause the delay buffer over/under flow.

A side effect of this magic number is that it delays the play buf queue for 2 frames which may cause AEC mechanism not working at all. A simple work around, is call the speex_echo_capture() twice with empty buffers.
However, this solution is not apparent to most of developers who had not go through the source codes of Speex.


 And also the buffer filling scheme is strange, it append zeros at the end of input buffer rather than the head of it.
Code:

[b]668   if (st->play_buf_pos<=PLAYBACK_DELAY*st->frame_size)
[/b] 669   {
 670      int i;
 671      for (i=0;i<st->frame_size;i++)
 672         st->play_buf[st->play_buf_pos+i] = play[i];
 673      st->play_buf_pos += st->frame_size;
 674      if (st->play_buf_pos <= (PLAYBACK_DELAY-1)*st->frame_size)
 675      {
 676         speex_warning("Auto-filling the buffer (your application is buggy and/or got xruns)");
 677         for (i=0;i<st->frame_size;i++)
 678            st->play_buf[st->play_buf_pos+i] = play[i];
 679         st->play_buf_pos += st->frame_size;
 680      }
 681   } else {
[b] 682      speex_warning("Had to discard a playback frame (your application is buggy and/or got xruns)");
[/b]
683   }
avatar
halala

帖子数 : 99
金币(Coin) : 2218
注册日期 : 2012-08-17

View user profile

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum