From 10c3b8988eeda6073f6415709c4fb909b6a444f1 Mon Sep 17 00:00:00 2001 From: Romain Beauxis Date: Wed, 1 Mar 2017 17:12:58 -0600 Subject: [PATCH] Reduce latency in passThrough. References #3 --- js/client.js | 2 +- src/models/track.coffee | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/js/client.js b/js/client.js index 0c0f8a0..e155e0a 100644 --- a/js/client.js +++ b/js/client.js @@ -296,7 +296,7 @@ Track.prototype.createPassThrough = function() { var source; - source = this.node.context.createScriptProcessor(8192, 2, 2); + source = this.node.context.createScriptProcessor(256, 2, 2); source.onaudioprocess = (function(_this) { return function(buf) { var channel, channelData, j, ref, results; diff --git a/src/models/track.coffee b/src/models/track.coffee index fae1108..562cc7a 100644 --- a/src/models/track.coffee +++ b/src/models/track.coffee @@ -60,7 +60,7 @@ class Webcaster.Model.Track extends Backbone.Model source createPassThrough: -> - source = @node.context.createScriptProcessor 8192, 2, 2 + source = @node.context.createScriptProcessor 256, 2, 2 source.onaudioprocess = (buf) => channelData = buf.inputBuffer.getChannelData channel @@ -91,6 +91,7 @@ class Webcaster.Model.Track extends Backbone.Model @passThrough.connect @node.context.destination @destination.connect @passThrough + togglePause: -> return unless @source?.pause?