TDM sound device to the pjmedia, how?

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

 



Hi Bill,

Thanks, I think I see the global picture now.
Dimitar

From: Bill Gardner 
Sent: Friday, March 27, 2015 21:20
To: pjsip at lists.pjsip.org 
Subject: Re: TDM sound device to the pjmedia, how?

Hi Dimitar,

pjsip runs all media processing from the audio device callback, so it is important that the callbacks happen periodically at the frame rate, typically 10 or 20 msec. pjsip can tolerate some burstiness in the callbacks, say two reads followed by two writes, but long pauses will cause big problems. A typical implementation starts a high priority thread with a loop that polls the hardware device and makes the callbacks when data is to be transferred.

Regards,

Bill


On 3/27/2015 2:38 PM, dpn at switchvoice.com wrote:

  Hi Bill,

  Thank you for the explanation. 

  The only conceptual think I am not clear for my pjsua application now is 
  if I can block in my audio device until my hardware has or requires audio data.

  Best Regards
  Dimitar

       

  From: Bill Gardner 
  Sent: Friday, March 27, 2015 15:56
  To: pjsip at lists.pjsip.org 
  Subject: Re: TDM sound device to the pjmedia, how?

  Hi Dimitar,

  You want to write a new audiodev following pjmedia/include/pjmedia-audiodev/audiodev_imp.h,
  then set up a macro to enable/disable this device, such as PJMEDIA_AUDIO_DEV_HAS_TDM,
  and then add the hooks in pjmedia\src\pjmedia-audiodev\audiodev.c so pjmedia will use this device,
  and then enable the device in config_site.h and disable the others.

  You can then enable/disable the hardware echo cancellation by using the pjmedia capability
  PJMEDIA_AUD_DEV_CAP_EC, then pjmedia can use the built-in AEC.

  Regards,

  Bill




  On 3/27/2015 8:30 AM, dpn at switchvoice.com wrote:

    Hi All,

    I?ve ported pjproject-1.16 on an embedded platform based on Mediatek MT 7620 CPU running OpenWRT.
    (Version 1.16 is rather old but I don?t need video and it seems it covers my needs. ) 
    On this platform there is SLIC chip supporting FXS interface to an analog phone. 
    The  SLIC has TDM interface to the CPU and I have completed the TDM driver (running in the Linux kernel space) 
    which works fine with Asterisk.
         
    Now I am trying to test pjsua (or some other basic pjsip user agent? ) so I would like to integrate my driver to pjmedia. 
    I?ve checked the very clean pjsip documentation but still I am not fully clear how to approach the project. 

    I think using PortAudio or ALSA will overcomplicate my experiment. 

    My TDM driver expose ioctl interface which I can use from my pjsua application from the user space. 
    I think the best would be to derive the application clock from my tdm driver. 
    As far as I understand  I should use ?Sound Device Port Framework? so eventually the application hooks
    two callbacks rec_cb and play_cb which are called when my TDM driver has frame of data or needs frame of data. 
    I am looking at /pjproject-1.16/pjmedia/src/pjmedia-audiodev/null_dev.c which looks as the simplest starting point I could hack.

    However sound devices in pjmedia provide lot of stuff which I don?t think I need. 
    For example acoustic echo cancelation. I don?t need that. 
    I rather use line echo canceler in my TDM driver which is more important I think for my softphone example.     

    From the other hand the ?Media Ports Framework? looks much cleaner than ?Sound Device Port Framework?. 
    For example /pjproject-1.16/pjmedia/src/pjmedia/null_port.c looks much simpler than null_dev.c.
    But as far as understand using this framework the application calls the functions get_frame and put_frame so what I could do 
    is to block the execution of those functions (using linux system call select() for example)
    and return when I get/send the frame data from/to my driver. This way I will get the timings provided from my driver to the pjsua. 
    However I am not sure how this will fit with the SIP part of my test softphone.

    Anyone willing to clarify if I am on or fully out of track? 

    Thanks
    Dimitar

     

_______________________________________________
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


------------------------------------------------------------------------------
  _______________________________________________
  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


   

_______________________________________________
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




--------------------------------------------------------------------------------
_______________________________________________
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/20150328/6748714d/attachment.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