linphone-developers
[Top][All Lists]
Advanced

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

[Linphone-developers] Inconsistent sample size in alsa_read_process()


From: David Zimmerli
Subject: [Linphone-developers] Inconsistent sample size in alsa_read_process()
Date: Sun, 13 Nov 2022 22:04:39 +0000 (UTC)

Hello, I'm looking at linphone-3.6.1, in the file mediastreamer2/src/audiofilters/alsa.c.

In the alsa_read_process() routine, non-threaded version, line 919, it says:

int samples=(128*ad->rate)/8000;

This filter is being run by a ticker running at 100 ticks per second, with a sampling rate of 16000 samples per second.  So I would have thought there should be 160 samples per tick.  Instead this formula gives (128*16000)/8000 = 256 samples.  Why the disparity here?

I put in some tracing code and it seems that on quite a few ticks there are no samples returned, which is to be expected if more samples are requested on each tick than are available from the driver.  The audio being captured also sounds somewhat scratchy and staticky, and I'm wondering if this is the reason because it sounds fine when I record using parecord.

In the threaded version of alsa_read_process() it says

int samples=(160*ad->rate)/8000;

which also seems inconsistent.

Any help/explanation would be much appreciated.

Thanks,
David


reply via email to

[Prev in Thread] Current Thread [Next in Thread]