Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS rustle in audio #4032

Open
ednt opened this issue Aug 8, 2024 · 3 comments
Open

macOS rustle in audio #4032

ednt opened this issue Aug 8, 2024 · 3 comments

Comments

@ednt
Copy link

ednt commented Aug 8, 2024

Describe the bug

The RTP stream is clear without rustle (checked with wireshark)
But there is loud rustle to hear.

To check that it is not our application, I checked the app opensource 'Telephone' which uses also PJSIP.
Same loud rustle.

But the only thing we do is to tell PJSIP which audio devices should be used.

From where comes the rustle?

Steps to reproduce

Install 'Telephone' on your macOS and try different incomming calls.

PJSIP version

We use 2.14.1

Context

It happens on MacOS.

Log, call stack, etc

The logs are ok, since the call itself is Ok.
@nanangizz
Copy link
Member

To reproduce audio quality issue, could you describe more, e.g: which codec you are using, whether it works fine with default/built-in audio device (if applicable), audio device settings (some audio device may have issues when opened using non-native clock rates, native is usually 48.1k or 44.1kHz & stereo).

@ednt
Copy link
Author

ednt commented Aug 14, 2024

The customer PBX uses only PCMA.
But as written, the wireshark capture has a clear output, without rustle.
In the meantime I told the customer to test 'Telefon' a freeware in the app store which uses also PJSIP.
I hoped it is a bug from us, but the customer has the same rustle with 'Telefon'.

But if the customer uses linphone the sound is clear.

We also have volume problems. everything is very quiet.
I think the rustle comes from a very high amplification of the sound.

The customer tested it with the inbuild microphone and loudspeaker and also with a headset.

@nanangizz
Copy link
Member

Ok, generally here are the audio processing steps in receiving direction:

  1. packet reordering, latency monitor & control (by jitter buffer)
  2. audio payload decoding (by codec)
  3. audio playback (by sound device)
    Now let's try to pinpoint the issue. For simplicity, I will use pjsua sample app.

First, try to record the audio before played back to speaker, this can be done by connecting stream port to a WAV file recorder port (beside to sound-device/speaker port) in the conference bridge. Using pjsua sample app, you can use param --rec-file=[file-path] then connect ports using cc command or just add --auto-rec to automatically record audio calls. To enable only PCMA codec, you can use pjsua param --dis-codec * --add-codec pcma. Note that here the media uses sound device clock, so if the recorded audio is not clear, perhaps the clock is too skewed (so frame-generation/PLC or frame discard frequently occurs), try with null sound device by adding param --null-audio.

If audio is okay, the issue should not be introduced by processing step 1 & 2 above, so let's check whether the issue happens in the sound device. Let's try to disable AEC using pjsua param --ec-tail=0, note that some AEC also applies some additional audio processings such as AGC and denoiser. If the audio is still not clear, try using native sound device clock rate (you need to find out the sound device native clock rate by yourselves), for example, to use clock rate 48000Hz, add pjsua param --snd-clock-rate=48000. You may also try with --stereo to allow stereo mode (as mentioned before, some sound device may work better in its native mode which may involve stereo). You may also try add pjsua param --quality=4 to avoid using large resampling filter which uses a significantly higher CPU load (IMO small resampling filter quality is still very acceptable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants