You are not logged in.

#1 2020-05-15 22:35:19

ptersilie
Member
Registered: 2012-09-05
Posts: 13

Discord high CPU usage (possible pulseaudio problem)

Hi, I'm having unusually high CPU usage (35-45%) when using Discord on my desktop (I would be expecting something more along 5%). The problem seems to be related to the recording of audio, since it goes down to 10% when I enable push-to-talk and am not speaking (though 10% is still a bit high). The problem is the same for both the Discord app and running it in the browser. On top of Discord I'm also getting another 10% CPU usage from pulseaudio, which makes me think this might actually be a pulseaudio issue. I would be grateful for any ideas to what the problem could be or how do debug this.

Offline

#2 2020-05-16 10:54:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,425

Re: Discord high CPU usage (possible pulseaudio problem)

There was a chromium/electron bug. It seems to have gotten fixed in chromium itself but it's unclear when all the gazillion electron implementations will be relevantly updated. FWIW what's your output for

pacmd list-sinks 
pacmd list-sink-inputs
pacmd list-sources
pacmd list-source-outputs

during this?

Last edited by V1del (2020-05-16 11:25:59)

Offline

#3 2020-05-16 13:56:22

ptersilie
Member
Registered: 2012-09-05
Posts: 13

Re: Discord high CPU usage (possible pulseaudio problem)

I see. I just ran another test and noticed that the CPU usage is not as high if I run Discord in Chrome (around 10% while recording audio, compared to 35% with the Electron app or in Firefox). Hopefully, this fix will find it's way into the app soon then. But just to rule out other issues here's my `pacmd` output.

list-sinks

4 sink(s) available.
    index: 0
	name: <alsa_output.hw_1_7>
	driver: <module-alsa-sink.c>
	flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 9030
	volume: front-left: 50152 /  77% / -6.97 dB,   front-right: 50152 /  77% / -6.97 dB
	        balance 0.00
	base volume: 65536 / 100% / 0.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 0 KiB
	max rewind: 0 KiB
	monitor source: 0
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 1999.82 ms
	module: 5
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "HDMI 1"
		alsa.id = "HDMI 1"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "7"
		alsa.card = "1"
		alsa.card_name = "HDA NVidia"
		alsa.long_card_name = "HDA NVidia at 0xf7080000 irq 17"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:01:00.1"
		sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
		device.bus = "pci"
		device.vendor.id = "10de"
		device.vendor.name = "NVIDIA Corporation"
		device.product.id = "10f0"
		device.product.name = "GP104 High Definition Audio Controller"
		device.string = "hw:1,7"
		device.buffering.buffer_size = "352768"
		device.buffering.fragment_size = "176384"
		device.access_mode = "mmap+timer"
		device.description = "GP104 High Definition Audio Controller"
		device.icon_name = "audio-card-pci"
  * index: 1
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: RUNNING
	suspend cause: (none)
	priority: 9039
	volume: front-left: 52781 /  81% / -5.64 dB,   front-right: 52781 /  81% / -5.64 dB
	        balance 0.00
	base volume: 65536 / 100% / 0.00 dB
	volume steps: 65537
	muted: no
	current latency: 7.29 ms
	max request: 1 KiB
	max rewind: 1 KiB
	monitor source: 1
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	used by: 1
	linked by: 2
	configured latency: 7.52 ms; range is 0.50 .. 2000.00 ms
	card: 1 <alsa_card.pci-0000_00_1b.0>
	module: 8
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "ALC887-VD Analog"
		alsa.id = "ALC887-VD Analog"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xf7310000 irq 41"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1b.0"
		sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "8c20"
		device.product.name = "8 Series/C220 Series Chipset High Definition Audio Controller"
		device.form_factor = "internal"
		device.string = "front:0"
		device.buffering.buffer_size = "352800"
		device.buffering.fragment_size = "176400"
		device.access_mode = "mmap+timer"
		device.profile.name = "analog-stereo"
		device.profile.description = "Analog Stereo"
		device.description = "Built-in Audio Analog Stereo"
		alsa.mixer_name = "Realtek ALC887-VD"
		alsa.components = "HDA:10ec0887,1462d851,00100302"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		analog-output-lineout: Line Out (priority 9000, latency offset 0 usec, available: no)
			properties:
				
		analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: yes)
			properties:
				device.icon_name = "audio-headphones"
	active port: <analog-output-headphones>
    index: 2
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo.echo-cancel>
	driver: <module-echo-cancel.c>
	flags: HW_MUTE_CTRL LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 1000
	volume: mono: 52781 /  81%
	        balance 0.00
	base volume: 65536 / 100%
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 0 KiB
	max rewind: 0 KiB
	monitor source: 4
	sample spec: float32le 1ch 32000Hz
	channel map: mono
	             Mono
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
	module: 24
	properties:
		device.master_device = "alsa_output.pci-0000_00_1b.0.analog-stereo"
		device.class = "filter"
		device.intended_roles = "phone"
		device.description = "Built-in Audio Analog Stereo (echo cancelled with Built-in Audio Analog Stereo)"
		device.icon_name = "audio-card"
    index: 3
	name: <alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2>
	driver: <module-alsa-card.c>
	flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 9030
	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
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 0 KiB
	max rewind: 0 KiB
	monitor source: 5
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 1999.82 ms
	card: 2 <alsa_card.pci-0000_01_00.1>
	module: 27
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "HDMI 2"
		alsa.id = "HDMI 2"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "8"
		alsa.card = "1"
		alsa.card_name = "HDA NVidia"
		alsa.long_card_name = "HDA NVidia at 0xf7080000 irq 17"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:01:00.1"
		sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
		device.bus = "pci"
		device.vendor.id = "10de"
		device.vendor.name = "NVIDIA Corporation"
		device.product.id = "10f0"
		device.product.name = "GP104 High Definition Audio Controller"
		device.string = "hdmi:1,2"
		device.buffering.buffer_size = "352768"
		device.buffering.fragment_size = "176384"
		device.access_mode = "mmap+timer"
		device.profile.name = "hdmi-stereo-extra2"
		device.profile.description = "Digital Stereo (HDMI 3)"
		device.description = "GP104 High Definition Audio Controller Digital Stereo (HDMI 3)"
		alsa.mixer_name = "Nvidia GPU 83 HDMI/DP"
		alsa.components = "HDA:10de0083,19da1445,00100100"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: yes)
			properties:
				device.icon_name = "video-display"
				device.product.name = "Dell S2716DG
