summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges-Etienne Legendre <legege@legege.com>2014-01-16 01:33:56 (GMT)
committerGeorges-Etienne Legendre <legege@legege.com>2014-01-16 01:33:56 (GMT)
commit2a0f2248215029c924353a201259642202a00155 (patch)
tree4191027849913398a00010ddca855784fc0df243
parent2cc66a4575e66bfa6b283e3bbed639c05c25f754 (diff)
Fixing an issue with some cameras
-rw-r--r--mjpeg-proxy.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/mjpeg-proxy.js b/mjpeg-proxy.js
index 0802497..bd4de7c 100644
--- a/mjpeg-proxy.js
+++ b/mjpeg-proxy.js
@@ -89,9 +89,10 @@ var MjpegProxy = exports.MjpegProxy = function(mjpegUrl) {
// First time we push data... lets start at a boundary
if (self.newAudienceResponses.indexOf(res) >= 0) {
var p = chunk.indexOf('--' + self.boundary); // indexOf provided by buffertools
- res.write(chunk.slice(p));
-
- self.newAudienceResponses.splice(self.newAudienceResponses.indexOf(res), 1); // remove from new
+ if (p >= 0) {
+ res.write(chunk.slice(p));
+ self.newAudienceResponses.splice(self.newAudienceResponses.indexOf(res), 1); // remove from new
+ }
} else {
res.write(chunk);
}