[Spice-devel] [PATCH spice-gtk 3/3] Add configurable value for gst_max_bytes

Christophe de Dinechin christophe at dinechin.org
Thu Jul 13 14:57:28 UTC 2017


From: Christophe de Dinechin <dinechin at redhat.com>

The GStreamer configuration currently sets max-bytes=0 in the pipeline.
The rationale is that we need to be able to keep frames in case later frames
require them for decoding. However, having experienced scenarios where
spice would accumulate gigabytes of late frames. So it would be useful
to be able to configure that value at runtime.

Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
 src/channel-display-gst.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index 17c2847..b60c7df 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -332,6 +332,8 @@ static void app_source_setup(GstElement *pipeline G_GNUC_UNUSED,
 }
 #endif
 
+SPICE_TWEAK_DEFINE(gst_max_bytes, 0, "Max number of bytes queued, 0=unlimited");
+
 static gboolean create_pipeline(SpiceGstDecoder *decoder)
 {
     GstAppSinkCallbacks appsink_cbs = { NULL };
@@ -388,9 +390,10 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
      * - Set max-bytes=0 on appsrc so it does not drop frames that may be
      *   needed by those that follow.
      */
-    desc = g_strdup_printf("appsrc name=src is-live=true format=time max-bytes=0 block=true "
+    desc = g_strdup_printf("appsrc name=src is-live=true format=time max-bytes=%lu block=true "
                            "caps=%s ! %s ! videoconvert ! appsink name=sink "
                            "caps=video/x-raw,format=BGRx sync=false drop=false",
+                           SPICE_TWEAK(gst_max_bytes),
                            gst_opts[decoder->base.codec_type].dec_caps,
                            gst_opts[decoder->base.codec_type].dec_name);
     SPICE_DEBUG("GStreamer pipeline: %s", desc);
-- 
2.11.0 (Apple Git-81)



More information about the Spice-devel mailing list