Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jv4-demuxer

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jv4-demuxer - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

package.json
{
"name": "jv4-demuxer",
"version": "1.0.4",
"version": "1.0.5",
"description": "",

@@ -5,0 +5,0 @@ "type": "module",

import { BaseDemuxer, DemuxEvent, DemuxMode } from "./base";
import { samplingFrequencyIndexMap } from "./util";

@@ -59,12 +60,14 @@ export interface FlvTag {

numberOfChannels: 1,
sampleRate: 44100,
sampleRate: 8000,
};
//TODO: parse audio config
if (this.audioEncoderConfig.codec == "aac") {
this.audioEncoderConfig.numberOfChannels = ((data[3] >> 3) & 0x0F) //声道
this.audioEncoderConfig.sampleRate = samplingFrequencyIndexMap[((data[2]&0x7)<<1)|(data[3]>>7)])
}
}
if (this.audioEncoderConfig.codec == "aac" && data[1] == 0x00) {
this.audioEncoderConfig.extraData = data.subarray(2);
this.emit(
DemuxEvent.AUDIO_ENCODER_CONFIG_CHANGED,
data.subarray(2)
this.audioEncoderConfig
);

@@ -71,0 +74,0 @@ if (this.mode == DemuxMode.PULL)

@@ -107,6 +107,7 @@ import { BaseDemuxer, DemuxEvent, DemuxMode } from "./base";

const audio = this.parsePESPacket(apes);
if (this.audioEncoderConfig?.codec == "aac" && this.audioEncoderConfig.numberOfChannels == 0) {
if (this.audioEncoderConfig?.codec == "aac" && !this.audioEncoderConfig?.extraData) {
const asc = adtsToAsc(audio.subarray(7));
this.audioEncoderConfig = {
codec: "aac",
extraData: asc.audioSpecificConfig,
sampleRate: asc.sampleRate,

@@ -117,3 +118,3 @@ numberOfChannels: asc.channel,

DemuxEvent.AUDIO_ENCODER_CONFIG_CHANGED,
asc.audioSpecificConfig
this.audioEncoderConfig
);

@@ -199,3 +200,3 @@ }

};
this.emit(DemuxEvent.VIDEO_ENCODER_CONFIG_CHANGED);
this.emit(DemuxEvent.VIDEO_ENCODER_CONFIG_CHANGED, this.videoEncoderConfig);
} else if (elementaryStreamID >= 0xc0 && elementaryStreamID <= 0xdf) {

@@ -207,6 +208,8 @@ this.audioStreamType = streamType;

"unknown",
numberOfChannels: 0,
sampleRate: 0,
numberOfChannels: 1,
sampleRate: 8000,
};
this.emit(DemuxEvent.AUDIO_ENCODER_CONFIG_CHANGED);
if (this.audioEncoderConfig.codec != "aac") {
this.emit(DemuxEvent.AUDIO_ENCODER_CONFIG_CHANGED);
}
}

@@ -213,0 +216,0 @@ if (l <= index + 1) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc