Showing 50 of 79 total issues
Function _createTrack
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
_createTrack(trakAtom) {
let mdiaAtom = trakAtom.getAtom(Utils.ATOM_MDIA);
if (mdiaAtom === null) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function build
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
build() {
// Tracks and Samples
let tracks = [this.movie.videoTrack(), this.movie.audioTrack()]
.filter(track => track !== null && track.samples.length > 0);
let samples = tracks.reduce((array, track) => array.concat(track.samples), [])
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function build
has 176 lines of code (exceeds 25 allowed). Consider refactoring. Open
build() {
// Tracks and Samples
let tracks = [this.movie.videoTrack(), this.movie.audioTrack()]
.filter(track => track !== null && track.samples.length > 0);
let samples = tracks.reduce((array, track) => array.concat(track.samples), [])
Function _packPayload
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
_packPayload(payload, sample, pid, dtsTime) {
// Number of packets
let numPackets = Math.ceil(payload.length / (PACKET_SIZE - 4));
if (sample instanceof VideoSample && numPackets * (PACKET_SIZE - 4) - 8 < payload.length) {
// Take into account adaptation field
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _createTrack
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createTrack(trakAtom) {
let mdiaAtom = trakAtom.getAtom(Utils.ATOM_MDIA);
if (mdiaAtom === null) {
return;
}
Function index
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
static index(fragmentList, fd) {
// Calc buffer size and offsets
let bufferSize = Utils.HEADER_SIZE;
if (fragmentList.video) {
bufferSize += fragmentList.video.extraData.length + Utils.HEADER_VIDEO_SIZE;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File packetizer-impl.js
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
const crc32 = require('./crc32');
const SampleCounter = require('./sample-counter');
Function index
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
static index(fragmentList, fd) {
// Calc buffer size and offsets
let bufferSize = Utils.HEADER_SIZE;
if (fragmentList.video) {
bufferSize += fragmentList.video.extraData.length + Utils.HEADER_VIDEO_SIZE;
Function _buildHeader
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
_buildHeader() {
let buffer = Buffer.allocUnsafe(2 * PACKET_SIZE);
let pos = 0;
// Write PAT packet
Function constructor
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(fd) {
super();
this.fd = fd;
Function _packPayload
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
_packPayload(payload, sample, pid, dtsTime) {
// Number of packets
let numPackets = Math.ceil(payload.length / (PACKET_SIZE - 4));
if (sample instanceof VideoSample && numPackets * (PACKET_SIZE - 4) - 8 < payload.length) {
// Take into account adaptation field
Function build
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
static build(movie, fragmentDuration) {
let fragmentList = new FragmentList();
fragmentList.fragmentDuration = fragmentDuration;
fragmentList.duration = movie.duration * FRAGMENT_TIMESCALE / movie.timescale;
fragmentList.timescale = FRAGMENT_TIMESCALE;
Function packFragment
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
packFragment() {
let buffers = [];
let buffersLength = 0;
let packetTimescale = 90 * this.fragment.timescale;
Function packFragment
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
packFragment() {
let buffers = [];
let buffersLength = 0;
let packetTimescale = 90 * this.fragment.timescale;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _readByType
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
_readByType(type) {
switch (type) {
case TYPE_NUMBER: {
return this._readDouble();
}
Function readSamples
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
static readSamples(fragment, source) {
// Collect entries
let entries = fragment.samples.map((sample, i) => {
return {
index: i,
Function get
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
get(index) {
if (index >= this._fragmentsCount) {
return;
}
let bufFragment = Buffer.allocUnsafe(Utils.FRAGMENT_SIZE);
Function parse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
parse(buffer) {
let offset = 5;
// ES_Length
let esSize = readSize(buffer, offset);
Function parse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
parse(buffer) {
let offset = 8;
let version = buffer.readUInt16BE(offset);
offset += 8;
this.channels = buffer.readUInt16BE(offset);
Function _findMoovAtom
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_findMoovAtom() {
this.moovAtom = null;
let pos = 0;
let size = this.reader.size();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"