Commit 1eb324f60f8df6bc7a866679919d79f1a2a3ff81

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
  
569569 return;
570570 }
571571 pa_operation_unref(o);
572
573 // In the case of reconnection or simply lagging behind the stream object creation
574 // on startup (due to the probe+reconnect system), we invalidate all loaded streams
575 // and then load up info about all streams.
576 for (QMap<QString, PulseStream*>::iterator it = s_outputStreams.begin(); it != s_outputStreams.end(); ++it) {
577 PulseStream *stream = *it;
578 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()));
579 stream->setIndex(PA_INVALID_INDEX);
580 }
581 if (!(o = pa_context_get_sink_input_info_list(c, sink_input_cb, NULL))) {
582 logMessage(QString("pa_context_get_sink_input_info_list() failed"));
583 return;
584 }
585 pa_operation_unref(o);
586
587 for (QMap<QString, PulseStream*>::iterator it = s_captureStreams.begin(); it != s_captureStreams.end(); ++it) {
588 PulseStream *stream = *it;
589 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()));
590 stream->setIndex(PA_INVALID_INDEX);
591 }
592 if (!(o = pa_context_get_source_output_info_list(c, source_output_cb, NULL))) {
593 logMessage(QString("pa_context_get_source_output_info_list() failed"));
594 return;
595 }
596 pa_operation_unref(o);
572597 }
573598
574599#ifdef HAVE_PULSEAUDIO_DEVICE_MANAGER