diff options
-rw-r--r-- | ext/pulse/pulsesink.c | 32 | ||||
-rw-r--r-- | ext/pulse/pulsesink.h | 2 |
2 files changed, 22 insertions, 12 deletions
diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index 48bd7f2f..92b61884 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -482,8 +482,10 @@ gst_pulsering_stream_request_cb (pa_stream * s, size_t length, void *userdata) GST_LOG_OBJECT (psink, "got request for length %" G_GSIZE_FORMAT, length); - if (pbuf->in_commit) { - /* only signal when we are waiting in the commit thread */ + if (pbuf->in_commit && (length >= rbuf->spec.segsize)) { + /* only signal when we are waiting in the commit thread + * and got request for atleast a segment + */ pa_threaded_mainloop_signal (psink->mainloop, 0); } } @@ -729,6 +731,8 @@ gst_pulsering_set_corked (GstPulseRingBuffer * pbuf, gboolean corked, goto server_dead; } pbuf->corked = corked; + } else { + GST_DEBUG_OBJECT (psink, "skipping, already in requested state"); } res = TRUE; @@ -818,18 +822,19 @@ gst_pulseringbuffer_stop (GstRingBuffer * buf) pa_threaded_mainloop_signal (psink->mainloop, 0); } - /* then try to flush, it's not fatal when this fails */ - GST_DEBUG_OBJECT (psink, "flushing"); - if ((o = pa_stream_flush (pbuf->stream, gst_pulsering_success_cb, pbuf))) { - while (pa_operation_get_state (o) == PA_OPERATION_RUNNING) { - GST_DEBUG_OBJECT (psink, "wait for completion"); - pa_threaded_mainloop_wait (psink->mainloop); - if (gst_pulsering_is_dead (psink, pbuf)) - goto server_dead; + if (strcmp (psink->pa_version, "0.9.12")) { + /* then try to flush, it's not fatal when this fails */ + GST_DEBUG_OBJECT (psink, "flushing"); + if ((o = pa_stream_flush (pbuf->stream, gst_pulsering_success_cb, pbuf))) { + while (pa_operation_get_state (o) == PA_OPERATION_RUNNING) { + GST_DEBUG_OBJECT (psink, "wait for completion"); + pa_threaded_mainloop_wait (psink->mainloop); + if (gst_pulsering_is_dead (psink, pbuf)) + goto server_dead; + } + GST_DEBUG_OBJECT (psink, "flush completed"); } - GST_DEBUG_OBJECT (psink, "flush completed"); } - res = TRUE; cleanup: @@ -1377,6 +1382,9 @@ gst_pulsesink_init (GstPulseSink * pulsesink, GstPulseSinkClass * klass) pulsesink->notify = 0; + /* needed for conditional execution */ + pulsesink->pa_version = pa_get_library_version (); + g_assert ((pulsesink->mainloop = pa_threaded_mainloop_new ())); g_assert (pa_threaded_mainloop_start (pulsesink->mainloop) == 0); diff --git a/ext/pulse/pulsesink.h b/ext/pulse/pulsesink.h index 2f74ac3a..cee17faf 100644 --- a/ext/pulse/pulsesink.h +++ b/ext/pulse/pulsesink.h @@ -62,6 +62,8 @@ struct _GstPulseSink gdouble volume; gboolean volume_set; gint notify; + + const gchar *pa_version; }; struct _GstPulseSinkClass |