Discussion:
[pulseaudio-discuss] Pulseaudio latency
Harish Gaddameedi
2018-07-27 05:10:12 UTC
Permalink
I'm working on an Application using pulseaudio package using
pulseaudio-8.0, made lot of modifications in the pulseaudio to reduce the
fluctuation of source card and to reduce the initial latency, I'm
successful in doing this process. On 12 hrs testing of audio with alsa-sink
module, I'm finding the latency of 4-5 seconds. When testing the same 12hrs
in connection with External bluetooth speaker, there is no latency found.

After the 12 hrs testing with alsa-sink, latency from Module-loopback is
showing as less than 300ms which is fine. but the latency reproducible is
upto 4-5seconds. Can anyone give me a quick pointer if you have faced the
similar issue?

Thanks,
Harish Gaddameedi
Georg Chini
2018-07-27 05:50:38 UTC
Permalink
This post might be inappropriate. Click to display it.
Harish Gaddameedi
2018-07-28 09:20:36 UTC
Permalink
Dear Georg,

Thanks for reply,

As you have suggested. I have updated the pulseaudio to the later version
which is after pulseaudio-10.0 (i.e., pulseaudio-11.1). We have found that
the delay is still exists after playing any music upto 12hrs. We found like
the audio and video are completely out of sync with a delay of 4-5 seconds.

In the change log between pulseaudio-11.1 and pulseaudio-12.2, i haven't
seen any updates regarding latency. I hope that the latency will also be
exist in pulseaudio-12.2 also.

Thanks,
Harish Gaddameedi.
Post by Harish Gaddameedi
I'm working on an Application using pulseaudio package using
pulseaudio-8.0, made lot of modifications in the pulseaudio to reduce the
fluctuation of source card and to reduce the initial latency, I'm
successful in doing this process. On 12 hrs testing of audio with alsa-sink
module, I'm finding the latency of 4-5 seconds. When testing the same 12hrs
in connection with External bluetooth speaker, there is no latency found.
After the 12 hrs testing with alsa-sink, latency from Module-loopback is
showing as less than 300ms which is fine. but the latency reproducible is
upto 4-5seconds. Can anyone give me a quick pointer if you have faced the
similar issue?
Thanks,
Harish Gaddameedi
Hi,
I would suggest to update to a newer version of PA. Current version is 12.2.
Module-loopback did not control the latency very well prior to 10.0. If you
have the same issue with a current PA version, this would need more
investigation.
Regards
Georg
Georg Chini
2018-07-29 09:39:38 UTC
Permalink
Post by Harish Gaddameedi
Dear Georg,
Thanks for reply,
As you have suggested. I have updated the pulseaudio to the later
version which is after pulseaudio-10.0 (i.e., pulseaudio-11.1). We
have found that the delay is still exists after playing any music upto
12hrs. We found like the audio and video are completely out of sync
with a delay of 4-5 seconds.
In the change log between pulseaudio-11.1 and pulseaudio-12.2,  i
haven't seen any updates regarding latency. I hope that the latency
will also be exist in pulseaudio-12.2 also.
Thanks,
Harish Gaddameedi.
Post by Harish Gaddameedi
I'm working on an Application using pulseaudio package using
pulseaudio-8.0, made lot of modifications in the pulseaudio to
reduce the fluctuation of source card and to reduce the initial
latency, I'm successful in doing this process. On 12 hrs testing
of audio with alsa-sink module, I'm finding the latency of 4-5
seconds. When testing the same 12hrs in connection with External
bluetooth speaker, there is no latency found.
After the 12 hrs testing with alsa-sink, latency from
Module-loopback is showing as less than 300ms which is fine. but
the latency reproducible is upto 4-5seconds. Can anyone give me a
quick pointer if you have faced the similar issue?
Thanks,
Harish Gaddameedi
Hi,
I would suggest to update to a newer version of PA. Current version is 12.2.
Module-loopback did not control the latency very well prior to 10.0. If you
have the same issue with a current PA version, this would need more
investigation.
Regards
            Georg
Hello Harish,

what kind of alsa device are you using on what platform? What did you modify
within PA? Did you try 11.1 without your modifications? What exactly is
your setup?

If you are talking about A/V synchronization, the player may also be the
cause of
the issue. Sound card time does not necessarily match system time, so
the player
has to take care of the difference. The bluetooth A2DP sink uses the
system clock
for timing, that's probably why you don't have the problem there. Does
something
similar happen when you loop back your microphone to the ALSA sink?

I have run module-loopback for days on an Intel platform with standard
hda-intel
and USB devices without seeing any delays. Also, in 11.1 there should be
no need
to reduce initial latency because module-loopback will adjust quickly to
the latency
you requested.

