File descriptor media port

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

 



Hi Vali,

Thanks for the patch! Yep, the ability to manipulate audio frames from high
level language would be interesting indeed.

But I feel that using pipe approach is not the right one. Yes, there's
probably a need to read/write raw files, and from this we can use it to
read/write pipe and have Python open the other side of the pipe, but to add
this mechanism specificly so that Python can read/write audio frames I feel
is not right. Plus the implementation is too low level. All system
dependent code should be in PJLIB.

The approach that I have in mind is to create a media port at PJSUA2 level,
with API to read/write memory location. The operation will be strictly call
only from Python and there's no callback. For example, to write audio
frames in Python:

  while port.needFrames():
      port.write(audio frame)


Best regards,
 Benny


On Thu, Mar 6, 2014 at 4:35 AM, Tom?? Valenta <vali at kamarad.cz> wrote:

> Hi Ryan,
>
> yes, there are no callbacks, no locks so it does not suffer from
> deadlocks. The only thing you must be aware off is blocking I/O to be
> completed quickly or use non-blocking on UNIX.
>
> Cheers,
> - Vali
>
>
> Dne 5.3.2014 22:28, Ryan Detzel napsal(a):
>
>> Hey Vali,
>>
>> Thanks for this, it's great you're adding this to the project. Will this
>> solve the issues with deadlocks?
>>
>> Thanks
>>
>>
>> On Wed, Mar 5, 2014 at 3:45 PM, Tom?? Valenta <vali at kamarad.cz
>> <mailto:vali at kamarad.cz>> wrote:
>>
>>     Hi,
>>
>>     some time ago I posted a patch that added audio put and get frame
>>     callback to PJSUA, even to the Python wrapper. It suffered from
>>     deadlocks and occasional crashes (especially with more calls) so
>>     yesterday I posted a new version that behaves better, but still
>>     deadlocks or crashes might occur.
>>
>>     I revised the idea of accessing audio frames at a high level and
>>     created file descriptor media port available in PJSUA, Python_PJSUA
>>     and PJSUA2, see attached patch.
>>
>>     Key features:
>>     * It works similarly to audio recorder or player.
>>     * It works with raw data -- no headers or format handling.
>>     * It can read/write from/to a file descriptor or Windows file handle.
>>     * File descriptor may be virtually everything: file, pipe, socket etc.
>>     * On UNIX it can operate either in blocking mode or in non-blocking
>>     mode with buffering.
>>     * It can be used to communicate the data with the same or different
>>     process.
>>
>>     Feel free to use it if you find it useful.
>>     Examples are in
>>     pjsip_apps/src/python/samples/__audio_fd.py
>>     and
>>     pjsip_apps/src/swig/python/__audio_fd.py.
>>
>>
>>     Benny or other authors, do you think it can be integrated to the
>>     trunk? I would be helpful and grateful.
>>
>>     Cheers,
>>     - Vali
>>
>>     _______________________________________________
>>     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
>>
>>
>
> _______________________________________________
> 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/20140310/d66e7051/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