|
@@ -336,7 +336,7 @@ if ("function" === typeof importScripts) {
|
|
|
if (this.isSlotEmpty(index)) {
|
|
|
//lost
|
|
|
// debugger
|
|
|
- // console.log("[xmedia] return on SLOT EMPTY, prev: %s", prev)
|
|
|
+ console.log("[xmedia] return on SLOT EMPTY, prev: %s", prevSeq)
|
|
|
this.consumerWaitingIDR = true;
|
|
|
this.consumerPrevPts = this.seqAdd(this.consumerPrevPts, 1, 65536);
|
|
|
return true;
|
|
@@ -345,7 +345,7 @@ if ("function" === typeof importScripts) {
|
|
|
if (!this.slotHasMedia(index)) {
|
|
|
// pure meta
|
|
|
// debugger
|
|
|
- // console.log("[xmedia] return on meta, prev: %s, cur: %s", this., mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] return on meta, prev: %s, cur: %s", mediaArray[index].pts)
|
|
|
this.consumerPrevPts = mediaArray[index].pts;
|
|
|
return true;
|
|
|
}
|
|
@@ -375,7 +375,7 @@ if ("function" === typeof importScripts) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // console.log("[xmedia] return finally, prev: %s, cur: %s", prev, cur)
|
|
|
+ console.log("[xmedia] return finally, prev: %s, cur: %s", this.prevSeq, this.consumerCurrPts);
|
|
|
this.consumerPrevPts = this.consumerCurrPts;
|
|
|
|
|
|
this.consumerWaitingIDR = false;
|
|
@@ -421,10 +421,10 @@ if ("function" === typeof importScripts) {
|
|
|
", needToSkip: " +
|
|
|
needToSkip;
|
|
|
|
|
|
- console.log("procBufItem", index, mediaArray[index]);
|
|
|
+ // console.log("procBufItem", index, mediaArray[index]);
|
|
|
|
|
|
if (this.slotHasContent(index) && !needToSkip) {
|
|
|
- // console.log("[xmedia] %s ------------ 001", mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] %s ------------ 001", mediaArray[index].pts)
|
|
|
let objData = {
|
|
|
media: mediaArray[index].media,
|
|
|
frameCnt: mediaArray[index].pts,
|
|
@@ -435,30 +435,30 @@ if ("function" === typeof importScripts) {
|
|
|
|
|
|
// -------------------
|
|
|
if (this.checkPktOrderInConsumer(index)) {
|
|
|
- // console.log("[xmedia] %s ------------ 002", mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] %s ------------ 002", mediaArray[index].pts)
|
|
|
this.decodeFrame(objData);
|
|
|
}
|
|
|
|
|
|
if (mediaArray[index].isIDR) {
|
|
|
- // console.log("[xmedia] %s ------------ 003", mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] %s ------------ 003", mediaArray[index].pts)
|
|
|
// console.log("mediaArray[index].isIDR: this.skipFrameUntilI = false")
|
|
|
this.skipFrameUntilI = false;
|
|
|
}
|
|
|
} else {
|
|
|
- // console.log("[xmedia] %s ------------ 004", mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] %s ------------ 004", mediaArray[index].pts)
|
|
|
if (this.slotHasMedia(index)) {
|
|
|
- // console.log("[xmedia] %s ------------ 005", mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] %s ------------ 005", mediaArray[index].pts)
|
|
|
//need to skip, waiting I Frame
|
|
|
//dropCache++
|
|
|
this.dropPkt += 1;
|
|
|
// MARKER META1META2
|
|
|
// self.postMessage({ t: MessageEvent.OnlyEmitSignal, meta_only: true, meta: mediaArray[index].meta, metadata: mediaArray[index].metadata })
|
|
|
} else {
|
|
|
- // console.log("[xmedia] %s ------------ 006", mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] %s ------------ 006", mediaArray[index].pts)
|
|
|
// no media
|
|
|
if (mediaArray[index].meta != null) {
|
|
|
this.checkPktOrderInConsumer(index);
|
|
|
- // console.log("[xmedia] %s ------------ 007", mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] %s ------------ 007", mediaArray[index].pts)
|
|
|
// Still frame
|
|
|
console.log("[send signal]", mediaArray[index].pts);
|
|
|
self.postMessage({
|
|
@@ -468,7 +468,7 @@ if ("function" === typeof importScripts) {
|
|
|
metadata: mediaArray[index].metadata,
|
|
|
});
|
|
|
} else {
|
|
|
- // console.log("[xmedia] %s ------------ 008", mediaArray[index].pts)
|
|
|
+ console.log("[xmedia] %s ------------ 008", mediaArray[index].pts)
|
|
|
// Lost_rcv++
|
|
|
// console.log("lost_rcv++: this.skipFrameUntilI = true")
|
|
|
// console.info('[xmedia] FFFFF This code should not be executed!!!!')
|
|
@@ -811,17 +811,17 @@ if ("function" === typeof importScripts) {
|
|
|
// console.log("[xmedia] 000-2 isIDR: %s, mediaLen: %s", isIDR, mediaLen)
|
|
|
// console.log("[xmedia] 000-3 this.isPFrame(isIDR, mediaLen): %s", this.isPFrame(isIDR, mediaLen))
|
|
|
if (this.isPFrame(isIDR, mediaLen)) {
|
|
|
- // console.log("[xmedia] 001: isPFrame TRUE")
|
|
|
+ console.log("[xmedia] 001: isPFrame TRUE")
|
|
|
this.packetsDrop += 1;
|
|
|
// MARKER META1META2
|
|
|
dropPkt = true;
|
|
|
}
|
|
|
if (this.isIFrame(isIDR, mediaLen)) {
|
|
|
- // console.log("[xmedia] 002: isIFrame TRUE")
|
|
|
+ console.log("[xmedia] 002: isIFrame TRUE")
|
|
|
this.isFirstFrame = false;
|
|
|
}
|
|
|
}
|
|
|
- // console.log("[xmedia] 003: dropPkt: %s", dropPkt)
|
|
|
+ console.log("[xmedia] 003: dropPkt: %s", dropPkt)
|
|
|
return dropPkt;
|
|
|
};
|
|
|
|
|
@@ -841,6 +841,7 @@ if ("function" === typeof importScripts) {
|
|
|
|
|
|
if (data.cached) {
|
|
|
media = IFrameCacheBuffer[JSON.stringify(data.position)][key];
|
|
|
+
|
|
|
} else if (data.cacheRequest) {
|
|
|
media = data.data.subarray(data.metaLen, data.metaLen + data.mediaLen);
|
|
|
self.decoder.cacheFrame(data);
|
|
@@ -857,6 +858,7 @@ if ("function" === typeof importScripts) {
|
|
|
if (this.isPFrame(data.isIDR, media.byteLength)) {
|
|
|
// MARKER META1META2
|
|
|
this.packetsDrop += 1;
|
|
|
+ console.log('fk1')
|
|
|
return;
|
|
|
}
|
|
|
this.prevSeq = this.seqDiff(pts, 1, 65536);
|
|
@@ -906,10 +908,10 @@ if ("function" === typeof importScripts) {
|
|
|
this.packetsLost -= 1;
|
|
|
// this.packetdisorder +=1
|
|
|
}
|
|
|
- // console.log("[xmedia] disorder frame received. preSeq: %s, pts: %s", this.prevSeq, pts)
|
|
|
+ console.log("[xmedia] disorder frame received. preSeq: %s, pts: %s", this.prevSeq, pts)
|
|
|
if (this.seqDiff(this.prevSeq, pts, 65536) < this.getNumOfPktToBeDec()) {
|
|
|
// slot for pts is not handled yet. just put it back:
|
|
|
- // console.log('put disorder frame to enc_queue, pkt:%s, prevPts: %s, numOfPktToBeDec: %s', pts, this.prevSeq, this.getNumOfPktToBeDec())
|
|
|
+ console.log('put disorder frame to enc_queue, pkt:%s, prevPts: %s, numOfPktToBeDec: %s', pts, this.prevSeq, this.getNumOfPktToBeDec())
|
|
|
} else {
|
|
|
//dropDisorder++
|
|
|
console.error(
|