Regards

             Georg
Harish Gaddameedi
2018-07-29 10:44:52 UTC
Permalink
Hi Georg,

I was working on simple Openwrt Platform, and Source device is Android
phone Bluetooth with Youtube app 24 hrs live streaming video and alsa
device is speaker, which is hardwired

The 12 hrs testing which i did on pulseaudio-11.1 are without my
modification. The basic modification which i made in the previous
pulseaudio-8.0 is with the idle state of bluez_source card (i.e., card is
vanishing when the song is in the pause state) and did some changes to
buffers of pulseaudio to reduce the latency. But in pulseaudio-11.1 i
didn't do all the changes as i didn't find any initial latency. but
periodic latency after 12hrs still exists. The issue is reproducible with
Gstreamer also.

I haven't worked on microphone scenarios, I'm just working on music player
and speaker.

Let me clear you some test scenarios for better understanding,
Case 1: Android phone as source (bluez_source) and device with internal
speaker (alsa-sink as sink for pulseaudio) -------> delay after 12hrs
exists.
Case 2: Device with Gstreamer as source and same device with internal
speaker (pulsesink with alsa card as sink for pulseaudio) ----------> delay
after 12 hrs exists.
Case 3: Device with Gstreamer as source and External Bluetooth speaker
(pulsesink with bluez_sink card) -----------> No delay after 12 hrs.
Post by Harish Gaddameedi
Dear Georg,
Thanks for reply,
As you have suggested. I have updated the pulseaudio to the later version
which is after pulseaudio-10.0 (i.e., pulseaudio-11.1). We have found that
the delay is still exists after playing any music upto 12hrs. We found like
the audio and video are completely out of sync with a delay of 4-5 seconds.
In the change log between pulseaudio-11.1 and pulseaudio-12.2, i haven't
seen any updates regarding latency. I hope that the latency will also be
exist in pulseaudio-12.2 also.
Thanks,
Harish Gaddameedi.
Post by Harish Gaddameedi
I'm working on an Application using pulseaudio package using
pulseaudio-8.0, made lot of modifications in the pulseaudio to reduce the
fluctuation of source card and to reduce the initial latency, I'm
successful in doing this process. On 12 hrs testing of audio with alsa-sink
module, I'm finding the latency of 4-5 seconds. When testing the same 12hrs
in connection with External bluetooth speaker, there is no latency found.
After the 12 hrs testing with alsa-sink, latency from Module-loopback is
showing as less than 300ms which is fine. but the latency reproducible is
upto 4-5seconds. Can anyone give me a quick pointer if you have faced
the similar issue?
Thanks,
Harish Gaddameedi
Hi,
I would suggest to update to a newer version of PA. Current version is 12.2.
Module-loopback did not control the latency very well prior to 10.0. If you
have the same issue with a current PA version, this would need more
investigation.
Regards
Georg
Hello Harish,
what kind of alsa device are you using on what platform? What did you modify
within PA? Did you try 11.1 without your modifications? What exactly is
your setup?
If you are talking about A/V synchronization, the player may also be the
cause of
the issue. Sound card time does not necessarily match system time, so the
player
has to take care of the difference. The bluetooth A2DP sink uses the
system clock
for timing, that's probably why you don't have the problem there. Does
something
similar happen when you loop back your microphone to the ALSA sink?
I have run module-loopback for days on an Intel platform with standard
hda-intel
and USB devices without seeing any delays. Also, in 11.1 there should be
no need
to reduce initial latency because module-loopback will adjust quickly to
the latency
you requested.
Regards
Georg
--
Regards,
Harish Gaddameedi
Georg Chini
2018-07-29 16:03:33 UTC
Permalink
Post by Harish Gaddameedi
Hi Georg,
I was working on simple Openwrt Platform, and Source device is Android
phone Bluetooth with Youtube app 24 hrs live streaming video and alsa
device is speaker, which is hardwired
The 12 hrs testing which i did on pulseaudio-11.1 are without my
modification. The basic modification which i made in the previous
pulseaudio-8.0 is with the idle state of bluez_source card (i.e., card
is vanishing when the song is in the pause state) and did some changes
to buffers of pulseaudio to reduce the latency. But in pulseaudio-11.1
i didn't do all the changes as i didn't find any initial latency. but
periodic latency after 12hrs still exists. The issue is reproducible
with Gstreamer also.
I haven't worked on microphone scenarios, I'm just working on music
player and speaker.
Let me clear you some test scenarios for better understanding,
Case 1: Android phone as source (bluez_source) and device with
internal speaker (alsa-sink as sink for pulseaudio) -------> delay
after 12hrs exists.
Case 2: Device with Gstreamer as source and same device with internal
speaker (pulsesink with alsa card as sink for pulseaudio) ---------->
delay after 12 hrs exists.
Case 3: Device with Gstreamer as source and External Bluetooth speaker
(pulsesink with bluez_sink card) -----------> No delay after 12 hrs.
What output does module-loopback give when you run with debugging?
Do you see the growing latency there? Does it show up with pactl list sinks
or pactl list sources? Any error messages in the PA log?

Regards
             Georg
Georg Chini
2018-07-29 16:07:22 UTC
Permalink
Post by Georg Chini
Post by Harish Gaddameedi
Hi Georg,
I was working on simple Openwrt Platform, and Source device is
Android phone Bluetooth with Youtube app 24 hrs live streaming video
and alsa device is speaker, which is hardwired
The 12 hrs testing which i did on pulseaudio-11.1 are without my
modification. The basic modification which i made in the previous
pulseaudio-8.0 is with the idle state of bluez_source card (i.e.,
card is vanishing when the song is in the pause state) and did some
changes to buffers of pulseaudio to reduce the latency. But in
pulseaudio-11.1 i didn't do all the changes as i didn't find any
initial latency. but periodic latency after 12hrs still exists. The
issue is reproducible with Gstreamer also.
I haven't worked on microphone scenarios, I'm just working on music
player and speaker.
Let me clear you some test scenarios for better understanding,
Case 1: Android phone as source (bluez_source) and device with
internal speaker (alsa-sink as sink for pulseaudio) -------> delay
after 12hrs exists.
Case 2: Device with Gstreamer as source and same device with internal
speaker (pulsesink with alsa card as sink for pulseaudio) ---------->
delay after 12 hrs exists.
Case 3: Device with Gstreamer as source and External Bluetooth
speaker (pulsesink with bluez_sink card) -----------> No delay after
12 hrs.
What output does module-loopback give when you run with debugging?
Do you see the growing latency there? Does it show up with pactl list sinks
or pactl list sources? Any error messages in the PA log?
Regards
             Georg
One more comment: It may well be worth trying 12.2 because the bluetooth
thread
function has changed.
Harish Gaddameedi
2018-07-31 05:10:15 UTC
Permalink
Hi Georg,

As i told module-loopback is giving overall latency around 300ms from the
time when i started the sequence, and *latency of module-loopback doesn't
grow at any point of time*. On saturday and sunday, we have kept a
continuous streaming for 2 days, expecting that the delay will be further
increased, but the delay is constant with 4-5 secs, and *there are no
errors in the logs*. Are there any chances like alsa-sink is filling
somewhere and blocking the source to send the audio chunks into the
memblockq?

*module-loopback output is like this:*
*Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.422| 0.020)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Wakeup from ALSA!*
*Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443| 0.020)
[pulseaudio] module-loopback.c: Loopback overall latency is 0.02 ms +
244.43 ms + 54.55 ms = 298.89 ms*
*Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443| 0.000)
[pulseaudio] module-loopback.c: Loopback latency at base rate is 298.42 ms*
*Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443| 0.000)
[pulseaudio] module-loopback.c: [alsa_output.0] Updated sampling rate to
44053 Hz.*

*pactl list sources:*
*Source #1*
* State: RUNNING*
* Name: bluez_source*
* Description: AP 🙏*
* Driver: module-bluez5-device.c*
* Sample Specification: s16le 2ch 44100Hz*
* Channel Map: front-left,front-right*
* Owner Module: 17*
* Mute: no*
* Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% /
0.00 dB*
* balance 0.00*
* Base Volume: 65536 / 100% / 0.00 dB*
* Monitor of Sink: n/a*
* Latency: 45876 usec, configured 39512 usec*
* Flags: HARDWARE DECIBEL_VOLUME LATENCY *
* Properties:*
* bluetooth.protocol = "a2dp_source"*
* device.description = "AP 🙏"*
* device.string = "AC:C1:EE:69:A6:02"*
* device.api = "bluez"*
* device.class = "sound"*
* device.bus = "bluetooth"*
* device.form_factor = "phone"*
* bluez.path = "/org/bluez/hci0/dev_AC_C1_EE_69_A6_02"*
* bluez.class = "0x5a020c"*
* bluez.alias = "AP 🙏"*
* device.icon_name = "audio-card-bluetooth"*
* Ports:*
* phone-input: Phone (priority: 0, available)*
* Active Port: phone-input*
* Formats:*
* pcm*

