Bug 235193 - phonon-backend-xine-4.4.1 (with pulseaudio) = no audio
Summary: phonon-backend-xine-4.4.1 (with pulseaudio) = no audio
Status: RESOLVED FIXED
Alias: None
Product: Phonon
Classification: Frameworks and Libraries
Component: Xine backend (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Colin Guthrie
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-23 18:32 UTC by Rex Dieter
Modified: 2010-12-05 21:42 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.4.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rex Dieter 2010-04-23 18:32:56 UTC
Version:           4.4.1 (using KDE 4.4.2)
OS:                Linux
Installed from:    Fedora RPMs

Testing out newly released phonon-4.4.1, and can't get any audio from phonon applications (tested with amarok and dragon) when using -xine backend.  

I tested on fedora 13-beta, and a tester confirmed independantly on fedora 12.

I tested the following extra combinations:
phonon-4.4.0 + phonon-backend-xine-4.4.1 : works
phonon-4.4.1 + phonon-backend-xine-4.4.0 : no audio either

Strangely enough, systemsettings->multimedia "Test" button did work in all cases.

-gstreamer backend seemed ok all around in my initial testing.
Comment 1 Rex Dieter 2010-04-23 18:40:39 UTC
Fwiw, both pavucontrol and kmix report the volume coming to pulseaudio from these apps is nil.
Comment 2 Colin Guthrie 2010-04-23 18:45:09 UTC
Hmm seems I must have broken it :s I thought I'd tested xine, but I guess not.

Should be simple to fix. Due to hijacking the volume commands it's likely that the volume pushed to xine itself is 0

I'll take a look over the weekend.
Comment 3 Colin Guthrie 2010-04-24 15:58:37 UTC
commit b44f19d7038f7e6182db4d29aee39dab569193fd
Author: Colin Guthrie <cguthrie@mandriva.org>
Date:   Sat Apr 24 14:25:31 2010 +0100

    xine: Initialise volume to 1.
    
    When PulseAudio is used, it's essential that the internal representation
    of the volume remains at the maxium. Xine will use this to set the initial volume.
    
    Thankfully, xine's PulseAudio output does not seem to use per-application volume control
    as otherwise this 100% would be passed on an prevent PA from saving
    volumes properly.
    
    Currently, however one more problem remains with Xine+PA+volume
    in that the standard volume widget does not seem to be hooked up
    correctly. I'll look at this problem next.
    BUG: 235193

diff --git a/xine/audiooutput.cpp b/xine/audiooutput.cpp
index 05b9240..f9f922e 100644
--- a/xine/audiooutput.cpp
+++ b/xine/audiooutput.cpp
@@ -48,6 +48,7 @@ namespace Xine
 
 AudioOutput::AudioOutput(QObject *parent)
     : AbstractAudioOutput(new AudioOutputXT, parent)
+    , m_volume(1.0)
 {
 }
Comment 4 Colin Guthrie 2010-04-24 15:58:39 UTC
commit 1eb324f60f8df6bc7a866679919d79f1a2a3ff81
Author: Colin Guthrie <cguthrie@mandriva.org>
Date:   Sat Apr 24 14:54:36 2010 +0100

    pulse: Fix the reading of stream information on startup.
    
    Due to the new probe+reconnect logic, it is possible to initialise
    a 'PulseStream' object and start the backend outputting it
    prior to our control connection being established. This means that
    we miss the subscription event and never actually associate the
    PA stream index with our stream object. Whenever something changes
    on the stream at the PA end things would kick in and would work fine,
    so this was sometimes hard to see and identify.
    
    This change simply invalidates all streams when we're finished connecting
    to PA and then loads up all info from PA to set the indexes correctly.
    
    CCBUG: 235193

diff --git a/phonon/pulsesupport.cpp b/phonon/pulsesupport.cpp
index f4f2a13..92a732d 100644
--- a/phonon/pulsesupport.cpp
+++ b/phonon/pulsesupport.cpp
@@ -569,6 +569,31 @@ static void context_state_callback(pa_context *c, void *)
                 return;
             }
             pa_operation_unref(o);
+
+            // In the case of reconnection or simply lagging behind the stream object creation
+            // on startup (due to the probe+reconnect system), we invalidate all loaded streams
+            // and then load up info about all streams.
+            for (QMap<QString, PulseStream*>::iterator it = s_outputStreams.begin(); it != s_outputStreams.end(); ++it) {
+              PulseStream *stream = *it;
+              logMessage(QString("Phonon Output Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(stream->uuid()));
+              stream->setIndex(PA_INVALID_INDEX);
+            }
+            if (!(o = pa_context_get_sink_input_info_list(c, sink_input_cb, NULL))) {
+              logMessage(QString("pa_context_get_sink_input_info_list() failed"));
+              return;
+            }
+            pa_operation_unref(o);
+
+            for (QMap<QString, PulseStream*>::iterator it = s_captureStreams.begin(); it != s_captureStreams.end(); ++it) {
+              PulseStream *stream = *it;
+              logMessage(QString("Phonon Capture Stream %1 is gone at the PA end. Marking it as invalid in our cache as we may reuse it.").arg(stream->uuid()));
+              stream->setIndex(PA_INVALID_INDEX);
+            }
+            if (!(o = pa_context_get_source_output_info_list(c, source_output_cb, NULL))) {
+              logMessage(QString("pa_context_get_source_output_info_list() failed"));
+              return;
+            }
+            pa_operation_unref(o);
         }
 
 #ifdef HAVE_PULSEAUDIO_DEVICE_MANAGER
Comment 5 Rex Dieter 2010-04-24 22:21:51 UTC
sounds like a winner, thanks.
Comment 6 Colin J Thomson 2010-04-25 00:14:39 UTC
Confirmed, working fine now in F12, thanks.