pa_cvolume v;
pa_operation *o = NULL;
GstPulseRingBuffer *pbuf;
+ uint32_t idx;
pa_threaded_mainloop_lock (psink->mainloop);
pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK (psink)->ringbuffer);
if (pbuf == NULL || pbuf->stream == NULL)
- goto unlock;
+ goto no_buffer;
+
+ if ((idx = pa_stream_get_index (pbuf->stream)) == PA_INVALID_INDEX)
+ goto no_index;
gst_pulse_cvolume_from_linear (&v, pbuf->sample_spec.channels, volume);
- if (!(o = pa_context_set_sink_input_volume (pbuf->context,
- pa_stream_get_index (pbuf->stream), &v, NULL, NULL)))
+ if (!(o = pa_context_set_sink_input_volume (pbuf->context, idx,
+ &v, NULL, NULL)))
goto volume_failed;
/* We don't really care about the result of this call */
return;
/* ERRORS */
+no_buffer:
+ {
+ GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
+ goto unlock;
+ }
+no_index:
+ {
+ GST_DEBUG_OBJECT (psink, "we don't have a stream index");
+ goto unlock;
+ }
volume_failed:
{
GST_ELEMENT_ERROR (psink, RESOURCE, FAILED,
GstPulseRingBuffer *pbuf;
pa_operation *o = NULL;
gdouble v;
+ uint32_t idx;
pa_threaded_mainloop_lock (psink->mainloop);
if (pbuf == NULL || pbuf->stream == NULL)
goto no_buffer;
- if (!(o = pa_context_get_sink_input_info (pbuf->context,
- pa_stream_get_index (pbuf->stream),
+ if ((idx = pa_stream_get_index (pbuf->stream)) == PA_INVALID_INDEX)
+ goto no_index;
+
+ if (!(o = pa_context_get_sink_input_info (pbuf->context, idx,
gst_pulsesink_sink_input_info_cb, pbuf)))
goto info_failed;
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
goto unlock;
}
+no_index:
+ {
+ GST_DEBUG_OBJECT (psink, "we don't have a stream index");
+ goto unlock;
+ }
info_failed:
{
GST_ELEMENT_ERROR (psink, RESOURCE, FAILED,