guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmuehl...@apache.org
Subject [5/7] incubator-guacamole-client git commit: GUAC-1511: Use constant buffer size.
Date Mon, 04 Apr 2016 20:34:13 GMT
GUAC-1511: Use constant buffer size.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/77cc8ef7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/77cc8ef7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/77cc8ef7

Branch: refs/heads/master
Commit: 77cc8ef72062d64a3afc0fe61a629a11951beda7
Parents: 6a4fab6
Author: Michael Jumper <mjumper@apache.org>
Authored: Sun Apr 3 15:04:01 2016 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Sun Apr 3 15:04:01 2016 -0700

----------------------------------------------------------------------
 .../src/main/webapp/modules/AudioRecorder.js    | 24 +++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/77cc8ef7/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js
----------------------------------------------------------------------
diff --git a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js
index 5b7b1ca..9e5fba6 100644
--- a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js
+++ b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js
@@ -115,6 +115,18 @@ Guacamole.AudioRecorder.getInstance = function getInstance(stream, mimetype)
{
 Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) {
 
     /**
+     * The size of audio buffer to request from the Web Audio API when
+     * recording or processing audio, in sample-frames. This must be a power of
+     * two between 256 and 16384 inclusive, as required by
+     * AudioContext.createScriptProcessor().
+     *
+     * @private
+     * @constant
+     * @type {Number}
+     */
+    var BUFFER_SIZE = 512;
+
+    /**
      * The format of audio this recorder will encode.
      *
      * @private
@@ -172,16 +184,6 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype)
{
     var maxSampleValue = (format.bytesPerSample === 1) ? 128 : 32768;
 
     /**
-     * The size of audio buffer to request from the Web Audio API when
-     * recording audio. This must be a power of two between 256 and 16384
-     * inclusive, as required by AudioContext.createScriptProcessor().
-     *
-     * @private
-     * @type {Number}
-     */
-    var bufferSize = format.bytesPerSample * 256;
-
-    /**
      * Converts the given AudioBuffer into an audio packet, ready for streaming
      * along the underlying output stream. Unlike the raw audio packets used by
      * this audio recorder, AudioBuffers require floating point samples and are
@@ -232,7 +234,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype)
{
         getUserMedia({ 'audio' : true }, function streamReceived(mediaStream) {
 
             // Create processing node which receives appropriately-sized audio buffers
-            var processor = context.createScriptProcessor(bufferSize, format.channels, format.channels);
+            var processor = context.createScriptProcessor(BUFFER_SIZE, format.channels, format.channels);
             processor.connect(context.destination);
 
             // Send blobs when audio buffers are received


Mime
View raw message