Skip to content

Commit

Permalink
Stop using .apply() to prevent call stack size range error, use lazy …
Browse files Browse the repository at this point in the history
…getter
  • Loading branch information
JackDallas committed Oct 10, 2019
1 parent 09797f5 commit 22f5ee4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/demux/tsdemuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import SampleAesDecrypter from './sample-aes';
// import Hex from '../utils/hex';
import { logger } from '../utils/logger';
import { ErrorTypes, ErrorDetails } from '../errors';
import { utf8ArrayToStr } from './id3';

// We are using fixed track IDs for driving the MP4 remuxer
// instead of following the TS PIDs.
Expand Down Expand Up @@ -710,8 +711,10 @@ class TSDemuxer {
pts: pes.pts,
payloadType: payloadType,
uuid: uuidStrArray.join(''),
userData: String.fromCharCode.apply(null, userDataPayloadBytes),
userDataBytes: userDataPayloadBytes
userDataBytes: userDataPayloadBytes,
get userData () {
return utf8ArrayToStr(new Uint16Array(this.userDataBytes).buffer);
}
});
}
} else if (payloadSize < expGolombDecoder.bytesAvailable) {
Expand Down

0 comments on commit 22f5ee4

Please sign in to comment.