diff options
author | Oliver Gutierrez <ogutierrez@redhat.com> | 2016-07-28 10:50:05 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2016-08-03 12:29:51 +0200 |
commit | 667f16c2a4d7acf0f0b4e3f5765662fdca8fdbdc (patch) | |
tree | 2fd141b750423e42493d3450c527a1a421fe4403 | |
parent | a8c406377e0a141aecbaa2069938c272c21785c4 (diff) |
playback: Don't try to access undefined source buffer
The playback code first tries to access this.source_buffer and then
would check whether it's defined.
This was causing unwanted exception to be thrown in the cockpit
spice-html5 plugin.
-rw-r--r-- | playback.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/playback.js b/playback.js index ea5017f..53b6983 100644 --- a/playback.js +++ b/playback.js @@ -100,6 +100,9 @@ SpicePlaybackConn.prototype.process_channel_message = function(msg) data.time = this.last_data_time + 1; } + if (! this.source_buffer) + return true; + /* Gap detection: If there has been a delay since our last packet, then audio must have paused. Handling that gets tricky. In Chrome, you can seek forward, but you cannot in Firefox. And seeking forward in Chrome is nice, as it keeps @@ -120,9 +123,6 @@ SpicePlaybackConn.prototype.process_channel_message = function(msg) PLAYBACK_DEBUG > 1 && console.log("PlaybackData; time " + data.time + "; length " + data.data.byteLength); - if (! this.source_buffer) - return true; - if (this.start_time == 0) this.start_playback(data); |