*pactl list sinks:*
*Sink #0*
* State: RUNNING*
* Name: alsa_output.0*
* Description: ipq4019_snd_card*
* Driver: module-alsa-sink.c*
* Sample Specification: s16le 2ch 48000Hz*
* Channel Map: front-left,front-right*
* Owner Module: 5*
* Mute: no*
* Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% /
0.00 dB*
* balance 0.00*
* Base Volume: 65536 / 100% / 0.00 dB*
* Monitor Source: alsa_output.0.monitor*
* Latency: 0 usec, configured 26000 usec*
* Flags: HARDWARE DECIBEL_VOLUME LATENCY *
* Properties:*
* alsa.resolution_bits = "16"*
* device.api = "alsa"*
* device.class = "sound"*
* alsa.class = "generic"*
* alsa.subclass = "generic-mix"*
* alsa.name <http://alsa.name> = ""*
* alsa.id <http://alsa.id> = "I2S cx2072x-dsp-0"*
* alsa.subdevice = "0"*
* alsa.subdevice_name = "subdevice #0"*
* alsa.device = "0"*
* alsa.card = "0"*
* alsa.card_name = "snd_card"*
* alsa.long_card_name = "snd_card"*
* alsa.driver_name = "snd_card"*
* device.string = "dmixer"*
* device.buffering.buffer_size = "383040"*
* device.buffering.fragment_size = "4032"*
* device.access_mode = "mmap+timer"*
* device.description = "snd_card"*
* device.icon_name = "audio-card"*
* Formats:*
* pcm*
Post by Harish Gaddameedi
Hi Georg,
I was working on simple Openwrt Platform, and Source device is Android
phone Bluetooth with Youtube app 24 hrs live streaming video and alsa
device is speaker, which is hardwired
The 12 hrs testing which i did on pulseaudio-11.1 are without my
modification. The basic modification which i made in the previous
pulseaudio-8.0 is with the idle state of bluez_source card (i.e., card is
vanishing when the song is in the pause state) and did some changes to
buffers of pulseaudio to reduce the latency. But in pulseaudio-11.1 i
didn't do all the changes as i didn't find any initial latency. but
periodic latency after 12hrs still exists. The issue is reproducible with
Gstreamer also.
I haven't worked on microphone scenarios, I'm just working on music player
and speaker.
Let me clear you some test scenarios for better understanding,
Case 1: Android phone as source (bluez_source) and device with internal
speaker (alsa-sink as sink for pulseaudio) -------> delay after 12hrs
exists.
Case 2: Device with Gstreamer as source and same device with internal
speaker (pulsesink with alsa card as sink for pulseaudio) ---------->
delay after 12 hrs exists.
Case 3: Device with Gstreamer as source and External Bluetooth speaker
(pulsesink with bluez_sink card) -----------> No delay after 12 hrs.
What output does module-loopback give when you run with debugging?
Do you see the growing latency there? Does it show up with pactl list sinks
or pactl list sources? Any error messages in the PA log?
Regards
Georg
One more comment: It may well be worth trying 12.2 because the bluetooth
thread
function has changed.
--
Regards,
Harish Gaddameedi
Harish Gaddameedi
2018-07-31 05:26:25 UTC
Permalink
+Georg Chini <***@chini.tk>

