[Spice-devel] [spice-html5 audio 4/4] Implement support for the playback stop message.

Jeremy White jwhite at codeweavers.com
Wed Sep 28 20:25:04 UTC 2016


This allows audio processing to be more robust in Firefox.

Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 playback.js | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/playback.js b/playback.js
index 55dc0e8..48d4cdd 100644
--- a/playback.js
+++ b/playback.js
@@ -158,7 +158,22 @@ SpicePlaybackConn.prototype.process_channel_message = function(msg)
 
     if (msg.type == SPICE_MSG_PLAYBACK_STOP)
     {
-        return true;
+        PLAYBACK_DEBUG > 0 && console.log("PlaybackStop");
+        if (this.source_buffer)
+        {
+            document.getElementById(this.parent.screen_id).removeChild(this.audio);
+            window.URL.revokeObjectURL(this.audio.src);
+
+            delete this.source_buffer;
+            delete this.media_source;
+            delete this.audio;
+
+            this.append_okay = false;
+            this.queue = new Array();
+            this.start_time = 0;
+
+            return true;
+        }
     }
 
     if (msg.type == SPICE_MSG_PLAYBACK_VOLUME)
-- 
2.1.4



More information about the Spice-devel mailing list