Phonon/Debugging: Difference between revisions

From KDE Community Wiki
(debugging!)
 
(Replaced content with 'Moved to http://techbase.kde.org/Development/Tutorials/Debugging/Phonon on Mar 8, 2011 --tdfischer')
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This page is a draft that need worked on. Eventually, it'll end up on Techbase as a one-stop shop to send people to when they're having phonon problems.
Moved to http://techbase.kde.org/Development/Tutorials/Debugging/Phonon on Mar 8, 2011 --tdfischer
 
= Environment Variables =
 
In general, there is one easy way to give Phonon devs all the information they need to help fix your problem.
 
Set these environment variables:
<pre>
$ export PHONON_VLC_DEBUG=5
$ export PHONON_GST_DEBUG=5
</pre>
 
Then run your program. The terminal will fill up with gobs of debugging output.
 
== Phonon-GStreamer debugging ==
 
=== Even more verbose output ===
 
Phonon-gst has some fancier debug options available. In addition to PHONON_GST_DEBUG, there is PHONON_GST_GST_DEBUG. Setting it to 8 or so will cause the gstreamer libraries to produce ''copious'' quantities of debug output. We're talking thousands of lines of what seems to be useless noise. Roughly 1% of it is useful, but the phonon-gst devs can easily decipher it and drill down to the important bits.
 
=== Pulseaudio ===
 
Pulseaudio and phonon try their hardest to get along. Sometimes, it doesn't work. Luckily, there is a way to test gstreamer and pulseaudio to see who is at fault.
 
<pre>
$ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! pulsesink
$ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! alsasink
</pre>
 
If they both work flawlessly, blame Phonon-GStreamer.
 
If the first works but the second doesn't, you might have an exotic sound setup that involves tweaking the alsasink parameters to reflect what pulseaudio does to alsa.
 
If the second works but the first doesn't, you can blame pulseaudio.
 
Another way to confirm this is by setting the PHONON_GST_AUDIOSINK environment variable. Setting it to e.g. "pulsesink" uses the pulseaudio sink.
 
=== Recreating the phonon-gst pipeline ===
 
Phonon-GStreamer creates predicable pipelines. In general, they look like this:
 
<!-- FIXME: We need a nice diagram -->
 
<pre>
filesrc -> decodebin2 -> queue -> audioresample -> audioconvert -> pulsesink
                  \
                    -> ffmpegcolorspace -> queue -> xvimagesink
</pre>
 
If the input stream isn't coming from a file, it is likely coming in via KIO which pipes it into an abstractmediastream. If pulseaudio isn't used, then replace pulsesink with something of alsasink, osssink, or somesuch.
 
Recreating the playback stream of some video file can be done as such:
<pre>
$ gst-launch filesrc location=/path/to/video ! decdebin2 name=dec ! audioresample ! audioconvert ! pulsesink \
    dec. ! ffmpegcolorspace ! xvimagesink
</pre>
 
DVD playback is a bit different:
<pre>
  (subpicture stream)
      /--->---\
rsndvdbin -> dvdspu -> ffmpegcolorspace -> queue -> xvimagesink
      \-> queue -> audioresample -> audioconvert -> pulsesink
</pre>
 
This is built with the following:
<pre>
$ gst-launch rsndvdbin ! dvdspu ! ffmpegcolorspace ! queue ! xvimagesink \
    rsndvdbin0 ! dvdspu0.subpicture \
    rsndvdbin0 ! queue ! audioresample ! audioconvert ! pulsesink
</pre>

Latest revision as of 01:39, 19 March 2011