On Tue, Jul 31, 2018 at 10:40 AM Harish Gaddameedi <
Post by Harish Gaddameedi
Hi Georg,
As i told module-loopback is giving overall latency around 300ms from the
time when i started the sequence, and *latency of module-loopback doesn't
grow at any point of time*. On saturday and sunday, we have kept a
continuous streaming for 2 days, expecting that the delay will be further
increased, but the delay is constant with 4-5 secs, and *there are no
errors in the logs*. Are there any chances like alsa-sink is filling
somewhere and blocking the source to send the audio chunks into the
memblockq?
*module-loopback output is like this:*
*Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.422|
0.020) [alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Wakeup from ALSA!*
*Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443|
0.020) [pulseaudio] module-loopback.c: Loopback overall latency is 0.02 ms
+ 244.43 ms + 54.55 ms = 298.89 ms*
*Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443|
0.000) [pulseaudio] module-loopback.c: Loopback latency at base rate is
298.42 ms*
*Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443|
0.000) [pulseaudio] module-loopback.c: [alsa_output.0] Updated sampling
rate to 44053 Hz.*
*pactl list sources:*
*Source #1*
* State: RUNNING*
* Name: bluez_source*
* Description: AP 🙏*
* Driver: module-bluez5-device.c*
* Sample Specification: s16le 2ch 44100Hz*
* Channel Map: front-left,front-right*
* Owner Module: 17*
* Mute: no*
* Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100%
/ 0.00 dB*
* balance 0.00*
* Base Volume: 65536 / 100% / 0.00 dB*
* Monitor of Sink: n/a*
* Latency: 45876 usec, configured 39512 usec*
* Flags: HARDWARE DECIBEL_VOLUME LATENCY *
* Properties:*
* bluetooth.protocol = "a2dp_source"*
* device.description = "AP 🙏"*
* device.string = "AC:C1:EE:69:A6:02"*
* device.api = "bluez"*
* device.class = "sound"*
* device.bus = "bluetooth"*
* device.form_factor = "phone"*
* bluez.path = "/org/bluez/hci0/dev_AC_C1_EE_69_A6_02"*
* bluez.class = "0x5a020c"*
* bluez.alias = "AP 🙏"*
* device.icon_name = "audio-card-bluetooth"*
* Ports:*
* phone-input: Phone (priority: 0, available)*
* Active Port: phone-input*
* Formats:*
* pcm*
*pactl list sinks:*
*Sink #0*
* State: RUNNING*
* Name: alsa_output.0*
* Description: ipq4019_snd_card*
* Driver: module-alsa-sink.c*
* Sample Specification: s16le 2ch 48000Hz*
* Channel Map: front-left,front-right*
* Owner Module: 5*
* Mute: no*
* Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100%
/ 0.00 dB*
* balance 0.00*
* Base Volume: 65536 / 100% / 0.00 dB*
* Monitor Source: alsa_output.0.monitor*
* Latency: 0 usec, configured 26000 usec*
* Flags: HARDWARE DECIBEL_VOLUME LATENCY *
* Properties:*
* alsa.resolution_bits = "16"*
* device.api = "alsa"*
* device.class = "sound"*
* alsa.class = "generic"*
* alsa.subclass = "generic-mix"*
* alsa.name <http://alsa.name> = ""*
* alsa.id <http://alsa.id> = "I2S cx2072x-dsp-0"*
* alsa.subdevice = "0"*
* alsa.subdevice_name = "subdevice #0"*
* alsa.device = "0"*
* alsa.card = "0"*
* alsa.card_name = "snd_card"*
* alsa.long_card_name = "snd_card"*
* alsa.driver_name = "snd_card"*
* device.string = "dmixer"*
* device.buffering.buffer_size = "383040"*
* device.buffering.fragment_size = "4032"*
* device.access_mode = "mmap+timer"*
* device.description = "snd_card"*
* device.icon_name = "audio-card"*
* Formats:*
* pcm*
Post by Harish Gaddameedi
Hi Georg,
I was working on simple Openwrt Platform, and Source device is Android
phone Bluetooth with Youtube app 24 hrs live streaming video and alsa
device is speaker, which is hardwired
The 12 hrs testing which i did on pulseaudio-11.1 are without my
modification. The basic modification which i made in the previous
pulseaudio-8.0 is with the idle state of bluez_source card (i.e., card is
vanishing when the song is in the pause state) and did some changes to
buffers of pulseaudio to reduce the latency. But in pulseaudio-11.1 i
didn't do all the changes as i didn't find any initial latency. but
periodic latency after 12hrs still exists. The issue is reproducible with
Gstreamer also.
I haven't worked on microphone scenarios, I'm just working on music
player and speaker.
Let me clear you some test scenarios for better understanding,
Case 1: Android phone as source (bluez_source) and device with internal
speaker (alsa-sink as sink for pulseaudio) -------> delay after 12hrs
exists.
Case 2: Device with Gstreamer as source and same device with internal
speaker (pulsesink with alsa card as sink for pulseaudio) ---------->
delay after 12 hrs exists.
Case 3: Device with Gstreamer as source and External Bluetooth speaker
(pulsesink with bluez_sink card) -----------> No delay after 12 hrs.
What output does module-loopback give when you run with debugging?
Do you see the growing latency there? Does it show up with pactl list sinks
or pactl list sources? Any error messages in the PA log?
Regards
Georg
One more comment: It may well be worth trying 12.2 because the bluetooth
thread
function has changed.
--
Regards,
Harish Gaddameedi
--
Regards,
Harish Gaddameedi
Software Engineer
Mobile: +91- 9246040475
Georg Chini
2018-07-31 06:07:35 UTC
Permalink
Post by Harish Gaddameedi
Hi Georg,
As i told module-loopback is giving overall latency around 300ms from
the time when i started the sequence, and*latency of module-loopback
doesn't grow at any point of time*. On saturday and sunday, we have
kept a continuous streaming for 2 days, expecting that the delay will
be further increased, but the delay is constant with 4-5 secs, and
*there are no errors in the logs*. Are there any chances like
alsa-sink is filling somewhere and blocking the source to send the
audio chunks into the memblockq?
/*module-loopback output is like this:*/
/Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.422| 
 0.020) [alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Wakeup from ALSA!/
/Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443| 
 0.020) [pulseaudio] module-loopback.c: Loopback overall latency is
0.02 ms + 244.43 ms + 54.55 ms = 298.89 ms/
/Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443| 
 0.000) [pulseaudio] module-loopback.c: Loopback latency at base rate
