sharing soundcard with ALSA problem still remains

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

 



Hi,
the problem with the assertion error when using alsa is caused by a bug
in alsa_dev.c.
I'm attaching a patch that solves the issue.

Regards,
Dan

On Thu, 2012-05-10 at 21:04 +0400, Igor Kravets wrote:
> It is 2.x release active now and the problem with "ALSA native
> support" in pjsua application still remains.
> 
> While auddemo application (compiled with ALSA native support)  works
> great both recording and playing sound through
> my aliased "duplex" alsa device (see asound.conf below) simultaneosly
> with other application
> 
> Pjsua with same compilation option DOES NOT WORK, breaking with:
> >>> pjsua8: ../src/pjmedia/conference.c:1795: get_frame: Assertion
> `frame->size == conf->samples_per_frame * conf->bits_per_sample / 8'
> failed.
> 
> 
> It is worth noting that pjsua built with portaudio DOES WORK, BUT
> works unstable and sound stops playing after 10-30 seconds of
> playback!
> Using latest external libportaudio works a little bit more stable and
> sound plays a little bit longer and then also stops.
> 
> 
> A guy called Damir also had that problem and it seems that he could
> fix things up by asound.conf magic.
> That solution doesn't work for my hardware. I've played a lot
> with asoundrc options and aliases. Nothing helps.
> 
> here's Damirs post:
> http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-February/012591.html
> 
> 
> Some other guys recommend me using external sound mixing server, which
> doesn't suite my task very well:
> http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2010-April/010721.html
> 
> 
> Problem exits. Noone yet had offered a fix, only workarounds. Maybe
> guys that created alsa_dev.c can shed some light on the problem?
> I really need help with this :(
> 
> The only thing that works with ALSA and shared soundcard  is still
> pjsua version 1.0.3.
> It also trends to just stop playing sound but really really rare
> (twice a week).
> 
> 
> == Here's how pjsua crashes after local echotest (cc 0 0): ==
> 
> TC421:~# ./pjsua8
> 20:22:01.147 os_core_unix.c !pjlib 2.0.0-beta for POSIX initialized
> 20:22:01.148 sip_endpoint.c  .Creating endpoint instance...
> 20:22:01.151          pjlib  .select() I/O Queue created (0x81bae18)
> 20:22:01.151 sip_endpoint.c  .Module "mod-msg-print" registered
> 20:22:01.151 sip_transport.  .Transport manager created.
> 20:22:01.151   pjsua_core.c  .PJSUA state changed: NULL --> CREATED
> 20:22:01.151 sip_endpoint.c  .Module "mod-pjsua-log" registered
> 20:22:01.151 sip_endpoint.c  .Module "mod-tsx-layer" registered
> 20:22:01.151 sip_endpoint.c  .Module "mod-stateful-util" registered
> 20:22:01.151 sip_endpoint.c  .Module "mod-ua" registered
> 20:22:01.151 sip_endpoint.c  .Module "mod-100rel" registered
> 20:22:01.151 sip_endpoint.c  .Module "mod-pjsua" registered
> 20:22:01.151 sip_endpoint.c  .Module "mod-invite" registered
> 20:22:01.213     alsa_dev.c  ..ALSA driver found 8 devices
> 20:22:01.213     alsa_dev.c  ..ALSA initialized
> 20:22:01.213          pjlib  ..select() I/O Queue created (0x81e94bc)
> 20:22:01.251 sip_endpoint.c  .Module "mod-evsub" registered
> 20:22:01.251 sip_endpoint.c  .Module "mod-presence" registered
> 20:22:01.251 sip_endpoint.c  .Module "mod-mwi" registered
> 20:22:01.251 sip_endpoint.c  .Module "mod-refer" registered
> 20:22:01.252 sip_endpoint.c  .Module "mod-pjsua-pres" registered
> 20:22:01.252 sip_endpoint.c  .Module "mod-pjsua-im" registered
> 20:22:01.252 sip_endpoint.c  .Module "mod-pjsua-options" registered
> 20:22:01.252   pjsua_core.c  .1 SIP worker threads created
> 20:22:01.252   pjsua_core.c  .pjsua version 2.0.0-beta for
> Linux-2.6.32.9/i686/glibc-2.9 initialized
> 20:22:01.252   pjsua_core.c  .PJSUA state changed: CREATED --> INIT
> 20:22:01.252 sip_endpoint.c  Module "mod-default-handler" registered
> 20:22:01.252   pjsua_core.c  SIP UDP socket reachable at
> 192.168.4.190:5060
> 20:22:01.252   udp0x81f09a0  SIP UDP transport started, published
> address is 192.168.4.190:5060
> 20:22:01.252    pjsua_acc.c  Adding account:
> id=<sip:192.168.4.190:5060>
> 20:22:01.252    pjsua_acc.c  .Account <sip:192.168.4.190:5060> added
> with id 0
> 20:22:01.252    pjsua_acc.c  Acc 0: setting online status to 1..
> 20:22:01.253    tcplis:5060  SIP TCP listener ready for incoming
> connections at 192.168.4.190:5060
> 20:22:01.253    pjsua_acc.c  Adding account:
> id=<sip:192.168.4.190:5060;transport=TCP>
> 20:22:01.253    pjsua_acc.c  .Account
> <sip:192.168.4.190:5060;transport=TCP> added with id 1
> 20:22:01.253    pjsua_acc.c  Acc 1: setting online status to 1..
> 20:22:01.253   pjsua_core.c  PJSUA state changed: INIT --> STARTING
> 20:22:01.253  pjsua_media.c  ..NAT type detection failed: Invalid STUN
> server or server not configured (PJNATH_ESTUNINSERVER)
> 20:22:01.253 sip_endpoint.c  .Module "mod-unsolicited-mwi" registered
> 20:22:01.253   pjsua_core.c  .PJSUA state changed: STARTING -->
> RUNNING
> >>>>
> Account list:
>   [ 0] <sip:192.168.4.190:5060>: does not register
>        Online status: Online
>  *[ 1] <sip:192.168.4.190:5060;transport=TCP>: does not register
>        Online status: Online
> Buddy list:
>  -none-
> 
> +=============================================================================+
> |       Call Commands:         |   Buddy, IM & Presence:  |
> Account:      |
> |                              |                          |
> |
> |  m  Make new call            | +b  Add new buddy       .| +a  Add
> new accnt |
> |  M  Make multiple calls      | -b  Delete buddy         | -a  Delete
> accnt. |
> |  a  Answer call              |  i  Send IM              | !a  Modify
> accnt. |
> |  h  Hangup call  (ha=all)    |  s  Subscribe presence   | rr
> (Re-)register |
> |  H  Hold call                |  u  Unsubscribe presence | ru
> Unregister    |
> |  v  re-inVite (release hold) |  t  ToGgle Online status |  >  Cycle
> next ac.|
> |  U  send UPDATE              |  T  Set online status    |  <  Cycle
> prev ac.|
> | ],[ Select next/prev call
> +--------------------------+-------------------+
> |  x  Xfer call                |      Media Commands:     |  Status &
> Config: |
> |  X  Xfer with Replaces       |                          |
> |
> |  #  Send RFC 2833 DTMF       | cl  List ports           |  d  Dump
> status   |
> |  *  Send DTMF with INFO      | cc  Connect port         | dd  Dump
> detailed |
> | dq  Dump curr. call quality  | cd  Disconnect port      | dc  Dump
> config   |
> |                              |  V  Adjust audio Volume  |  f  Save
> config   |
> |  S  Send arbitrary REQUEST   | Cp  Codec priorities     |
> |
> +-----------------------------------------------------------------------------+
> |  q  QUIT   L  ReLoad   sleep MS   echo [0|1|txt]     n: detect NAT
> type     |
> +=============================================================================+
> You have 0 active call
> >>> cc 0 0
> 20:22:08.552  pjsua_media.c  Conf connect: 0 --> 0
> 20:22:08.552  pjsua_media.c  .Set sound device: capture=-1,
> playback=-2
> 20:22:08.552    pjsua_app.c  ..Turning sound device ON
> 20:22:08.552  pjsua_media.c  ..Opening sound device PCM at 16000/1/20ms
> 20:22:08.565    ec0x81c4070  ...AEC created, clock_rate=16000,
> channel=1, samples per frame=320, tail length=200 ms, latency=99 ms
> 20:22:08.565   conference.c  .Port 0 (duplex) transmitting to port 0
> (duplex)
> Success
> >>> pjsua8: ../src/pjmedia/conference.c:1795: get_frame: Assertion
> `frame->size == conf->samples_per_frame * conf->bits_per_sample / 8'
> failed.
> 
> 
> 
> 
> 
> == my asound.conf ==
> 
> pcm.dmixer  {
>         type dmix
>         ipc_key 1024
>         slave {
>             pcm "hw:0,0"
>             period_time 0
>             rate 44100
>             period_size 1024
>             buffer_size 8192
>         }
>         bindings {
>             0 0
>             1 1
>         }
>     }
> 
> 
> pcm.conv_dmixer {
>         type plug
>         slave.pcm "dmixer"
> }
> 
> pcm.conv_record {
>         type plug
>         slave.pcm "hw:0,0"
> }
> 
> pcm.duplex {
>    type asym
>    playback.pcm "conv_dmixer"
>    capture.pcm "conv_record"
> 
>    hint {
>         show on
>         description "Duplex device"
>    }
> 
> }
> 
> pcm.!default {
>    type plug
>    slave.pcm "duplex"
> }
> 
> 
> 
> 
> _______________________________________________
> 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 --------------
A non-text attachment was scrubbed...
Name: alsa.patch
Type: text/x-patch
Size: 2060 bytes
Desc: not available
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120514/b6ae93f4/attachment.patch>


[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