Aufile audio_source is not able to play WAV files on the RTP plane

635 views
Skip to first unread message

Piyush Pal

unread,
Sep 26, 2022, 2:14:16 PM9/26/22
to baresip
Hello!


We are working on a P2P VoIP Android client application by using the Libbaresip project(https://github.com/juha-h/libbaresip-android) which internally uses the Baresip project(https://github.com/baresip/baresip).

Our requirement is to play an audio WAV file as soon as the call gets connected with the remote party. We found that the aufile module can be used as an audio source to play WAV files on the RTP plane. 

We tried changing the audio_source to aufile,/data/local/tmp/sounds/sample.wav to test the functionality. But it does not work. No audio is heard on the remote end. 

The reading of the WAV file I guess is all fine. Aufile is able to fetch the buffer, the srate, channel, fmt, etc properly from the audio WAV file. But while creating frames out of the audio buffer, the srate and channel become zero. Even tried using the auresamp module but no luck so far. It throws an invalid argument error. 

Please find the logs and the configuration file attached. 
Can anyone please help in resolving this issue?


Thanks, and Regards
Piyush
config
sample.wav
aufile_no_audio.log

Piyush Pal

unread,
Sep 26, 2022, 2:20:59 PM9/26/22
to baresip
1. Audio file read
2022-09-26 23:15:46.458  1251-1490  Baresip Lib             com.tutpro.baresip                   D  audio: start
2022-09-26 23:15:46.458  1251-1490  Baresip Lib             com.tutpro.baresip                   D  aufile: loading input file '/data/local/tmp/sounds/sample.wav'
2022-09-26 23:15:46.459  1251-1490  Baresip Lib             com.tutpro.baresip                   D  aufile: /data/local/tmp/sounds/sample.wav: 8000 Hz, 1 channels, S16LE
                                                                                                    aufile: audio ptime=20 sampc=160 srate=8000 channel=1
2022-09-26 23:15:46.460  1251-1490  Baresip Lib             com.tutpro.baresip                   D  aufile: read end of file
                                                                                                    aufile: loaded 150400 bytes
2022-09-26 23:15:46.461  1251-1490  Baresip Lib             com.tutpro.baresip                   D  audio: source started with sample format S16LE
                                                                                                    audio tx pipeline:      aufile ---> aubuf ---> auresamp ---> opus
                                                                                                    audio rx pipel
2022-09-26 23:15:46.461  1251-1490  Baresip Lib             com.tutpro.baresip                   D  ine:    opensles <--- aubuf <--- auresamp <--- opus


2. Call established
2022-09-26 23:15:46.462  1251-1488  Baresip Lib             com.tutpro.baresip                   D  ua event (CALL_ESTABLISHED) sip:56...@192.168.0.100

3. SRate and Channel become zero while creating the audio frames 

2022-09-26 23:15:46.465  1251-1490  Baresip Lib             com.tutpro.baresip                   D  audio::auframe_init: fmt=0, srate=8000, ch=1
2022-09-26 23:15:46.465  1251-1490  Baresip Lib             com.tutpro.baresip                   D  audio::aubuf_read_auframe: fmt=0, srate=0, ch=0
                                                                                                    auresam: resample encoder 0/0 --> 16000/1
                                                                                                    [31mresample: auresamp error (Invali
2022-09-26 23:15:46.465  1251-1490  Baresip Lib             com.tutpro.baresip                   D  d argument [22])
                                                                                                    [;m [31maudio: aufilter encode: Invalid argument [22]
                                                                                                    [;m [31maudio: srate/ch of frame 0/0 vs audio codec 16
2022-09-26 23:15:46.465  1251-1490  Baresip Lib             com.tutpro.baresip                   D  000/1. Use module auresamp!

And this keeps on happening until all the frames are made.
Message has been deleted
Message has been deleted

word garner

unread,
Oct 8, 2022, 4:56:45 AM10/8/22
to baresip

me too
recently , I patched  barsip release v2.8.1
same case ,  It did not play wav file


bare/src/audio.c

static void poll_aubuf_tx(struct audio *a)
{
....
        auframe_init(&af, tx->src_fmt, sampv, sampc, srate, ch);
        info("audio: poll_aubuf_tx() before aubuf_read_auframe  :  %uHz %dch, fmt:%d, sampc:%d, level:%d sampv:%p \n", af.srate, af.ch,af.fmt,af.sampc,af.level,af.sampv);
        aubuf_read_auframe(tx->aubuf, &af);
        info("audio: poll_aubuf_tx() after aubuf_read_auframe :  %uHz %dch, fmt:%d, sampc:%d, level:%d sampv:%p \n", af.srate, af.ch,af.fmt,af.sampc,af.level,af.sampv);
        af.srate = srate;
        af.ch = ch;



log
[17:35:46.777][0000]audio: poll_aubuf_tx() before aubuf_read_auframe  :  8000Hz 1ch, fmt:0, sampc:160, level:13836144 sampv:0xc060000000000000
[17:35:46.778][0000]audio: poll_aubuf_tx() after aubuf_read_auframe :  0Hz 0ch, fmt:0, sampc:160, level:13836144 sampv:0xc060000000000000

// temp resolving -->
        af.srate = srate;
        af.ch = ch;

2022년 9월 27일 화요일 오전 3시 20분 59초 UTC+9에 palpi...@gmail.com님이 작성:

Piyush Pal

unread,
Oct 11, 2022, 3:30:26 AM10/11/22
to baresip
Hey! Thanks a lot!
We are now able to play WAV files now.

Christian Spielberger

unread,
Nov 28, 2022, 3:16:42 AM11/28/22
to baresip
Do you have a fix? If so, please could you create a PR or at least create an issue on github?
https://github.com/baresip/baresip

r,c

word garner

unread,
Dec 17, 2022, 4:02:12 AM12/17/22
to baresip
1. issued
https://github.com/baresip/baresip/issues/2293

2. fixed
https://github.com/baresip/baresip/pull/2325

3. changing parts
https://github.com/baresip/baresip/pull/2325/commits/ee440862290d04c56a7e0976f0c53038e7e08c05

2022년 11월 28일 월요일 오후 5시 16분 42초 UTC+9에 Christian Spielberger님이 작성:
Reply all
Reply to author
Forward
0 new messages