Skip to content

Commit

Permalink
Not needed...
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Jan 26, 2011
1 parent 67aa5d8 commit 08c601b
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions live-streaming.js
@@ -1,32 +1,14 @@
var fs = require('fs');
var spawn = require('child_process').spawn;

// Stdin is expecting raw PCM data of the format:
var SAMPLE_SIZE = 16; // 16-bit samples, Little-Endian, Signed
var CHANNELS = 2; // 2 channels (left and right)
var SAMPLE_RATE = 44100;// 44,100 Hz sample rate.

// If we're getting raw PCM data as expected, calculate the number of bytes
// that need to be read for `1 Second` of audio data.
var BLOCK_ALIGN = SAMPLE_SIZE / 8 * CHANNELS; // Number of 'Bytes per Sample'
var BYTES_PER_SECOND = SAMPLE_RATE * BLOCK_ALIGN;

// Each TS segment will be 10 seconds long
var SEGMENT_LENGTH = 10; // in seconds
var BYTES_PER_TEN_SECONDS = BYTES_PER_SECOND * SEGMENT_LENGTH;

var SegmenterOnNewSegment = /segmenter: ([^,]+), ([^,]+)/;

module.exports = function(config) {

var staticProvider = require('connect').staticProvider(config.mountPoint);
var currentSegment = 0;

var encoder = spawn(__dirname + "/convertAndSegment.sh", [
config.bitrate
], {
cwd: config.streamDir,
customFds: [-1, process.stdout.fd, process.stdout.fd ]
customFds: [-1, process.stdout.fd, 2/*process.stderr.fd*/]
});

config.pcmStream.on('data', function onData(chunk) {
Expand Down

0 comments on commit 08c601b

Please sign in to comment.