<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 18 Jul 2017, at 17:54, Pavel Grunt <<a href="mailto:pgrunt@redhat.com" class="">pgrunt@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Tue, 2017-07-18 at 17:04 +0200, Christophe de Dinechin wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">On 14 Jul 2017, at 14:27, Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="">dinechin@redhat.com</a>> wrote:<br class=""><blockquote type="cite" class=""><br class="">This looks better than my fix. Can’t ack right now (I did not build and test<br class="">it yet), but that looks like a reasonable approach<br class=""><br class=""><blockquote type="cite" class="">On 14 Jul 2017, at 14:24, Pavel Grunt <<a href="mailto:pgrunt@redhat.com" class="">pgrunt@redhat.com</a>> wrote:<br class=""><br class="">This also fixes the huge memore leak reported by Christophe.<br class="">Steps to reproduce:<br class="">1. ./configure --disable-pulse --enable-gstaudio<br class="">2. connect to a vm streaming video with no audio playing<br class="">3. see the memory grow really fast<br class=""><br class="">It seems to be due to the fact that the "fake audio" channel updates the<br class="">mmtime<br class="">in a way that schedules the frames to the future ((unsigned) 0 - delay)<br class="">and then<br class="">gstreamer starts to queue the frames (they should be played later)<br class=""><br class="">Pavel<br class=""><br class="">On Fri, 2017-07-14 at 13:19 +0200, Pavel Grunt wrote:<br class=""><blockquote type="cite" class="">The fake channel has been introduced to get the audio volume by starting<br class="">the gstreamer's audio pipeline and querring its volume info (see commit<br class="">aa8d044417bbf60685f59163b874ecb4f157c3c9).<br class=""><br class="">Hovewer starting the pipeline updates the mmtime as a side effect. This<br class="">may cause a (big) delay in displaying a video stream.<br class=""><br class="">Because the fake channel is only needed to get the volume info, make<br class="">sure to not update the mm-time with it.<br class=""><br class="">Reported-by: Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="">dinechin@redhat.com</a>><br class="">---<br class="">src/spice-gstaudio.c | 11 +++++++----<br class="">1 file changed, 7 insertions(+), 4 deletions(-)<br class=""><br class="">diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c<br class="">index 014c3a5..715f824 100644<br class="">--- a/src/spice-gstaudio.c<br class="">+++ b/src/spice-gstaudio.c<br class="">@@ -38,6 +38,7 @@ struct stream {<br class="">  GstElement              *sink;<br class="">  guint                   rate;<br class="">  guint                   channels;<br class="">+    gboolean                fake; /* fake channel just for getting info<br class="">about<br class="">audio (volume) */<br class="">};<br class=""><br class="">struct _SpiceGstaudioPrivate {<br class="">@@ -264,6 +265,8 @@ static gboolean update_mmtime_timeout_cb(gpointer<br class="">data)<br class="">  SpiceGstaudioPrivate *p = gstaudio->priv;<br class="">  GstQuery *q;<br class=""><br class="">+    g_return_val_if_fail(!p->playback.fake, TRUE);<br class="">+<br class="">  q = gst_query_new_latency();<br class="">  if (gst_element_query(p->playback.pipe, q)) {<br class="">      gboolean live;<br class="">@@ -326,7 +329,7 @@ cleanup:<br class="">  if (p->playback.pipe)<br class="">      gst_element_set_state(p->playback.pipe, GST_STATE_PLAYING);<br class=""><br class="">-    if (p->mmtime_id == 0) {<br class="">+    if (!p->playback.fake && p->mmtime_id == 0) {<br class="">      update_mmtime_timeout_cb(gstaudio);<br class="">      p->mmtime_id = g_timeout_add_seconds(1, update_mmtime_timeout_cb,<br class="">gstaudio);<br class="">  }<br class="">@@ -569,7 +572,6 @@ static gboolean<br class="">spice_gstaudio_get_playback_volume_info_finish(SpiceAudio *audio<br class="">  GstElement *e;<br class="">  gboolean lmute;<br class="">  gdouble vol;<br class="">-    gboolean fake_channel = FALSE;<br class="">  GTask *task = G_TASK(res);<br class=""><br class="">  g_return_val_if_fail(g_task_is_valid(task, audio), FALSE);<br class="">@@ -584,9 +586,9 @@ static gboolean<br class="">spice_gstaudio_get_playback_volume_info_finish(SpiceAudio *audio<br class=""><br class="">  if (p->playback.sink == NULL || p->playback.channels == 0) {<br class="">      SPICE_DEBUG("PlaybackChannel not created yet, force start");<br class="">+        p->playback.fake = TRUE;<br class="">      /* In order to get system volume, we start the pipeline */<br class="">      playback_start(NULL, SPICE_AUDIO_FMT_S16, 2, 48000, audio);<br class="">-        fake_channel = TRUE;<br class="">  }<br class=""><br class="">  if (GST_IS_BIN(p->playback.sink))<br class="">@@ -604,9 +606,10 @@ static gboolean<br class="">spice_gstaudio_get_playback_volume_info_finish(SpiceAudio *audio<br class="">  }<br class="">  g_object_unref(e);<br class=""><br class="">-    if (fake_channel) {<br class="">+    if (p->playback.fake) {<br class="">      SPICE_DEBUG("Stop faked PlaybackChannel");<br class="">      playback_stop(SPICE_GSTAUDIO(audio));<br class="">+        p->playback.fake = FALSE;<br class="">  }<br class=""><br class="">  if (mute != NULL) {<br class=""></blockquote></blockquote></blockquote><br class="">This fixes the issue I was seeing with a black screen.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Does it fix the memory usage problem for you? it does for me.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>It fixes the case under light load, yes. It does not fix the issue under heavy load. For this one, I need the other patch (the one that resets the queue length. To me, that patch was not about that problem, though, and I did not expect it to address memory growth under load, so I’m still satisfied.</div><div><br class=""></div><div><br class=""></div><div>Christophe</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Pavel</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">Acked-by: Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="">dinechin@redhat.com</a>><br class=""><br class=""><blockquote type="cite" class=""><br class="">_______________________________________________<br class="">Spice-devel mailing list<br class=""><a href="mailto:Spice-devel@lists.freedesktop.org" class="">Spice-devel@lists.freedesktop.org</a><br class=""><a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" class="">https://lists.freedesktop.org/mailman/listinfo/spice-devel</a></blockquote></blockquote></div></blockquote></div><br class=""></body></html>