Skip to content

Commit

Permalink
update description and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
oleh-poberezhets committed Dec 13, 2019
1 parent b3bed11 commit 1003078
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 20 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const {StreamsInfo} = require('video-quality-tools');

const streamsInfoOptions = {
ffprobePath: '/usr/local/bin/ffprobe',
timeoutInSec: 5
timeoutInMs: 2000
};
const streamsInfo = new StreamsInfo(streamsInfoOptions, 'rtmp://host:port/appInstance/name');
```
Expand Down Expand Up @@ -179,7 +179,7 @@ const {FramesMonitor} = require('video-quality-tools');

const framesMonitorOptions = {
ffprobePath: '/usr/local/bin/ffprobe',
timeoutInSec: 5,
timeoutInMa: 2000,
bufferMaxLengthInBytes: 100000,
errorLevel: 'error',
exitProcessGuardTimeoutInMs: 1000
Expand All @@ -197,7 +197,8 @@ Constructor throws:
The first argument of `FramesMonitor` must be an `options` object. All `options` object's fields are mandatory:

* `ffprobePath` - string, path to ffprobe executable;
* `timeoutInSec` - integer, greater than 0, specifies the waiting time of a live stream’s first frame;
* `timeoutInMs` - integer, greater than 0, specifies the maximum time to wait for (network) read/write operations
to complete;
* `bufferMaxLengthInBytes` - integer, greater than 0, specifies the buffer length for ffprobe frames. This setting
prevents from hanging and receiving incorrect data from the stream, usually 1-2 KB is enough;
* `errorLevel` - specifies log level for debugging purposes, must be equal to ffprobe's
Expand Down
2 changes: 1 addition & 1 deletion examples/realtimeStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const STREAM_URI = 'rtmp://host:port/path';

const framesMonitorOptions = {
ffprobePath: '/usr/local/bin/ffprobe',
timeoutInSec: 5,
timeoutInMs: 2000,
bufferMaxLengthInBytes: 100000,
errorLevel: 'error',
exitProcessGuardTimeoutInMs: 1000
Expand Down
10 changes: 5 additions & 5 deletions tests/Functional/FramesMonitor/listen.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('FramesMonitor::listen, fetch frames from inactive stream', () => {

framesMonitor = new FramesMonitor({
ffprobePath : process.env.FFPROBE,
timeoutInMs : 1,
timeoutInMs : 1,
bufferMaxLengthInBytes : bufferMaxLengthInBytes,
errorLevel : errorLevel,
exitProcessGuardTimeoutInMs: exitProcessGuardTimeoutInMs
Expand Down Expand Up @@ -82,7 +82,7 @@ describe('FramesMonitor::listen, fetch frames from active stream', () => {

framesMonitor = new FramesMonitor({
ffprobePath : process.env.FFPROBE,
timeoutInMs : 1,
timeoutInMs : 1,
bufferMaxLengthInBytes : bufferMaxLengthInBytes,
errorLevel : errorLevel,
exitProcessGuardTimeoutInMs: exitProcessGuardTimeoutInMs
Expand All @@ -101,7 +101,7 @@ describe('FramesMonitor::listen, fetch frames from active stream', () => {
spyOnAudioFrame.resetHistory();
});

it.only('must receive all stream frames', done => {
it('must receive all stream frames', done => {
const expectedReturnCode = 0;

const onFrame = {I: spyOnIFrame, P: spyOnPFrame};
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('FramesMonitor::listen, stop ffprobe process', () => {

framesMonitor = new FramesMonitor({
ffprobePath : process.env.FFPROBE,
timeoutInMs : 1,
timeoutInMs : 1,
bufferMaxLengthInBytes : bufferMaxLengthInBytes,
errorLevel : errorLevel,
exitProcessGuardTimeoutInMs: exitProcessGuardTimeoutInMs
Expand Down Expand Up @@ -188,7 +188,7 @@ describe('FramesMonitor::listen, exit with correct code after stream has been fi

framesMonitor = new FramesMonitor({
ffprobePath : process.env.FFPROBE,
timeoutInMs : 1,
timeoutInMs : 1,
bufferMaxLengthInBytes : bufferMaxLengthInBytes,
errorLevel : errorLevel,
exitProcessGuardTimeoutInMs: exitProcessGuardTimeoutInMs
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/StreamsInfo/fetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('StreamsInfo::fetch, fetch streams info from inactive stream', () => {
streamUrl = `http://localhost:${port}`;

streamsInfo = new StreamsInfo({
ffprobePath : process.env.FFPROBE,
ffprobePath: process.env.FFPROBE,
timeoutInMs: 1,
}, streamUrl);
});
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('StreamsInfo::fetch, fetch streams info from active stream', () => {
streamUrl = `http://localhost:${port}`;

streamsInfo = new StreamsInfo({
ffprobePath : process.env.FFPROBE,
ffprobePath: process.env.FFPROBE,
timeoutInMs: 1,
}, streamUrl);

Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/FramesMonitor/constructor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ describe('FramesMonitor::constructor', () => {
const expectedChunkRemainderDefaultValue = '';
const expectedStderrOutputs = [];
const expectedConfig = {
ffprobePath: config.ffprobePath,
bufferMaxLengthInBytes: config.bufferMaxLengthInBytes,
errorLevel: config.errorLevel,
ffprobePath : config.ffprobePath,
bufferMaxLengthInBytes : config.bufferMaxLengthInBytes,
errorLevel : config.errorLevel,
exitProcessGuardTimeoutInMs: config.exitProcessGuardTimeoutInMs,
timeout: config.timeoutInMs * 1000
timeout : config.timeoutInMs * 1000
};

const framesMonitor = new FramesMonitor(config, url);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/StreamsInfo/_adjustAspectRatio.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {invalidParams, validParams} = require('./_adjustAspectRatio.data');
describe('StreamsInfo::_adjustAspectRatio', () => {

const streamsInfo = new StreamsInfo({
ffprobePath : correctPath,
ffprobePath: correctPath,
timeoutInMs: 1
}, correctUrl);

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/StreamsInfo/_parseStreamsInfo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function typeOf(obj) {
describe('StreamsInfo::_parseStreamsInfo', () => {

const streamsInfo = new StreamsInfo({
ffprobePath : correctPath,
ffprobePath: correctPath,
timeoutInMs: 1
}, correctUrl);

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/StreamsInfo/constructor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('StreamsInfo::constructor', () => {
it('config.ffprobePath points to incorrect path', () => {
assert.throws(() => {
new StreamsInfo({
ffprobePath : `/incorrect/path/${correctUrl}`,
ffprobePath: `/incorrect/path/${correctUrl}`,
timeoutInMs: 1
}, correctUrl);
}, Errors.ExecutablePathError);
Expand All @@ -47,7 +47,7 @@ describe('StreamsInfo::constructor', () => {
it('all params are good', () => {
assert.doesNotThrow(() => {
new StreamsInfo({
ffprobePath : correctPath,
ffprobePath: correctPath,
timeoutInMs: 1
}, correctUrl);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/StreamsInfo/fetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function typeOf(obj) {
describe('StreamsInfo::fetch', () => {

let streamsInfo = new StreamsInfo({
ffprobePath : correctPath,
ffprobePath: correctPath,
timeoutInMs: 1
}, correctUrl);

Expand Down

0 comments on commit 1003078

Please sign in to comment.