From 3f541452c4916b31a222043b172b3398647b8091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 30 Oct 2009 09:27:59 +0100 Subject: [PATCH] pulsesink: Only set the volume on stream connection if pulse >= 0.9.20 is available In older versions the volume set during stream connection had no defined sematic and usually it was a relative volume. What was needed for our use case is an absolute volume though, otherwise the volume will be always decreased on stream connection if it's less than 100%. Since pulse 0.9.20 that volume is always an absolute volume if flat volumes are used and relative otherwise, which is the same as for pa_context_set_sink_input_volume(). Relevant pulse changesets: http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=f27a50691c8fe45bac7dd6b21fac91a359def3a1 http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=2501687579e359d5032a4d165b2ffc8f5b1b8ba6 --- configure.ac | 4 ++++ ext/pulse/pulsesink.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 36b3884807..0e6d63cbc5 100644 --- a/configure.ac +++ b/configure.ac @@ -772,6 +772,10 @@ AG_GST_CHECK_FEATURE(PULSE, [pulseaudio plug-in], pulseaudio, [ if test x$HAVE_PULSE_0_9_15 = xyes; then AC_DEFINE(HAVE_PULSE_0_9_15, 1, [defined if pulseaudio >= 0.9.15 is available]) fi + AG_GST_PKG_CHECK_MODULES(PULSE_0_9_20, libpulse >= 0.9.20) + if test x$HAVE_PULSE_0_9_20 = xyes; then + AC_DEFINE(HAVE_PULSE_0_9_20, 1, [defined if pulseaudio >= 0.9.20 is available]) + fi ]) dnl *** dv1394 *** diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index f1907fe2eb..45c36652c1 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -606,7 +606,10 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) const pa_buffer_attr *actual; pa_channel_map channel_map; pa_operation *o = NULL; - pa_cvolume v, *pv; +#if HAVE_PULSE_0_9_20 + pa_cvolume v; +#endif + pa_cvolume *pv = NULL; pa_stream_flags_t flags; const gchar *name; GstAudioClock *clock; @@ -677,6 +680,7 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) GST_INFO_OBJECT (psink, "prebuf: %d", wanted.prebuf); GST_INFO_OBJECT (psink, "minreq: %d", wanted.minreq); +#if HAVE_PULSE_0_9_20 /* configure volume when we changed it, else we leave the default */ if (psink->volume_set) { GST_LOG_OBJECT (psink, "have volume of %f", psink->volume); @@ -686,6 +690,7 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) } else { pv = NULL; } +#endif /* construct the flags */ flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE |