File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ NodeOpusEncoder::NodeOpusEncoder(const CallbackInfo& args): ObjectWrap<NodeOpusE
6666 }
6767
6868 this ->application = OPUS_APPLICATION_AUDIO;
69- this ->outPcm = new opus_int16[channels * MAX_FRAME_SIZE];
69+ this ->outPcm = new opus_int16[this -> channels * MAX_FRAME_SIZE];
7070}
7171
7272NodeOpusEncoder::~NodeOpusEncoder () {
Original file line number Diff line number Diff line change @@ -14,12 +14,21 @@ const { OpusEncoder } = require('../lib/index.js');
1414 const reEncoded = opus . encode ( decoded ) ;
1515
1616 assert ( decoded . length === 640 , 'Decoded frame length is not 640' ) ;
17- assert ( reEncoded . length === 45 , 're encoded frame length is not 45' ) ;
17+ assert ( reEncoded . length === 45 , 're- encoded frame length is not 45' ) ;
1818}
1919
2020// Default values work
2121{
2222 new OpusEncoder ( ) ;
23+ new OpusEncoder ( undefined , undefined ) ;
24+ }
25+
26+ // Invalid values throw
27+ {
28+ assert . throws ( ( ) => new OpusEncoder ( "16000" , 1 ) , / E x p e c t e d r a t e t o b e a n u m b e r / ) ;
29+ assert . throws ( ( ) => new OpusEncoder ( null , "1" ) , / E x p e c t e d r a t e t o b e a n u m b e r / ) ;
30+ assert . throws ( ( ) => new OpusEncoder ( 16000 , "1" ) , / E x p e c t e d c h a n n e l s t o b e a n u m b e r / ) ;
31+ assert . throws ( ( ) => new OpusEncoder ( 16000 , null ) , / E x p e c t e d c h a n n e l s t o b e a n u m b e r / ) ;
2332}
2433
2534console . log ( 'Passed' ) ;
You can’t perform that action at this time.
0 commit comments