Bug 53892 - Distorted sound with time-based scheduling (tsched=1 for module-udev-detect)
Summary: Distorted sound with time-based scheduling (tsched=1 for module-udev-detect)
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-21 18:35 UTC by David Lynam
Modified: 2018-07-30 10:11 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
PA alsa sink log. (5.05 KB, application/octet-stream)
2012-08-21 18:35 UTC, David Lynam
Details
Null sink log. (6.70 KB, application/octet-stream)
2012-08-21 18:35 UTC, David Lynam
Details
FFmpeg log. (1.18 KB, text/x-log)
2012-08-21 18:36 UTC, David Lynam
Details
FFmpeg log #2. (4.75 KB, text/x-log)
2012-08-21 18:36 UTC, David Lynam
Details
Loopback module log. (1.34 KB, text/x-log)
2012-08-21 18:36 UTC, David Lynam
Details

Description David Lynam 2012-08-21 18:35:25 UTC
Created attachment 65902 [details]
PA alsa sink log.

Using PulseAudio (with a null sink and loopback) as the audio input for ffmpeg causes severe distortion in the output after 20-40 seconds of encoding. This occurs in any case, i.e. while recording video (x11grab) or simply dumping to a .wav file.

The ability to record/stream should be equivalent to Xsplit/FFsplit on Windows: the latter uses ffmpeg and is mostly smooth.

Additional info:
Linux 3.4.8-1-ARCH #1 SMP PREEMPT 
pulseaudio 2.1-1
alsa-lib 1.0.25-1
alsa-utils 1.0.25-3
ffmpeg 1:0.11.1-1 and N-43565-gaec9390
pavucontrol 1.0-1

The same problem is experienced by at least one other person: http://www.linuxquestions.org/questions/linux-software-2/pulse-audio-module-loopback-distortion-942066/

Steps to reproduce:
Set up a null sink and loopback monitor of sound card output to the sink. Run ffmpeg (-i alsa -f pulse) and use pavucontrol to direct the monitor of the null sink to ffmpeg.

Open the output file or view the stream (if streaming); around 30 seconds into the video, sound will suddenly contain loud glitches, distortions and increases/decreases in speed and pitch.

Workaround:
Modifying /etc/pulse/default.pa to re-enable interrupt-based scheduling (load-module module-udev-detect tsched=0) seems to alleviate the distortion problem but also increases CPU consumption and makes sound unusable in Wine.

Variables which have been tinkered with to no avail:
(PA) real-time priority
(PA) high priority
(PA/ffmpeg) sampling rate
(pavucontrol) muting different inputs, outputs, removing microphone/USB headset
(ffmpeg) building from git
(ffmpeg) changing audio encoding, trying every thread value from 0-6 (6-core CPU)
Comment 1 David Lynam 2012-08-21 18:35:58 UTC
Created attachment 65903 [details]
Null sink log.
Comment 2 David Lynam 2012-08-21 18:36:15 UTC
Created attachment 65904 [details]
FFmpeg log.
Comment 3 David Lynam 2012-08-21 18:36:37 UTC
Created attachment 65905 [details]
FFmpeg log #2.
Comment 4 David Lynam 2012-08-21 18:36:51 UTC
Created attachment 65906 [details]
Loopback module log.
Comment 5 Vittorio Romeo 2013-09-18 20:46:21 UTC
This bug hasn't yet been fixed - I'm experiencing the same issues as David Lynam with the latest version of Arch Linux x64, using the save loopback/sink setup.
Anything I can upload to help resolve the bug?
Comment 6 Raymond 2013-09-25 01:25:52 UTC
if you are using vt1708s and want to record playback and Mic

why don't you use stereo mix to select node 0x16  as input source ?
 

 mix of node 0x10 audio output and the Mic input

Node 0x16 [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
  Control: name="Master Front Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Master Front Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Mic Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=2, ofs=0
  Control: name="Mic Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=2, ofs=0
  Control: name="Front Mic Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=4, ofs=0
  Control: name="Front Mic Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=4, ofs=0
  Control: name="Line Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="Line Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="CD Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=1, ofs=0
  Control: name="CD Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=1, ofs=0
  Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x9d 0x9d] [0x1a 0x1a] [0x8e 0x8e] [0x1a 0x1a] [0x0d 0x0d] [0x97 0x97] [0x97 0x97]
  Power states:  D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 7
     0x10 0x1f 0x1a 0x1b 0x1e 0x1d 0x25
Node 0x17 [Audio Selector] wcaps 0x300501: Stereo
  Control: name="Input Source", index=0, device=0
  Power states:  D0 D1 D2 D3
  Power: setting=D3, actual=D3
  Connection: 6
     0x1f 0x1a* 0x1b 0x1e 0x1d 0x16
Comment 7 GitLab Migration User 2018-07-30 10:11:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/261.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.