Comparing version 0.0.16 to 0.0.17
@@ -6,3 +6,3 @@ "use strict"; | ||
function AudioProcessor(rtspServer) { | ||
this.rtspServer = rtspServer; | ||
@@ -19,3 +19,3 @@ this.state = 'buffering'; | ||
var swapBuf = new Buffer(audio.length); | ||
// endian hack | ||
@@ -32,3 +32,3 @@ for (var i = 0; i < audio.length; i += 2) { | ||
this.bufferQueue.enq({ buffer: swapBuf, sequenceNumber: sequenceNumber }); | ||
if (this.state == 'active') { | ||
@@ -35,0 +35,0 @@ while (this.bufferQueue.size() >= 4) { |
@@ -7,39 +7,2 @@ "use strict"; | ||
var statusMessages = { | ||
200: 'OK', | ||
401: 'Unauthorized', | ||
453: 'Not Enough Bandwidth' | ||
}; | ||
function MessageBuilder(socket) { | ||
this.buffer = ''; | ||
this.socket = socket; | ||
} | ||
MessageBuilder.prototype.addHeader = function(header, data) { | ||
this.buffer += header + ": " + data + "\r\n"; | ||
}; | ||
MessageBuilder.prototype.setStatus = function(statusCode, cseq) { | ||
this.buffer += "RTSP/1.0 " + statusCode + " " + statusMessages[statusCode] + '\r\n'; | ||
this.addHeader('Server', 'AirTunes/105.1'); | ||
this.addHeader('CSeq', cseq); | ||
}; | ||
MessageBuilder.prototype.setOK = function(cseq) { | ||
this.setStatus(200, cseq); | ||
}; | ||
MessageBuilder.prototype.send = function() { | ||
//console.log('SENDING DATA @ ' + socket.id.getTime()); | ||
//console.log('`--: ' + buffer.replace(/\r\n/g, '\r\n`--: ')); | ||
//console.log('END SEND\n') | ||
this.socket.write(this.buffer + '\r\n'); | ||
}; | ||
MessageBuilder.prototype.sendError = function(err) { | ||
//console.log('SENDING ERROR ' + err + ': ' + errorList[err]); | ||
this.socket.end("RTSP/1.0 " + err + ' ' + statusMessages[err] + '\r\n'); | ||
}; | ||
var parseSdp = function(msg) { | ||
@@ -133,3 +96,2 @@ var multi = [ 'a', 'p', 'b' ]; | ||
module.exports.parseSdp = parseSdp; | ||
module.exports.MessageBuilder = MessageBuilder; | ||
module.exports.parseDmap = parseDmap; | ||
@@ -136,0 +98,0 @@ module.exports.generateAppleResponse = generateAppleResponse; |
@@ -33,3 +33,3 @@ "use strict"; | ||
socket.id = new Date().getTime(); | ||
var parser = new Parser(socket, { | ||
@@ -48,3 +48,12 @@ protocol: 'RTSP/1.0', | ||
this.methodMapping[req.method](req, res); | ||
var method = this.methodMapping[req.method]; | ||
if (method) { | ||
method(req, res); | ||
} else { | ||
console.warn('Received unknown RTSP method:', req.method); | ||
res.send(400); | ||
socket.end(); | ||
} | ||
}.bind(this)); | ||
@@ -51,0 +60,0 @@ |
@@ -62,3 +62,3 @@ "use strict"; | ||
} else { | ||
res.sendError(401); | ||
res.send(401); | ||
} | ||
@@ -135,3 +135,3 @@ | ||
if (!initSeq || !initRtpTime) { | ||
res.sendError(400); | ||
res.send(400); | ||
} else { | ||
@@ -138,0 +138,0 @@ res.set('Audio-Latency', '100'); |
{ | ||
"name": "nodetunes", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"author": "Stephen Wan <stephen@stephenwan.net>", | ||
@@ -11,3 +11,3 @@ "description": "AirTunes v2 Music Server", | ||
} | ||
], | ||
], | ||
"engines": { | ||
@@ -14,0 +14,0 @@ "node": "0.10.x" |
@@ -5,8 +5,6 @@ NodeTunes | ||
nodetunes is an implementation of the Apple AirTunes v2 (audio AirPlay) protocol written in node.js. | ||
AirTunes v2 implementation in node.js | ||
``` | ||
npm install | ||
npm test | ||
npm install nodetunes | ||
``` | ||
@@ -19,2 +17,7 @@ | ||
##### 0.0.17 | ||
- Fixed bug where unknown request method (e.g. `GET`) would crash session | ||
- Removed legacy `MessageBuilder` responses | ||
- Fixed buggy response errors to use `httplike` errors | ||
##### 0.0.16 | ||
@@ -21,0 +24,0 @@ - Added support for fetching human-readable client name |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43
32787
732
8