Problems playback resampled audio(AC97) on ARM(linux)

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

 



Hello.
My configuration:
mashine	at91sam9263
OS	linux-2.6.28
sound system alsa
driver	ac97c

When I play the files through playfile - everything works fine.
but when I'm the same file played through resamlefile - played only the
first frame.
After that audio stream freezes.
I found the FAQ on the site with description of the work through
splitcomb and rewrote the source code like this:

------cut---------

    /* Calculate number of samples per frame to be taken from file port */
    ptime = samples_per_frame * 1000 / sampling_rate;

    /* Create the file port. */
    status = pjmedia_wav_player_port_create( pool, argv[pj_optind], ptime, 0,
					     0, &file_port);
    if (status != PJ_SUCCESS) {
	app_perror(THIS_FILE, "Unable to open file", status);
	return 1;
    }

    /* File must have same number of channels. */
    if (file_port->info.channel_count != (unsigned)channel_count) {
	PJ_LOG(3,(THIS_FILE, "Error: file has different number of channels. "
			     "Perhaps you'd need -c option?"));
	pjmedia_port_destroy(file_port);
	return 1;
    }

    /* Create the resample port. */

    status = pjmedia_resample_port_create( pool, file_port,
					   sampling_rate, 0,
					   &resample_port);
    if (status != PJ_SUCCESS) {
	app_perror(THIS_FILE, "Unable to create resample port", status);
	return 1;
    }

    pjmedia_splitcomb_create(
        pool,
        sampling_rate, /*CLOCK_RATE*/
        1,
        samples_per_frame, /*SAMPLES_PER_FRAME*/
        bits_per_sample, /*BITS*/
        0,
        &splitcomb
        );
    pjmedia_splitcomb_create_rev_channel(
        pool,
        splitcomb,
        0,
        0,
        &rev
        );    /* Create sound player port. */

    status = pjmedia_snd_port_create( 
		 pool,			/* pool			    */
		 dev_id,		/* device		    */
		 dev_id,		/* device		    */
		 sampling_rate,		/* clock rate.		    */
		 channel_count,		/* # of channels.	    */
		 samples_per_frame,	/* samples per frame.	    */
		 bits_per_sample,	/* bits per sample.	    */
		 0,			/* options		    */
		 &snd_port		/* returned port	    */
		 );
    if (status != PJ_SUCCESS) {
	app_perror(THIS_FILE, "Unable to open sound device", status);
	return 1;
    }

    /* Connect resample port to sound device */
    status = pjmedia_snd_port_connect( snd_port, splitcomb);
    if (status != PJ_SUCCESS) {
	app_perror(THIS_FILE, "Error connecting sound ports", status);
	return 1;
    }

    pjmedia_master_port_create (pool, rev, resample_port, 0, &m);
    pjmedia_master_port_start (m);
    /* Dump memory usage */
    dump_pool_usage(THIS_FILE, &cp);

------cut---------


Out of program:

------cut---------
 10:17:06.380 os_core_unix.c  pjlib 1.8.10 for POSIX initialized
 10:17:06.509       pa_dev.c  PortAudio sound library initialized, status=0
 10:17:06.509       pa_dev.c  PortAudio host api count=1
 10:17:06.509       pa_dev.c  Sound device count=1
 10:17:06.511          pjlib  select() I/O Queue created (0x7601c)
 10:17:06.515   wav_player.c  File player 'Front_Center.wav' created: samp.rate=48000, ch=1, bufsize=4KB, filesize=137KB
 10:17:06.515     resample.c  resample created: high qualiy, large filter, in/out rate=48000/16000
 10:17:06.516     resample.c  resample created: high qualiy, large filter, in/out rate=16000/48000
 10:17:06.539       pa_dev.c  Opened device /dev/dsp(OSS)//dev/dsp(OSS) for recording and playback, sample rate=16000, ch=1, bits=16, 320 samples per frame, input latency=96 ms, output latency=96 ms
 10:17:06.539       pa_dev.c  Starting /dev/dsp stream..
 10:17:06.573       pa_dev.c  Recorder thread started
 10:17:06.573 os_core_unix.c  Info: possibly re-registering existing thread
 10:17:06.573       pa_dev.c  Player thread started
 10:17:06.574       pa_dev.c  Done, status=0
 10:17:06.574 resampleplay.c  Total pool memory allocated=67 KB, used=63 KB
 10:17:06.594     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:06.607     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame
 10:17:06.630     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame
 10:17:06.654     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame
Playing Front_Center.wav at sampling rate 16000 (original file sampling rate=48000)

Press <ENTER> to stop playing and quit
 10:17:06.678     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame
 10:17:06.678     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame
 10:17:06.720     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame
 10:17:06.747     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame
 10:17:06.773     scombdb-dn  320 samples reduced, buf_cnt=2240
 10:17:06.773     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.153     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.234     scombdb-up  481 samples reduced, buf_cnt=2079
 10:17:07.234     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.315     scombdb-up  401 samples reduced, buf_cnt=1998
 10:17:07.315     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.383     scombdb-up  98 samples reduced, buf_cnt=2220
 10:17:07.383     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.464     scombdb-up  529 samples reduced, buf_cnt=2011
 10:17:07.464     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.545     scombdb-up  91 samples reduced, buf_cnt=2240
 10:17:07.545     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.612     scombdb-up  379 samples reduced, buf_cnt=2181
 10:17:07.613     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.694     scombdb-up  492 samples reduced, buf_cnt=2009
 10:17:07.694     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.775     scombdb-up  98 samples reduced, buf_cnt=2231
 10:17:07.775     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.842     scombdb-up  385 samples reduced, buf_cnt=2166
 10:17:07.842     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:07.923     scombdb-up  356 samples reduced, buf_cnt=2130
 10:17:07.923     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:08.004     scombdb-up  316 samples reduced, buf_cnt=2134
 10:17:08.004     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:08.072     scombdb-up  220 samples reduced, buf_cnt=2234
 10:17:08.072     scombdb-dn  Underflow, buf_cnt=0, will generate 1 frame
 10:17:08.153     scombdb-up  351 samples reduced, buf_cnt=2203
 10:17:08.153      scomb-rev  Pausing media flow on downstream direction (level=-14)
 10:17:08.175      scomb-rev  Pausing media flow on upstream direction (level=14)
 10:17:09.206   wav_player.c  File port Front_Center.wav EOF
 10:17:09.206   wav_player.c 

------cut---------

What's the problem?
Please, help





[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