[pjmedia] Unable to find default audio device on Android

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

 



Mm, I tried both of them, openSL-ES and java default and I get the same
error.

When I execute:

pjmedia_snd_port_create(_pool, -1, -1, _stream_port->info.clock_rate,
_stream_port->info.channel_count, _stream_port->info.samples_per_frame,
_stream_port->info.bits_per_sample, 0, &_snd_port);

I get the crash that I pasted before.

Do you have any idea why I get the crash when I execute that line?

Where in CSipSimple do you call to create stream?

Many thanks!

2011/10/11 R?gis Montoya <r3gis.3r at gmail.com>

>  Mmmm, weird. The two warning are not a good sign.
> I've read the android source code of the openSL-ES implementation and it is
> still a very early state. (I didn't found so much doc and the only way I
> found to make it work was to read the android source code).
> Since it is very early state, they do not really return a real status of
> what is going on. So could return success and does not have the object
> behind.
> Depending on the ROM you are using the backend for openSL-ES can not be
> correctly implemented.
> I'd advise in a first time to rely on the java implementation of the
> device. Anyway, for now, there is no android device that implements
> opensl-es with direct connection to the audio driver. So the java and the
> opensl-es implementation have almost same performance.
>
>
> On 11/10/2011 18:22, Isidoro Castell Egea wrote:
>
> Great!
>
> You are right I forgot add these lines.
>
> Now I can go on, but I get a crash. And 2 warnings when I execute
> pjmedia_aud_register_factory.
>
> These are the 2 warnings:
>
> 10-11 18:11:30.530: WARN/libOpenSLES(22878): class Engine interface 0
> requested but unavailable MPH=6
> 10-11 18:11:30.530: WARN/libOpenSLES(22878): class Engine interface 1
> requested but unavailable MPH=8
>
> But it returning 0 so everything could be allright.
>
> And below is the crash:
>
> 10-11 18:11:30.648: INFO/DEBUG(22079): *** *** *** *** *** *** *** *** ***
> *** *** *** *** *** *** ***
> 10-11 18:11:30.648: INFO/DEBUG(22079): Build fingerprint:
> 'samsung/GT-I9000/GT-I9000:2.3.4/GINGERBREAD/XXJVR:user/release-keys'
> 10-11 18:11:30.648: INFO/DEBUG(22079): pid: 22878, tid: 22878  >>>
> com.csipsimple <<<
> 10-11 18:11:30.648: INFO/DEBUG(22079): signal 11 (SIGSEGV), code 1
> (SEGV_MAPERR), fault addr 00000000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  r0 00000000  r1 00001f40  r2
> b77706d8  r3 b77706d8
> 10-11 18:11:30.648: INFO/DEBUG(22079):  r4 0043fd7c  r5 bea96f34  r6
> 81324204  r7 0043fd18
> 10-11 18:11:30.648: INFO/DEBUG(22079):  r8 002b0714  r9 00000268  10
> 00000140  fp 8127e161
> 10-11 18:11:30.648: INFO/DEBUG(22079):  ip ffffff1c  sp bea96e08  lr
> 81248aa5  pc 8123e70e  cpsr 60000030
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d0  6172662f73656c61  d1
> 68632031202c656e
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d2  4320207070632e6e  d3
> 7473206574616565
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d4  38203a206d616572  d5
> 706d617320303030
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d6  2c6365732f73656c  d7
> 6d61732030363120
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d8  0000000000000000  d9
> 0000000000000000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d10 0000000000000000  d11
> 0000000000000000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d12 0000000000000000  d13
> 0000000000000000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d14 0000000000000000  d15
> 0000000000000000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d16 4177518808000000  d17
> 3fe0000000000000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d18 3feff985c46d85eb  d19
> 3f49e8ee49e85400
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d20 3c87000000000000  d21
> 3f1145b88564c411
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d22 3e21ee94a0c6d216  d23
> bda8fae9be8838d4
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d24 0000000000000000  d25
> 0000000000000000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d26 0000000000000000  d27
> 0000000000000000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d28 0002aaa80002aaa8  d29
> 0002aaa80002aaa8
> 10-11 18:11:30.648: INFO/DEBUG(22079):  d30 0001000000010000  d31
> 0001000000010000
> 10-11 18:11:30.648: INFO/DEBUG(22079):  scr 20000012
> 10-11 18:11:30.760: INFO/StatusBarPolicy(407): onSignalStrengthsChanged
> 10-11 18:11:30.838: INFO/DEBUG(22079):          #00  pc 0003e70e
> /data/data/com.csipsimple/lib/libpjsipjni.so
> 10-11 18:11:30.838: INFO/DEBUG(22079):          #01  pc 00048aa0
> /data/data/com.csipsimple/lib/libpjsipjni.so
> 10-11 18:11:30.838: INFO/DEBUG(22079):          #02  pc 0008681a
> /data/data/com.csipsimple/lib/libpjsipjni.so
> 10-11 18:11:30.838: INFO/DEBUG(22079):          #03  pc 0007df94
> /data/data/com.csipsimple/lib/libpjsipjni.so
> 10-11 18:11:30.838: INFO/DEBUG(22079):          #04  pc 0007e250
> /data/data/com.csipsimple/lib/libpjsipjni.so
> 10-11 18:11:30.840: INFO/DEBUG(22079):          #05  pc 00048258
> /data/data/com.csipsimple/lib/libpjsipjni.so
> 10-11 18:11:30.840: INFO/DEBUG(22079):          #06  pc 00044396
> /data/data/com.csipsimple/lib/libpjsipjni.so
> 10-11 18:11:30.844: INFO/DEBUG(22079):          #07  pc 00017e74
> /system/lib/libdvm.so
> 10-11 18:11:30.844: INFO/DEBUG(22079):          #08  pc 00049720
> /system/lib/libdvm.so
> 10-11 18:11:30.844: INFO/DEBUG(22079):          #09  pc 0001d074
> /system/lib/libdvm.so
> 10-11 18:11:30.844: INFO/DEBUG(22079):          #10  pc 00022124
> /system/lib/libdvm.so
> 10-11 18:11:30.844: INFO/DEBUG(22079):          #11  pc 0002101c
> /system/lib/libdvm.so
> 10-11 18:11:30.846: INFO/DEBUG(22079):          #12  pc 0005fe1e
> /system/lib/libdvm.so
> 10-11 18:11:30.846: INFO/DEBUG(22079):          #13  pc 00067bea
> /system/lib/libdvm.so
> 10-11 18:11:30.846: INFO/DEBUG(22079):          #14  pc 0001d074
> /system/lib/libdvm.so
> 10-11 18:11:30.846: INFO/DEBUG(22079):          #15  pc 00022124
> /system/lib/libdvm.so
> 10-11 18:11:30.846: INFO/DEBUG(22079):          #16  pc 0002101c
> /system/lib/libdvm.so
> 10-11 18:11:30.846: INFO/DEBUG(22079):          #17  pc 0005fc80
> /system/lib/libdvm.so
> 10-11 18:11:30.848: INFO/DEBUG(22079):          #18  pc 0004c166
> /system/lib/libdvm.so
> 10-11 18:11:30.850: INFO/DEBUG(22079):          #19  pc 00038c26
> /system/lib/libandroid_runtime.so
> 10-11 18:11:30.850: INFO/DEBUG(22079):          #20  pc 0003a612
> /system/lib/libandroid_runtime.so
> 10-11 18:11:30.852: INFO/DEBUG(22079):          #21  pc 00008cca
> /system/bin/app_process
> 10-11 18:11:30.856: INFO/DEBUG(22079):          #22  pc 00014bb2
> /system/lib/libc.so
> 10-11 18:11:30.856: INFO/DEBUG(22079): code around pc:
> 10-11 18:11:30.856: INFO/DEBUG(22079): 8123e6ec 48044601 4478b510 68036800
> 47986d1b
> 10-11 18:11:30.856: INFO/DEBUG(22079): 8123e6fc bf00bd10 000e947a 48044601
> 4478b510
> 10-11 18:11:30.856: INFO/DEBUG(22079): 8123e70c 68036800 47986ddb bf00bd10
> 000e9462
> 10-11 18:11:30.856: INFO/DEBUG(22079): 8123e71c b5104803 68004478 6e1b6803
> bd104798
> 10-11 18:11:30.858: INFO/DEBUG(22079): 8123e72c 000e944c b5104803 68004478
> 6e5b6803
> 10-11 18:11:30.858: INFO/DEBUG(22079): code around lr:
> 10-11 18:11:30.858: INFO/DEBUG(22079): 81248a84 f8c4a0a0 68a00090 faecf05a
> 00a4f8c4
> 10-11 18:11:30.858: INFO/DEBUG(22079): 81248a94 ffacf055 f3002802 68e88087
> fe30f7f5
> 10-11 18:11:30.858: INFO/DEBUG(22079): 81248aa4 f6464602 f2c000a9 2a000006
> 4be4d12e
> 10-11 18:11:30.858: INFO/DEBUG(22079): 81248ab4 0b80f10d 0c02f04f c024f8cd
> f04f447b
> 10-11 18:11:30.858: INFO/DEBUG(22079): 81248ac4 f1030a04 c9030170 0003e88b
> 910a6929
> 10-11 18:11:30.858: INFO/DEBUG(22079): stack:
> 10-11 18:11:30.858: INFO/DEBUG(22079):     bea96dc8  00000002
> 10-11 18:11:30.858: INFO/DEBUG(22079):     bea96dcc  b77706d8
> ( ... )
>
> I paste the code below that retrieve the crash:
>
> PJ_DECL(pj_bool_t) CreateStream( const char *remoteAddress, const char
> *codec )
> {
>     const pjmedia_codec_info *codec_info;
>     pjmedia_codec_param       codec_param;
>
>     char          *codec_id = NULL;
>     pj_status_t    status;
>     pj_sockaddr_in remote_addr;
>
>     if ( _stream_started ) return NO;
>
>     char *remote_addr_str = (char *) remoteAddress;
>
>     if ( codec != NULL )
>     {
>         codec_id = (char *) codec;
>     }
>
>     // Find which codec to use.
>     if ( codec_id )
>     {
>         unsigned count = 1;
>         pj_str_t str_codec_id = pj_str( codec_id );
>         pjmedia_codec_mgr *codec_mgr =
> pjmedia_endpt_get_codec_mgr(_med_endpt);
>         status = pjmedia_codec_mgr_find_codecs_by_id( codec_mgr,
> &str_codec_id, &count, &codec_info, NULL);
>
>         if ( status != PJ_SUCCESS )
>         {
>             LOGI( "[MediaManager startStream] - Error: unable to find codec
> %s\n", codec_id );
>             return status;
>         }
>     }
>     else
>     {
>         // Default to pcmu
>         pjmedia_codec_mgr_get_codec_info(
> pjmedia_endpt_get_codec_mgr(_med_endpt), 0, &codec_info);
>     }
>
>     // set remote address
>     pj_bzero(&remote_addr, sizeof(remote_addr));
>
>     pj_str_t ip = pj_str( strtok(remote_addr_str, ":") );
>     pj_uint16_t port = (pj_uint16_t) atoi(strtok(NULL, ":"));
>
>     status = pj_sockaddr_in_init(&remote_addr, &ip, port);
>     if (status != PJ_SUCCESS)
>     {
>         LOGE( "[MediaManager startStream] - Invalid remote address" );
>         return status;
>     }
>
>     // Get codec default param for info
>     status = pjmedia_codec_mgr_get_default_param(
> pjmedia_endpt_get_codec_mgr(_med_endpt), codec_info, &codec_param );
>
>     // Disable VAD capabilities
>     codec_param.setting.vad = 0;
>
>     status = pjmedia_codec_mgr_set_default_param(
> pjmedia_endpt_get_codec_mgr(_med_endpt), codec_info, &codec_param );
>
>     // create stream based on program arguments
>     status = create_stream(_pool, _med_endpt, codec_info, _dir, _localPort,
> &remote_addr, &_stream);
>
>     if (status != PJ_SUCCESS)
>     {
>         DestroyStream();
>         return status;
>     }
>
>     // Should be ok, as create_stream() above succeeded
>     pj_assert(status == PJ_SUCCESS);
>
>     // Get the port interface of the stream
>     status = pjmedia_stream_get_port( _stream, &_stream_port );
>     PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
>
>     // Create sound device port.
>     if ( _dir == PJMEDIA_DIR_ENCODING_DECODING )
>     {
>         status = pjmedia_snd_port_create(_pool, -1, -1,
>                                          _stream_port->info.clock_rate,
>                                          _stream_port->info.channel_count,
>
> _stream_port->info.samples_per_frame,
>
> _stream_port->info.bits_per_sample,
>                                          0, &_snd_port);
>     }
>     else if ( _dir == PJMEDIA_DIR_ENCODING )
>     {
>         status = pjmedia_snd_port_create_rec(_pool, -1,
>                                              _stream_port->info.clock_rate,
>
> _stream_port->info.channel_count,
>
> _stream_port->info.samples_per_frame,
>
> _stream_port->info.bits_per_sample,
>                                              0, &_snd_port);
>     }
>     else
>     {
>         status = pjmedia_snd_port_create_player(_pool, -1,
>
> _stream_port->info.clock_rate,
>
> _stream_port->info.channel_count,
>
> _stream_port->info.samples_per_frame,
>
> _stream_port->info.bits_per_sample,
>                                                 0, &_snd_port);
>     }
>
>     if ( status != PJ_SUCCESS )
>     {
>         LOGE( "[MediaManager startStream] - Unable to create sound port,
> erroCode = %i",status );
>         DestroyStream();
>         return status;
>     }
>
>     _stream_started = YES;
>     return status;
> }
>
> Again many many thanks.
>
> Best regards,
> Isidoro.
>
>  2011/10/11 R?gis Montoya <r3gis.3r at gmail.com>
>
>> Ok,
>>
>> So as you have your own entry point different from csipsimple's one, maybe
>> you forgot to report these lines :
>>
>>
>> http://code.google.com/p/csipsimple/source/browse/trunk/pjsip_android/apps/pjsip/project/jni/src/pjsua_jni_addons.c#435
>>
>> In your case it is this one :
>>
>> pjmedia_aud_register_factory(&pjmedia_opensl_factory);
>>
>> (Even if I'd advise you to add both lines with the define tests around).
>> With this done, pjsip will find the valid aud factory when trying to
>> retrieve an audio device factory for current device.
>>
>>
>>
>> Le mar. 11 oct. 2011 16:48:16 CEST, Isidoro Castell Egea a ?crit :
>>
>>>
>>> Hi R?gis,
>>>
>>> First of all thanks for your quickly reply. I'm building the library
>>> from CSipSimple project as you say I use pjsip_android subfolder.
>>>
>>> I try to compile with 2.3 compatibility instead 1.5 but I get the same
>>> error code (420006). I can't use CSipSimple directly because I don't
>>> use sip part, so I make some native functions in c that do the hard work.
>>>
>>> Do you have any idea about I'm doing bad?
>>>
>>> I paste my Application.mk below:
>>>
>>> APP_PROJECT_PATH := $(call my-dir)/../../../CSipSimple
>>> #APP_PROJECT_PATH := $(call my-dir)/project
>>> APP_BUILD_SCRIPT= := $(call my-dir)/project/build/Android.mk
>>> #APP_OPTIM := debug
>>> APP_OPTIM := release
>>> APP_ABI := armeabi armeabi-v7a
>>> #APP_ABI := armeabi-v7a
>>> #APP_ABI := armv4t
>>> APP_STL := stlport_static
>>>
>>>
>>> MY_USE_G729 := 1
>>> MY_USE_ILBC := 0
>>> MY_USE_G722 := 1
>>> MY_USE_G7221 := 0
>>> MY_USE_SPEEX := 1
>>> MY_USE_GSM := 1
>>> MY_USE_SILK := 1
>>> MY_USE_CODEC2 := 0
>>> MY_USE_TLS := 0
>>> MY_USE_WEBRTC := 0
>>>
>>> MY_ANDROID_DEV := 2
>>>
>>> BASE_PJSIP_FLAGS := -DPJ_ANDROID=1
>>> -DPJMEDIA_HAS_G729_CODEC=$(MY_USE_G729) \
>>> -DPJMEDIA_HAS_ILBC_CODEC=$(MY_USE_ILBC)
>>> -DPJMEDIA_HAS_G722_CODEC=$(MY_USE_G722) \
>>> -DPJMEDIA_HAS_SPEEX_CODEC=$(MY_USE_SPEEX)
>>> -DPJMEDIA_HAS_GSM_CODEC=$(MY_USE_GSM) \
>>> -DPJMEDIA_HAS_SILK_CODEC=$(MY_USE_SILK)
>>> -DPJMEDIA_HAS_CODEC2_CODEC=$(MY_USE_CODEC2) \
>>> -DPJMEDIA_HAS_G7221_CODEC=$(MY_USE_G7221)
>>> -DPJMEDIA_HAS_WEBRTC_CODEC=$(MY_USE_WEBRTC) \
>>> -DPJ_HAS_SSL_SOCK=$(MY_USE_TLS) -DPJMEDIA_HAS_ZRTP=$(MY_USE_TLS) \
>>> -DPJ_ANDROID_DEVICE=$(MY_ANDROID_DEV)
>>>
>>> I don't use Webrtc so I desactivated it.
>>>
>>> You said "pjsip_android sub project also includes other specific glues
>>> for android." What are this includes? And where I can find this file?
>>>
>>> Many thanks!
>>>
>>> BR,
>>> Isidoro.
>>>
>>>  2011/10/11 R?gis Montoya <r3gis.3r at gmail.com <mailto:r3gis.3r at gmail.com>>
>>>
>>>
>>>
>>> Hi Isidorio,
>>>
>>> Did you try to build the library from CSipSimple project or a
>>> direct build of pjsip from trunk?
>>>
>>> If you use pjsip from trunk, keep in mind that Android is not yet
>>> support by pjsip trunk.
>>> So, obviously the glue with android audio device is not included
>>> in pjsip, and as consequence it's absolutely normal that it does
>>> not find the android device, and that your lib cries about the
>>> fact it does not find any glue for this audio device.
>>>
>>> You should have a look to csipsimple/pjsip_android sub project. It
>>> includes two implementation of the audio device for android. One
>>> works from android 1.5 and is based on the android java API (it
>>> requires to add something in your glue, but if you reuse
>>> pjsip_android project, everything is included), another is based
>>> on the new OpenSL-ES API introduced in android 2.3 (and is
>>> available only from android 2.3 and upper).
>>>
>>> pjsip_android sub project also includes other specific glues for
>>> android. I'm currently finishing the port of the timer
>>> implementation so that it will use android alarms instead of a
>>> running thread that consume a lot of CPU.
>>>
>>> Regards,
>>> R?gis
>>>
>>>
>>> On 11/10/2011 15:07, Isidoro Castell Egea wrote:
>>>
>>>>
>>>> Hi all,
>>>>
>>>> I'm developing an android app wich integrate pjmedia in order to
>>>> transfer audio each devices. I can initialize media manager, but
>>>> when I try to create a stream I get "Unable to find default audio
>>>> device" (PJMEDIA_EAUD_NODEFDEV = 420006) from lookup_dev() call
>>>> in audiodev.c. And I cannot continue with the stream creation.
>>>>
>>>> Anyone knows why I get 420006 return code when I call
>>>> lookup_dev()? Could be privileges matters?
>>>>
>>>> Many many thanks in advance!
>>>>
>>>> BR,
>>>> Isidoro.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>>
>>>
>>> --
>>> Isidoro Castell
>>> Android developer
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>
>
>
> --
> Isidoro Castell
> Android developer
>
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing listpjsip at lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
>


-- 
Isidoro Castell
Android developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20111012/821f8f6f/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