diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-08-06 12:58:13 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-08-06 12:58:13 +0200 |
commit | 34334b6ea385e34c9a2adf85ca284e9f62c2b518 (patch) | |
tree | ddd92b283dcaa3988f7bc6b9b905e46885e95e0f | |
parent | 0347a753c91dd7499f3cb6958f730ee4d83f8311 (diff) |
gst: increase buffers in sink
-rw-r--r-- | src/gst/gstpipewiresink.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index fbb21053..49f834d6 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -56,6 +56,8 @@ GST_DEBUG_CATEGORY_STATIC (pipewire_sink_debug); #define DEFAULT_PROP_MODE GST_PIPEWIRE_SINK_MODE_DEFAULT +#define MIN_BUFFERS 8u + enum { PROP_0, @@ -248,8 +250,10 @@ pool_activated (GstPipeWirePool *pool, GstPipeWireSink *sink) spa_pod_builder_add (&b, SPA_PARAM_BUFFERS_stride, SPA_POD_CHOICE_RANGE_Int(0, 0, INT32_MAX), - SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(SPA_MAX(4u, min_buffers), - SPA_MAX(2u, min_buffers), max_buffers ? max_buffers : INT32_MAX), + SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int( + SPA_MAX(MIN_BUFFERS, min_buffers), + SPA_MAX(MIN_BUFFERS, min_buffers), + max_buffers ? max_buffers : INT32_MAX), SPA_PARAM_BUFFERS_align, SPA_POD_Int(16), 0); port_params[0] = spa_pod_builder_pop (&b, &f); @@ -583,13 +587,14 @@ gst_pipewire_sink_render (GstBaseSink * bsink, GstBuffer * buffer) if (buffer->pool != GST_BUFFER_POOL_CAST (pwsink->pool)) { GstBuffer *b = NULL; GstMapInfo info = { 0, }; + GstBufferPoolAcquireParams params = { 0, }; pw_thread_loop_unlock (pwsink->core->loop); if (!gst_buffer_pool_is_active (GST_BUFFER_POOL_CAST (pwsink->pool))) gst_buffer_pool_set_active (GST_BUFFER_POOL_CAST (pwsink->pool), TRUE); - if ((res = gst_buffer_pool_acquire_buffer (GST_BUFFER_POOL_CAST (pwsink->pool), &b, NULL)) != GST_FLOW_OK) + if ((res = gst_buffer_pool_acquire_buffer (GST_BUFFER_POOL_CAST (pwsink->pool), &b, ¶ms)) != GST_FLOW_OK) goto done; gst_buffer_map (b, &info, GST_MAP_WRITE); @@ -755,6 +760,7 @@ gst_pipewire_sink_change_state (GstElement * element, GstStateChange transition) pw_thread_loop_lock (this->core->loop); pw_stream_set_active(this->stream, false); pw_thread_loop_unlock (this->core->loop); + gst_buffer_pool_set_flushing(GST_BUFFER_POOL_CAST(this->pool), TRUE); break; default: break; @@ -766,6 +772,7 @@ gst_pipewire_sink_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_PLAYING_TO_PAUSED: break; case GST_STATE_CHANGE_PAUSED_TO_READY: + gst_buffer_pool_set_active(GST_BUFFER_POOL_CAST(this->pool), FALSE); break; case GST_STATE_CHANGE_READY_TO_NULL: gst_pipewire_sink_close (this); |