WASAPI implementation in PJSip

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

 



Hi,

I would use portaudio, which has WASAPI implemented and which is already 
in PJSIP. Maybe update it to a newer version.

Cheers,

Andreas


Am 26.03.2014 18:45, schrieb Nuno Centeio:
> @Bill,
>
> I understand that. But, do you think that the render will only work if 
> the capture is working correctly?
> I'm capturing and sending to the network but I'm not converting from 
> IEEE Floating Point to PCM16 bits (the sound is not playing well on 
> the destination).
>
> Thanks
>
>
> On 26 March 2014 17:22, Bill Gardner <billg at wavearts.com 
> <mailto:billg at wavearts.com>> wrote:
>
>     You could run one WASAPI thread and service both playback and
>     capture events using WaitForMultipleObjects. You should implement
>     audio capture for the obvious reason to make the microphone work,
>     plus not providing pjsip with capture buffers will cause lots of
>     underflow messages.
>
>     Bill
>
>
>     On 3/26/2014 12:48 PM, Nuno Centeio wrote:
>>     *@Bill,*
>>
>>     But the record is not made in the thread that gets the frame (my
>>     WASAPI thread), right? Or do I need to implement my capture
>>     engine in order for the render buffer to be correct?
>>
>>     *@Abdelrahman*,
>>
>>     I think that the only problem will be the WinSocks. However, I'm
>>     not targeting for ARM devices, where WinSocks does not exist. In
>>     x86 and x64 processors there is WinSocks. But, however, I'm
>>     already prepared to be rejected a lot of times :(
>>
>>
>>     On 26 March 2014 16:40, Abdelrahman Salah
>>     <abdelrahman.salah.cs at gmail.com
>>     <mailto:abdelrahman.salah.cs at gmail.com>> wrote:
>>
>>         Dear nuno,
>>
>>         This is a side hint, please bay attention to the dependencies
>>         required, because most of the dependencies required are not
>>         allowed in windows store and more than likely it will fail
>>         the certificate test.
>>         So take that into consideration before spending time and effort.
>>
>>         Abdelrahman Salah
>>         Sent From My Note II
>>
>>         On 26 Mar 2014 18:25, "Nuno Centeio"
>>         <nuno.r.centeio at gmail.com <mailto:nuno.r.centeio at gmail.com>>
>>         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 <mailto:pjsip at lists.pjsip.org>
>>             http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>
>>
>>         _______________________________________________
>>         Visit our blog: http://blog.pjsip.org
>>
>>         pjsip mailing list
>>         pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org>
>>         http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>
>>
>>
>>
>>     _______________________________________________
>>     Visit our blog:http://blog.pjsip.org
>>
>>     pjsip mailing list
>>     pjsip at lists.pjsip.org  <mailto:pjsip at lists.pjsip.org>
>>     http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
>     _______________________________________________
>     Visit our blog: http://blog.pjsip.org
>
>     pjsip mailing list
>     pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org>
>     http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
>
>
> _______________________________________________
> 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/f7d73195/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