"
	active port: <hdmi-output-2>

list-sinks-input

2 sink input(s) available.
    index: 0
	driver: <module-echo-cancel.c>
	flags: VARIABLE_RATE START_CORKED 
	state: CORKED
	sink: 1 <alsa_output.pci-0000_00_1b.0.analog-stereo>
	volume: mono: 65536 / 100% / 0.00 dB
	        balance 0.00
	muted: no
	current latency: 0.00 ms
	requested latency: 100.00 ms
	sample spec: float32le 1ch 32000Hz
	channel map: mono
	             Mono
	resample method: speex-float-1
	module: 24
	properties:
		media.name = "Echo-Cancel Sink Stream"
		media.role = "filter"
		module-stream-restore.id = "sink-input-by-media-role:filter"
    index: 3
	driver: <protocol-native.c>
	flags: 
	state: RUNNING
	sink: 1 <alsa_output.pci-0000_00_1b.0.analog-stereo>
	volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	muted: no
	current latency: 22.49 ms
	requested latency: 7.52 ms
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	resample method: (null)
	module: 12
	client: 6 <WEBRTC VoiceEngine>
	properties:
		media.name = "playStream"
		application.name = "WEBRTC VoiceEngine"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "33"
		application.process.binary = "Discord"
		application.language = "en_GB.UTF-8"
		window.x11.display = ":0.0"
		application.process.session_id = "2"
		module-stream-restore.id = "sink-input-by-application-name:WEBRTC VoiceEngine"

list-sources

