pulsesrc: Mute stream post-connection if required

A bug in PulseAudio causes PA_STREAM_START_MUTED to be rejected on
record streams. Until this is fixed upstream, we mute the stream
manually at startup. Based on a patch by Alban Browaeys
<prahal@yahoo.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=684469
This commit is contained in:
Arun Raghavan 2012-09-20 19:58:12 +02:00
parent 1026970347
commit 027cc0e463

View file

@ -1431,9 +1431,6 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
PA_STREAM_NOT_MONOTONIC | PA_STREAM_ADJUST_LATENCY |
PA_STREAM_START_CORKED;
if (pulsesrc->mute_set && pulsesrc->mute)
flags |= PA_STREAM_START_MUTED;
if (pa_stream_connect_record (pulsesrc->stream, pulsesrc->device, &wanted,
flags) < 0) {
goto connect_failed;
@ -1465,6 +1462,15 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
pulsesrc->source_output_idx = pa_stream_get_index (pulsesrc->stream);
g_object_notify (G_OBJECT (pulsesrc), "source-output-index");
/* Although source output stream muting is supported, there is a bug in
* PulseAudio that doesn't allow us to do this at startup, so we mute
* manually post-connect. This should be moved back pre-connect once things
* are fixed on the PulseAudio side. */
if (pulsesrc->mute_set && pulsesrc->mute) {
gst_pulsesrc_set_stream_mute (pulsesrc, pulsesrc->mute);
pulsesrc->mute_set = FALSE;
}
if (pulsesrc->volume_set) {
gst_pulsesrc_set_stream_volume (pulsesrc, pulsesrc->volume);
pulsesrc->volume_set = FALSE;