is 298.42 ms/
/Tue Jul 31 10:15:37 2018 user.debug pulseaudio[4370]: (47917.443| 
 0.000) [pulseaudio] module-loopback.c: [alsa_output.0] Updated
sampling rate to 44053 Hz./
/
/
/*pactl list sources:*/
/Source #1/
/State: RUNNING/
/Name: bluez_source/
/Description: AP 🙏/
/Driver: module-bluez5-device.c/
/Sample Specification: s16le 2ch 44100Hz/
/Channel Map: front-left,front-right/
/Owner Module: 17/
/Mute: no/
/Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 /
100% / 0.00 dB/
/balance 0.00/
/Base Volume: 65536 / 100% / 0.00 dB/
/Monitor of Sink: n/a/
/Latency: 45876 usec, configured 39512 usec/
/Flags: HARDWARE DECIBEL_VOLUME LATENCY /
/Properties:/
/bluetooth.protocol = "a2dp_source"/
/device.description = "AP 🙏"/
/device.string = "AC:C1:EE:69:A6:02"/
/device.api = "bluez"/
/device.class = "sound"/
/device.bus = "bluetooth"/
/device.form_factor = "phone"/
/bluez.path = "/org/bluez/hci0/dev_AC_C1_EE_69_A6_02"/
/bluez.class = "0x5a020c"/
/bluez.alias = "AP 🙏"/
/device.icon_name = "audio-card-bluetooth"/
/Ports:/
/phone-input: Phone (priority: 0, available)/
/Active Port: phone-input/
/Formats:/
/pcm/
/pactl list sinks:/
/Sink #0/
/State: RUNNING/
/Name: alsa_output.0/
/Description: ipq4019_snd_card/
/Driver: module-alsa-sink.c/
/Sample Specification: s16le 2ch 48000Hz/
/Channel Map: front-left,front-right/
/Owner Module: 5/
/Mute: no/
/Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 /
100% / 0.00 dB/
/  balance 0.00/
/Base Volume: 65536 / 100% / 0.00 dB/
/Monitor Source: alsa_output.0.monitor/
/Latency: 0 usec, configured 26000 usec/
/Flags: HARDWARE DECIBEL_VOLUME LATENCY /
/Properties:/
/alsa.resolution_bits = "16"/
/device.api = "alsa"/
/device.class = "sound"/
/alsa.class = "generic"/
/alsa.subclass = "generic-mix"/
/alsa.name <http://alsa.name> = ""/
/alsa.id <http://alsa.id> = "I2S cx2072x-dsp-0"/
/alsa.subdevice = "0"/
/alsa.subdevice_name = "subdevice #0"/
/alsa.device = "0"/
/alsa.card = "0"/
/alsa.card_name = "snd_card"/
/alsa.long_card_name = "snd_card"/
/alsa.driver_name = "/snd_card/"/
/device.string = "dmixer"/
/device.buffering.buffer_size = "383040"/
/device.buffering.fragment_size = "4032"/
/device.access_mode = "mmap+timer"/
/device.description = "snd_card"/
/device.icon_name = "audio-card"/
/Formats:/
/pcm/
Please do not top-post.

To me it looks like that is an issue in the ALSA driver and not related
to pulseaudio.
The driver must be reporting the wrong latency. Did you set the loopback
latency to
300 ms? Default is 200 ms.
Harish Gaddameedi
2018-07-31 06:41:48 UTC
Permalink
*Please do not top-post.To me it looks like that is an issue in the ALSA
driver and not related to pulseaudio.The driver must be reporting the wrong
latency. Did you set the loopback latency to*
*300 ms? Default is 200 ms.*


Sorry, I use default settings, gmail is doing top posting.
No, i didn't set any loopback latency. I'll check with the alsa driver and
get back to you.

--
Thanks,
Harish Gaddameedi
Harish Gaddameedi
2018-07-31 07:12:26 UTC
Permalink
On Tue, Jul 31, 2018 at 12:11 PM Harish Gaddameedi <
Post by Harish Gaddameedi
*Please do not top-post.To me it looks like that is an issue in the ALSA
driver and not related to pulseaudio.The driver must be reporting the wrong
latency. Did you set the loopback latency to*
*300 ms? Default is 200 ms.*
Sorry, I use default settings, gmail is doing top posting.
No, i didn't set any loopback latency. I'll check with the alsa driver and
get back to you.
--
Thanks,
Harish Gaddameedi
+Sujith Kumar Reddy <***@smartron.com>
--
Regards,
Harish Gaddameedi
Harish Gaddameedi
2018-07-31 08:22:07 UTC
Permalink
On Tue, Jul 31, 2018 at 12:42 PM Harish Gaddameedi <
Post by Harish Gaddameedi
On Tue, Jul 31, 2018 at 12:11 PM Harish Gaddameedi <
Post by Harish Gaddameedi
*Please do not top-post.To me it looks like that is an issue in the ALSA
driver and not related to pulseaudio.The driver must be reporting the wrong
latency. Did you set the loopback latency to*
*300 ms? Default is 200 ms.*
Sorry, I use default settings, gmail is doing top posting.
No, i didn't set any loopback latency. I'll check with the alsa driver
and get back to you.
--
Thanks,
Harish Gaddameedi
Hi Georg,

There is one more important point i wanted to discuss, this is which we
have capture from your reply of clock synchronisation. Can you conform
whether the system clock and audio clock both are same or different?
--
Regards,
Harish Gaddameedi
Georg Chini
2018-07-31 18:56:55 UTC
Permalink
Post by Harish Gaddameedi
On Tue, Jul 31, 2018 at 12:42 PM Harish Gaddameedi
On Tue, Jul 31, 2018 at 12:11 PM Harish Gaddameedi
/Please do not top-post.
To me it looks like that is an issue in the ALSA driver
and not related to pulseaudio.
The driver must be reporting the wrong latency. Did you
set the loopback latency to/
/300 ms? Default is 200 ms./
/
/
Sorry, I use default settings, gmail is doing top posting.
No, i didn't set any loopback latency. I'll check with the
alsa driver and get back to you.
--
Thanks,
Harish Gaddameedi
Hi Georg,
There is one more important point i wanted to discuss, this is which
we have capture from your reply of clock synchronisation. Can you
conform whether the system clock and audio clock both are same or
different?
System clock and audio clock need not be equal. Each sound card has its own
clock which might not be synchronized with system clock or wall clock.
Basically, if your sound card claims to run on 44100 Hz, it may be slightly
more or less if measured in "real" (wall clock) time.
module-loopback is normally capable of detecting the clock difference and
adjusts the sink-input sample rate so that the latency remains constant.
This
is why you see in the log, that the module is not using 44100 Hz but in fact
some other (in your case lower) sample rate. PA then does re-sampling
from that rate to your sound card rate.

For the A2DP sink (bluetooth headset or speaker) the system clock is used
for timing, so for this special case the audio clock matches system clock.
Harish Gaddameedi
2018-08-10 05:58:58 UTC
Permalink
Post by Harish Gaddameedi
On Tue, Jul 31, 2018 at 12:42 PM Harish Gaddameedi <
Post by Harish Gaddameedi
On Tue, Jul 31, 2018 at 12:11 PM Harish Gaddameedi <
*Please do not top-post. To me it looks like that is an issue in the
ALSA driver and not related to pulseaudio. The driver must be reporting the
wrong latency. Did you set the loopback latency to*
*300 ms? Default is 200 ms.*
Sorry, I use default settings, gmail is doing top posting.
No, i didn't set any loopback latency. I'll check with the alsa driver
and get back to you.
--
Thanks,
Harish Gaddameedi
Hi Georg,
There is one more important point i wanted to discuss, this is which we
have capture from your reply of clock synchronisation. Can you conform
whether the system clock and audio clock both are same or different?
System clock and audio clock need not be equal. Each sound card has its own
clock which might not be synchronized with system clock or wall clock.
Basically, if your sound card claims to run on 44100 Hz, it may be slightly
more or less if measured in "real" (wall clock) time.
module-loopback is normally capable of detecting the clock difference and
adjusts the sink-input sample rate so that the latency remains constant.
This
is why you see in the log, that the module is not using 44100 Hz but in fact
some other (in your case lower) sample rate. PA then does re-sampling
from that rate to your sound card rate.
For the A2DP sink (bluetooth headset or speaker) the system clock is used
for timing, so for this special case the audio clock matches system clock.
Hi Georg,

I have found some cause for the pulseaudio Latency, can you please look
into the below log. During this process of "*alsa-sink.c: Tried rewind, but
was apparently not possible*", the latency is coming.

Fri Aug 10 11:21:28 2018 user.info pulseaudio[4396]: (50087.559| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Tried rewind, but was apparently
not possible.
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.575| 0.015)
[alsa-sink-I2S cx2072x-dsp-0] protocol-native.c: Requesting rewind due to
end of underrun.
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.575| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] protocol-native.c: Requesting rewind due to
end of underrun.
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.577| 0.001)
[alsa-sink-I2S cx2072x-dsp-0] protocol-native.c: Requesting rewind due to
end of underrun.
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.579| 0.002)
[alsa-sink-I2S cx2072x-dsp-0] protocol-native.c: Requesting rewind due to
end of underrun.
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.580| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] sink-input.c: Requesting rewind due to
uncorking
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.580| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Requested to rewind 76608 bytes.
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.580| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Limited to 68288 bytes.
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.581| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: before: 17072
Fri Aug 10 11:21:28 2018 user.debug pulseaudio[4396]: (50087.581| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: after: 0
Fri Aug 10 11:21:28 2018 user.info pulseaudio[4396]: (50087.581| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Tried rewind, but was apparently
not possible.
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.231| 2.650)
[alsa-sink-I2S cx2072x-dsp-0] sink-input.c: Requesting rewind due to corking
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.231| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Requested to rewind 76608 bytes.
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.232| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Limited to 12992 bytes.
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.232| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: before: 3248
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.232| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: after: 0
Fri Aug 10 11:21:31 2018 user.info pulseaudio[4396]: (50090.232| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Tried rewind, but was apparently
not possible.
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.241| 0.009)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: hwbuf_unused=0
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.241| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: setting avail_min=18193
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.242| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Requested to rewind 76608 bytes.
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.242| 0.000)
[pulseaudio] core.c: Hmm, no streams around, trying to vacuum.
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.242| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Limited to 12992 bytes.
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.242| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: before: 3248
Fri Aug 10 11:21:31 2018 user.debug pulseaudio[4396]: (50090.242| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: after: 0
Fri Aug 10 11:21:31 2018 user.info pulseaudio[4396]: (50090.242| 0.000)
[alsa-sink-I2S cx2072x-dsp-0] alsa-sink.c: Tried rewind, but was apparently
not possible.

*When the below log came, the music played successfully.*

Fri Aug 10 11:21:31 2018 user.info pulseaudio[4396]: (50090.243| 0.000)
[pulseaudio] sink-input.c: Freeing input 445 "Playback Stream"
Fri Aug 10 11:21:31 2018 user.info pulseaudio[4396]: (50090.247| 0.004)
[pulseaudio] client.c: Freed 246 "gstreamer_play"
Fri Aug 10 11:21:31 2018 user.info pulseaudio[4396]: (50090.247| 0.000)
[pulseaudio] protocol-native.c: Connection died.
--
Regards,
Harish Gaddameedi
Software Engineer
Mobile: +91- 9246040475
Lakshmankumar Ganesan
2018-07-27 07:14:19 UTC
Permalink
hi harish,
are you using DYNAMIC_LATENCY or fixed latency .its better to use dynamic
and adjust the timestamp of userdata in both sink and source
Post by Harish Gaddameedi
I'm working on an Application using pulseaudio package using
pulseaudio-8.0, made lot of modifications in the pulseaudio to reduce the
fluctuation of source card and to reduce the initial latency, I'm
successful in doing this process. On 12 hrs testing of audio with alsa-sink
module, I'm finding the latency of 4-5 seconds. When testing the same 12hrs
in connection with External bluetooth speaker, there is no latency found.
After the 12 hrs testing with alsa-sink, latency from Module-loopback is
showing as less than 300ms which is fine. but the latency reproducible is
upto 4-5seconds. Can anyone give me a quick pointer if you have faced the
similar issue?
Thanks,
Harish Gaddameedi
_______________________________________________
pulseaudio-discuss mailing list
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
lakshman ganesan
2018-07-27 05:30:59 UTC
Permalink
hi harish,
are you using DYNAMIC_LATENCY or fixed latency .its better to use dynamic
and adjust the timestamp of userdata in both sink and source

வெள்., 27 ஜூலை, 2018, முற்பகல் 10:41 அன்று, Harish Gaddameedi <
Post by Harish Gaddameedi
I'm working on an Application using pulseaudio package using
pulseaudio-8.0, made lot of modifications in the pulseaudio to reduce the
fluctuation of source card and to reduce the initial latency, I'm
successful in doing this process. On 12 hrs testing of audio with alsa-sink
module, I'm finding the latency of 4-5 seconds. When testing the same 12hrs
in connection with External bluetooth speaker, there is no latency found.
After the 12 hrs testing with alsa-sink, latency from Module-loopback is
showing as less than 300ms which is fine. but the latency reproducible is
upto 4-5seconds. Can anyone give me a quick pointer if you have faced the
similar issue?
Thanks,
Harish Gaddameedi
_______________________________________________
pulseaudio-discuss mailing list
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Harish Gaddameedi
2018-07-31 05:50:02 UTC
Permalink
Hi Lakshman,

I'm trying to adjust dynamic latency in the alsa-sink module. Can you
support me in adjusting the timestamp of userdata? And how this timestamp
adjustment will be helping the reduction of latency?
--
Regards,
Harish Gaddameedi
Loading...