6 source(s) available.
    index: 0
	name: <alsa_output.hw_1_7.monitor>
	driver: <module-alsa-sink.c>
	flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 1000
	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
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max rewind: 0 KiB
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 1999.82 ms
	monitor_of: 0
	module: 5
	properties:
		device.description = "Monitor of GP104 High Definition Audio Controller"
		device.class = "monitor"
		device.icon_name = "audio-input-microphone"
    index: 1
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
	driver: <module-alsa-card.c>
	flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: IDLE
	suspend cause: (none)
	priority: 1030
	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
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max rewind: 1 KiB
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 2000.00 ms; range is 0.50 .. 2000.00 ms
	monitor_of: 1
	card: 1 <alsa_card.pci-0000_00_1b.0>
	module: 8
	properties:
		device.description = "Monitor of Built-in Audio Analog Stereo"
		device.class = "monitor"
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xf7310000 irq 41"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1b.0"
		sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "8c20"
		device.product.name = "8 Series/C220 Series Chipset High Definition Audio Controller"
		device.form_factor = "internal"
		device.string = "0"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
  * index: 2
	name: <alsa_input.pci-0000_00_1b.0.analog-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: RUNNING
	suspend cause: (none)
	priority: 9039
	volume: front-left: 21845 /  33% / -28.63 dB,   front-right: 21845 /  33% / -28.63 dB
	        balance 0.00
	base volume: 6554 /  10% / -60.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max rewind: 0 KiB
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	used by: 1
	linked by: 2
	configured latency: 30.00 ms; range is 0.50 .. 2000.00 ms
	card: 1 <alsa_card.pci-0000_00_1b.0>
	module: 8
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "ALC887-VD Analog"
		alsa.id = "ALC887-VD Analog"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xf7310000 irq 41"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1b.0"
		sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "8c20"
		device.product.name = "8 Series/C220 Series Chipset High Definition Audio Controller"
		device.form_factor = "internal"
		device.string = "front:0"
		device.buffering.buffer_size = "352800"
		device.buffering.fragment_size = "176400"
		device.access_mode = "mmap+timer"
		device.profile.name = "analog-stereo"
		device.profile.description = "Analog Stereo"
		device.description = "Built-in Audio Analog Stereo"
		alsa.mixer_name = "Realtek ALC887-VD"
		alsa.components = "HDA:10ec0887,1462d851,00100302"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		analog-input-front-mic: Front Microphone (priority 8500, latency offset 0 usec, available: yes)
			properties:
				device.icon_name = "audio-input-microphone"
		analog-input-rear-mic: Rear Microphone (priority 8200, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "audio-input-microphone"
		analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no)
			properties:
				
	active port: <analog-input-front-mic>
    index: 3
	name: <alsa_input.pci-0000_00_1b.0.analog-stereo.echo-cancel>
	driver: <module-echo-cancel.c>
	flags: HW_MUTE_CTRL LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 1000
	volume: mono: 21845 /  33%
	        balance 0.00
	base volume: 65536 / 100%
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max rewind: 0 KiB
	sample spec: float32le 1ch 32000Hz
	channel map: mono
	             Mono
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
	module: 24
	properties:
		device.master_device = "alsa_input.pci-0000_00_1b.0.analog-stereo"
		device.class = "filter"
		device.intended_roles = "phone"
		device.description = "Built-in Audio Analog Stereo (echo cancelled with Built-in Audio Analog Stereo)"
		device.icon_name = "audio-input-microphone"
    index: 4
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo.echo-cancel.monitor>
	driver: <module-echo-cancel.c>
	flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 1000
	volume: mono: 65536 / 100% / 0.00 dB
	        balance 0.00
	base volume: 65536 / 100% / 0.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max rewind: 0 KiB
	sample spec: float32le 1ch 32000Hz
	channel map: mono
	             Mono
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
	monitor_of: 2
	module: 24
	properties:
		device.description = "Monitor of Built-in Audio Analog Stereo (echo cancelled with Built-in Audio Analog Stereo)"
		device.class = "monitor"
		device.icon_name = "audio-input-microphone"
    index: 5
	name: <alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2.monitor>
	driver: <module-alsa-card.c>
	flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 1030
	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
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max rewind: 0 KiB
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 1999.82 ms
	monitor_of: 3
	card: 2 <alsa_card.pci-0000_01_00.1>
	module: 27
	properties:
		device.description = "Monitor of GP104 High Definition Audio Controller Digital Stereo (HDMI 3)"
		device.class = "monitor"
		alsa.card = "1"
		alsa.card_name = "HDA NVidia"
		alsa.long_card_name = "HDA NVidia at 0xf7080000 irq 17"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:01:00.1"
		sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
		device.bus = "pci"
		device.vendor.id = "10de"
		device.vendor.name = "NVIDIA Corporation"
		device.product.id = "10f0"
		device.product.name = "GP104 High Definition Audio Controller"
		device.string = "1"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"

list-sources-outputs

2 source output(s) available.
    index: 0
	driver: <module-echo-cancel.c>
	flags: START_CORKED 
	state: CORKED
	source: 2 <alsa_input.pci-0000_00_1b.0.analog-stereo>
	volume: mono: 65536 / 100% / 0.00 dB
	        balance 0.00
	muted: no
	current latency: 0.00 ms
	requested latency: 100.00 ms
	sample spec: float32le 1ch 32000Hz
	channel map: mono
	             Mono
	resample method: speex-float-1
	owner module: 24
	properties:
		media.name = "Echo-Cancel Source Stream"
		media.role = "filter"
		module-stream-restore.id = "source-output-by-media-role:filter"
    index: 2
	driver: <protocol-native.c>
	flags: 
	state: RUNNING
	source: 2 <alsa_input.pci-0000_00_1b.0.analog-stereo>
	volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	muted: no
	current latency: 0.00 ms
	requested latency: 30.00 ms
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	resample method: (null)
	owner module: 12
	client: 6 <WEBRTC VoiceEngine>
	properties:
		media.name = "recStream"
		application.name = "WEBRTC VoiceEngine"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "33"
		application.process.binary = "Discord"
		application.language = "en_GB.UTF-8"
		window.x11.display = ":0.0"
		application.process.session_id = "2"
		module-stream-restore.id = "source-output-by-application-name:WEBRTC VoiceEngine"

Offline

#4 2020-09-30 20:32:59

elfomelo
Member
Registered: 2011-10-27
Posts: 47

Re: Discord high CPU usage (possible pulseaudio problem)

I'm having the same issue. Did you happen to find any solution?

Offline

Board footer

Powered by FluxBB