Hi Tanger, Some sound cards do have clock drift, recording and playing do not have exact same clock rate, (and this usually will hurt the AEC, but not in your case?). sndtest sample app can be used to check drift level of your sound card. However it is a bit strange on your case, since usually AEC will work well when there is no clock drift, and AEC becomes inefficient/not working when there is drift. But, your experience is on the contrary of those usual behavior. So, if you are sure that the AEC works well (echo is canceled) in ptime==10, where the drift occurred, then just use this setting :) You may want to try opening the sound card in clock rate 48kHz which usually produce less drift. Regards, nanang On 17/04/2008, cat tanger <tanger_wendy at yahoo.com.cn> wrote: > > > > hi,all, > please help me! > I use pjproject-0.8.0, > > when i set audio_frame_ptime = 20,aec = 1, then PaRecorderCallback and > PaPlayerCallback function run exactly, but aec can't work well, do not > cancell echo . > > when i set audio_frame_ptime = 10,aec = 1, then aec can work well . but > the PaRecorderCallback and PaPlayerCallback function do not work well, > portaudio callback the PaRecorderCallback times far more callback > PaPlayerCallback times, it result the aec continue reset. i find underflow > in the PaPlayerCallback. > > pls help me! > thanks! > > > test code: > > static int capcounts = 0,playcounts = 0; > > static int PaRecorderCallback(const void *input, > void *output, > unsigned long frameCount, > const PaStreamCallbackTimeInfo* timeInfo, > PaStreamCallbackFlags statusFlags, > void *userData ) > { > ..... > capcounts ++; > if (capcounts%500 == 0) > { > PJ_LOG(5,(THIS_FILE, "Recorder thread capcounts = %d,playcounts = > %d",capcounts,playcounts)); > } > .... > return paAbort; > } > > static int PaPlayerCallback( const void *input, > void *output, > unsigned long frameCount, > const PaStreamCallbackTimeInfo* timeInfo, > PaStreamCallbackFlags statusFlags, > void *userData ) > { > .... > playcounts ++; > if (playcounts%500 == 0) > { > PJ_LOG(5,(THIS_FILE, "Player thread capcounts = %d,playcounts = % > d",capcounts,playcounts)); > } > .... > return paAbort; > } > > > print : > 11:11:06.703 aec00EA2B70 AEC reset, delay=-65, prefetch=10 > 11:11:06.921 pasound.c Recorder thread capcounts = 500,playcounts = > 434 > 11:11:07.062 aec00EA2B70 AEC reset, delay=-66, prefetch=10 > 11:11:07.609 pasound.c Player thread capcounts = 568,playcounts = 500 > 11:11:07.734 aec00EA2B70 AEC reset, delay=-69, prefetch=10 > 11:11:11.921 pasound.c Recorder thread capcounts = 1000,playcounts = > 903 > 11:11:11.921 aec00EA2B70 AEC reset, delay=-89, prefetch=10 > 11:11:12.828 pasound.c Player thread capcounts = 1089,playcounts = > 1000 > 11:11:13.140 aec00EA2B70 AEC reset, delay=-90, prefetch=10 > 11:11:16.906 pasound.c Recorder thread capcounts = 1500,playcounts = > 1376 > 11:11:17.203 aec00EA2B70 AEC reset, delay=-123, prefetch=10 1 > 11:11:18.390 pasound.c Player thread capcounts = 1646,playcounts = > 1500 > 11:11:18.390 aec00EA2B70 AEC reset, delay=-140, prefetch=10 > 11:11:21.921 pasound.c Recorder thread capcounts = 2000,playcounts = > 1817 > 11:11:23.171 aec00EA2B70 AEC reset, delay=-183, prefetch=10 > 11:11:23.828 pasound.c Player thread capcounts = 2191,playcounts = > 2000 > 11:11:24.234 aec00EA2B70 AEC reset, delay=-192, prefetch=10 > 11:11:26.921 pasound.c Recorder thread capcounts = 2500,playcounts = > 2253 > 11:11:26.937 aec00EA2B70 AEC reset, delay=-239, prefetch=10 1 > 11:11:29.703 pasound.c Player thread capcounts = 2779,playcounts = > 2500 > 11:11:29.937 aec00EA2B70 AEC reset, delay=-278, prefetch=10 > 11:11:31.906 pasound.c Recorder thread capcounts = 3000,playcounts = > 2681 > 11:11:32.140 aec00EA2B70 AEC reset, delay=-311, prefetch=10 > > > > ________________________________ > ???????????? > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >