WASAPI implementation in PJSip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140326/22fb9f69/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux