Master/sound underflows mean the playback callbacks are happening faster than the record callbacks. If it is persistent then it is a problem, but a few happening at stream startup is not unusual. PJSIP clocks media based on audio playback callbacks, the record callbacks cause audio frame to be saved in a buffer. The underflow means the playback callback is processing media, and the buffer holding the recorded audio is empty. In this case PJSIP will use the wsola algorithm to generate a new buffer. The wsola buffer is also used in the echo cancellation framework. Check to see which one is generating the underflow. Bill On 3/26/2014 12:23 PM, Nuno Centeio wrote: > Hi guys, > > I'm trying to implement the Windows Audio Session API (WASAPI) in > order to make PJSip compliant with Windows Store apps. > > I think that I'm almost done but I can get the sound correctly (it's > just that!). > > Here is what I have: > > (pb_client is a IAudioRenderClient) > hr = strm->pb_client->GetBuffer(frame_to_render, &cur_pb_buf); > > pjmedia_frame frame; > void* destBuffer = > (void*)malloc(strm->bytes_per_frame*frame_to_render*sizeof(pj_uint16_t)); > /* PCM mode */ > frame.type = PJMEDIA_FRAME_TYPE_AUDIO; > frame.size = strm->bytes_per_frame; > frame.timestamp.u64 = strm->pb_timestamp.u64; > frame.bit_info = 0; > frame.buf = destBuffer; > > status = (*strm->pb_cb)(strm->user_data, &frame); > > /* Because PJSip will give me PCM 16 bits, 2 channels and WASAPI needs > IEEE Floating point 32-bits, 2 channels > */ > CAudioConverter* conv = new CAudioConverter(); > conv->ConvI16ToF32((BYTE*)destBuffer, cur_pb_buf, frame_to_render); > > /* Write to the device. */ > hr = strm->pb_client->ReleaseBuffer(frame_to_render, 0); > > While running I have the following prints: > 3/26/2014 4:00:01 PM V SIP - Underflow, buf_cnt=0, will > generate 1 frame > 3/26/2014 4:00:01 PM V SIP - Underflow, buf_cnt=0, will > generate 1 frame > 3/26/2014 4:00:01 PM V SIP - 698 samples reduced, buf_cnt=6092 > 3/26/2014 4:00:01 PM V SIP - Buffer size adjusted from 6790 > to 6092 (eff_cnt=5760) > 3/26/2014 4:00:01 PM V SIP - Underflow, buf_cnt=0, will > generate 1 frame > 3/26/2014 4:00:02 PM V SIP - 320 samples reduced, buf_cnt=6412 > 3/26/2014 4:00:02 PM V SIP - Buffer size adjusted from 6732 > to 6412 (eff_cnt=5760) > > Any hints on what I might be doing wrong? > > Thanks > > > _______________________________________________ > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140326/0a9454ce/attachment-0001.html>