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
This commit is contained in:
Sebastian Dröge 2009-10-30 09:27:59 +01:00
parent 0c12f585e3
commit 3f541452c4
2 changed files with 10 additions and 1 deletions

View file

@ -772,6 +772,10 @@ AG_GST_CHECK_FEATURE(PULSE, [pulseaudio plug-in], pulseaudio, [
if test x$HAVE_PULSE_0_9_15 = xyes; then 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]) AC_DEFINE(HAVE_PULSE_0_9_15, 1, [defined if pulseaudio >= 0.9.15 is available])
fi 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 *** dnl *** dv1394 ***

View file

@ -606,7 +606,10 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
const pa_buffer_attr *actual; const pa_buffer_attr *actual;
pa_channel_map channel_map; pa_channel_map channel_map;
pa_operation *o = NULL; 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; pa_stream_flags_t flags;
const gchar *name; const gchar *name;
GstAudioClock *clock; 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, "prebuf: %d", wanted.prebuf);
GST_INFO_OBJECT (psink, "minreq: %d", wanted.minreq); 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 */ /* configure volume when we changed it, else we leave the default */
if (psink->volume_set) { if (psink->volume_set) {
GST_LOG_OBJECT (psink, "have volume of %f", psink->volume); GST_LOG_OBJECT (psink, "have volume of %f", psink->volume);
@ -686,6 +690,7 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
} else { } else {
pv = NULL; pv = NULL;
} }
#endif
/* construct the flags */ /* construct the flags */
flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE |