[pjsip] testing the new sound driver for the iPhone

Samuel Vinson samuelv at laposte.net
Tue Dec 29 16:39:07 EST 2009


It seems it's impossible to open sound device from console on iPhone.
Could you try with sound file with sample rate to 8khz.

Samuel

Torsten Curdt a écrit :
> To get started with pjsip on the iPhone I wanted to try the new audio
> driver (thanks, Samuel!).
> Unfortunately the following code fails for me on both the Simulator
> and the iPhone
>
> 22:01:28.145 os_core_unix.c  pjlib 1.5 for POSIX initialized
> 22:01:28.159          pjlib  select() I/O Queue created (0x811014)
> 22:01:28.188   wav_player.c  File player '../MyTest.app/test.wav'
> created: samp.rate=44100, ch=2, bufsize=4KB, filesize=541KB
> 2009-12-29 22:01:28.193 MyTest[9418:207] Failed to create sound port player
>
> Here is the code. Anything obvious I am doing wrong?
>
>     status = pj_init();
>
>     pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
>
>     status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
>
>     pool = pj_pool_create( &cp.factory,     /* pool factory         */
>                            "wav",           /* pool name.           */
>                            4000,            /* init size            */
>                            4000,            /* increment size       */
>                            NULL             /* callback on error    */
>                            );
>
>
>     NSString *path = [[NSBundle mainBundle] pathForResource:@"test"
> ofType:@"wav"];
>     const char *file = [path UTF8String];
>     [path retain];
>
>     status = pjmedia_wav_player_port_create(  pool,     /* memory pool      */
>                                               file,  /* file to play     */
>                                               20,       /* ptime.           */
>                                               0,        /* flags            */
>                                               0,        /* default buffer   */
>                                               &file_port/* returned port    */
>                                               );
>     if (status != PJ_SUCCESS) {
>         NSLog(@"Failed to create wav player port");
>         return;
>     }
>
> 	// this fails
>     status = pjmedia_snd_port_create_player(
>                  pool,                              /* pool                 */
>                  -1,                                /* use default dev.     */
>                  file_port->info.clock_rate,        /* clock rate.          */
>                  file_port->info.channel_count,     /* # of channels.       */
>                  file_port->info.samples_per_frame, /* samples per frame.   */
>                  file_port->info.bits_per_sample,   /* bits per sample.     */
>                  0,                                 /* options              */
>                  &snd_port                          /* returned port        */
>                  );
>
>     if (status != PJ_SUCCESS) {
>         NSLog(@"Failed to create sound port player");
>         return;
>     }
>
>     status = pjmedia_snd_port_connect( snd_port, file_port);
>
>     if (status != PJ_SUCCESS) {
>         NSLog(@"Failed to create sound port");
>         return;
>     }
>
> cheers
> --
> Torsten
>
> _______________________________________________
> 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
>
>
>   





More information about the pjsip mailing list