testing the new sound driver for the iPhone

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

 



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



[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