Pulseaudio debugging techniques

Internet resources

  1. pulseaudio Troubleshooting https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting here is a failure and possible solutions pulseaudio, such as broken sound, etc., can refer to.
    (Note Arch Linux: This site can first mark, there are a lot of other knowledge, such as Bluetooth, wifi, network, Bluetooth headset, pulseaudio how to configure the Bluetooth headset, you can learn)

  2. Introduction pulseaudio code frame, modules, components, etc. of the base, there may be a system on the pulseaudio cognitive services and client source https://gavv.github.io/articles/pulseaudio-under-the-hood/ # about-pulseaudio

  3. This man is now the defenders of pulseaudio source: can focus the next https://www.patreon.com/tanuk

  4. pulseaudio profile path: / etc / pulse /
    4 configuration file describes specific configuration: https://wiki.archlinux.org/index.php/PulseAudio/Configuration

FIG pulseaudio stream flow architecture

Chart

sink and sink-input is an output device, source and source-output is an input device such as a microphone (currently requires the use of structures capture environment, without the use of a formal application scenario scenario), which are applied to the server.

Source sink-input data is the client by sending commands or data using the native protocols socket (or remotely) passed over.

Debugging skills and attention to points

  • pulseaudio startup script path: /etc/init.d/ *

  • pulseaudio server program path: / usr / bin /

  • Open server logs

Commissioning of the first kill pulseaudio service, and then start the last to remember our Lord restart process (A113 lua version of the activation process, yodaos the vui process, because you want the client to reconnect server)

  pulseaudio --system --daemonize=no  --log-level=4 ......

--log-level parameters: Set the log level is debug level Level 4

typedef enum pa_log_level {
    PA_LOG_ERROR  = 0,    /* Error messages */
    PA_LOG_WARN   = 1,    /* Warning messages */
    PA_LOG_NOTICE = 2,    /* Notice messages */
    PA_LOG_INFO   = 3,    /* Info messages */
    PA_LOG_DEBUG  = 4,    /* Debug messages */
    PA_LOG_LEVEL_MAX
} pa_log_level_t;
  • Using gdb debugging

The reasons for the problem will now, many times only gdb tracking code will be very easy to find the problem. Before commissioning the need to build a good debugging environment, you need:

  1. Gdb openwrt compiled by the target board.
  2. Recompiled (increase cflags = -g) libraries with dynamic symbol table a replacement board.

Upon entering the practical application gdb can have many means to recover it will now issue just now.

  • Use pactl command

pactl is pulseaudio comes with commands that can help us know the status of the current status of each pulseaudio sink, sink-input, source, source-output of. It can help us to do the following:

pactl command table

In the above command, to include some of the currently used commands:

  • pactl load-module module is loaded via the command line, this command will need to build in the listening environment.
  • pactl move- (sink-input | source-output) #N SINK | SOURCE move the current input link sink.
  • pactl set- (sink | source) volume to set the volume
  • pactl set- (sink | source) -mute #N 1 | 0 | toggle
    mute. Which is a toggle flip meaning.

Similarly, we can also use the command word pacmd pulseaudio provided to achieve the above-mentioned operation, and more

  • Pcm data capture hardware is listening

      $ vspdump -m b -d 10 -O
    

Wherein when the monitor 10 is long, in seconds.

  • Analog playback playback applications

We can play a normal voice to confirm sink-input to sink this link is normal.

  1. Enter the command wav format music player

    $ paplay input.wav
    
  • Capture sink pcm data

If you need to capture the pcm data sink can be used in the following manner:

 

  1. Load Module pipe sink

     $ pactl load-module module-pipe-sink file="$(pwd)/output.pcm"
    
  2. Load Module loopback

     $ pactl load-module module-loopback
    
  3. Use pactl command link loopback sink-input to pipe sink

  4. Use pactl command link loopback source-output to sink monior (each sink will generate a default monitor)

  5. Pcm start capturing data

     $ pacat output.pcm
    
  • Capture sink-input pcm data

  1. 加载pipe sink module

     $ pactl load-module module-pipe-sink file="$(pwd)/output.pcm"
    
  2. Play playback stream

     $ paplay input.wav
    
  3. The use pactl sink sink input linked to the pipe.
    4. start capturing data pcm

     $ pacat output.pcm
    
  • Capture sink input and converted to wav format

Than before to capture more space.

 

  1. Load null sink

     $ pactl load-module module-null-sink
    

2. Start playback playback stream

    $ paplay input.wav

3. Start recording

    $ parecord output.wav
  1. Use pactl command link sink-input to the null sink.
  2. Use pactl command link source-output to null sink monitor.
Published 755 original articles · won praise 464 · Views 2.47 million +

Guess you like

Origin blog.csdn.net/u010164190/article/details/105336370