|
@@ -159,7 +159,7 @@ if ("function" === typeof importScripts) {
|
|
|
};
|
|
|
|
|
|
Decoder.prototype.isSeqJump = function (a, b) {
|
|
|
- console.log("[xmedia] isSeqJump,a:%s, b:%s",a,b);
|
|
|
+ //console.log("[xmedia] isSeqJump,a:%s, b:%s",a,b);
|
|
|
return this.distance(a, b) >= CACHE_BUF_LENGTH - 1;
|
|
|
};
|
|
|
|
|
@@ -228,7 +228,7 @@ if ("function" === typeof importScripts) {
|
|
|
this.cntBufInc = 0;
|
|
|
this.prevBufNum = 0;
|
|
|
this.MAX_TRY_TO_DEC_BUFNUM = 3;
|
|
|
- console.log("[xmedia] resetDecoder");
|
|
|
+ //console.log("[xmedia] resetDecoder");
|
|
|
this.skipFrameUntilI = true;
|
|
|
|
|
|
this.consumerPrevPts = -1;
|
|
@@ -251,7 +251,8 @@ if ("function" === typeof importScripts) {
|
|
|
|
|
|
Decoder.prototype.dumpLogBuf = function () {
|
|
|
while (logBufQueue.length > 0) {
|
|
|
- console.log(logBufQueue.shift());
|
|
|
+ //console.log(logBufQueue.shift());
|
|
|
+ logBufQueue.shift();
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -302,7 +303,7 @@ if ("function" === typeof importScripts) {
|
|
|
}
|
|
|
|
|
|
if (this.enable_logging) {
|
|
|
- console.log(logInfo);
|
|
|
+ //console.log(logInfo);
|
|
|
} else {
|
|
|
logBufQueue.push(logInfo);
|
|
|
if (logBufQueue.length > MAX_LOG_NUM) {
|
|
@@ -340,7 +341,7 @@ if ("function" === typeof importScripts) {
|
|
|
if (this.isSlotEmpty(index)) {
|
|
|
//lost
|
|
|
// debugger
|
|
|
- console.log("[xmedia] return on SLOT EMPTY, prev: %s", prevSeq);
|
|
|
+ //console.log("[xmedia] return on SLOT EMPTY, prev: %s", prevSeq);
|
|
|
this.consumerWaitingIDR = true;
|
|
|
this.consumerPrevPts = this.seqAdd(this.consumerPrevPts, 1, 65536);
|
|
|
return true;
|
|
@@ -382,12 +383,12 @@ if ("function" === typeof importScripts) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- console.log(
|
|
|
- "[xmedia] return finally, prev: %s, cur: %s",
|
|
|
- this.prevSeq,
|
|
|
- this.consumerCurrPts,
|
|
|
- Date.now() - testLastestTime
|
|
|
- );
|
|
|
+ // console.log(
|
|
|
+ // "[xmedia] return finally, prev: %s, cur: %s",
|
|
|
+ // this.prevSeq,
|
|
|
+ // this.consumerCurrPts,
|
|
|
+ // Date.now() - testLastestTime
|
|
|
+ // );
|
|
|
|
|
|
testLastestTime = String(Date.now()).slice();
|
|
|
this.consumerPrevPts = this.consumerCurrPts;
|
|
@@ -403,11 +404,11 @@ if ("function" === typeof importScripts) {
|
|
|
};
|
|
|
|
|
|
Decoder.prototype.slotHasContent = function (index) {
|
|
|
- console.log("[xmedia] slotHasContent ------------ 000, media: %s, meta: %s, pts: %s",
|
|
|
- (mediaArray[index].media == null),
|
|
|
- (mediaArray[index].meta == null),
|
|
|
- mediaArray[index].pts
|
|
|
- );
|
|
|
+ // console.log("[xmedia] slotHasContent ------------ 000, media: %s, meta: %s, pts: %s",
|
|
|
+ // (mediaArray[index].media == null),
|
|
|
+ // (mediaArray[index].meta == null),
|
|
|
+ // mediaArray[index].pts
|
|
|
+ // );
|
|
|
return (
|
|
|
mediaArray[index].media != null &&
|
|
|
mediaArray[index].meta != null &&
|
|
@@ -417,16 +418,25 @@ if ("function" === typeof importScripts) {
|
|
|
|
|
|
Decoder.prototype.procBufItem = function (index) {
|
|
|
this.dumpJitterBufInfo("Entering Decoder.prototype.procBufItem");
|
|
|
+ self.postMessage({
|
|
|
+ t: 11,
|
|
|
+ pts: mediaArray[index].pts,
|
|
|
+ isIDR: mediaArray[index].isIDR,
|
|
|
+ mediaLength: mediaArray[index].media.length,
|
|
|
+ traceIds:mediaArray[index].metadata.traceIds,
|
|
|
+ cameraPosition:JSON.stringify(mediaArray[index].metadata.newUserStates[0].playerState.camera.position),
|
|
|
+ time:new Date().getTime()
|
|
|
+ })
|
|
|
// console.log("[][Core][WASM], pts: %s, isIDR: %s, length: %s",
|
|
|
// mediaArray[index].pts,
|
|
|
// mediaArray[index].isIDR,
|
|
|
// mediaArray[index].media.length
|
|
|
// );
|
|
|
- console.log("metaverse----core, pts: %s, isIDR: %s, length: %s",
|
|
|
- mediaArray[index].pts,
|
|
|
- mediaArray[index].isIDR,
|
|
|
- mediaArray[index].media.length,
|
|
|
- );
|
|
|
+ // console.log("metaverse----core, pts: %s, isIDR: %s, length: %s",
|
|
|
+ // mediaArray[index].pts,
|
|
|
+ // mediaArray[index].isIDR,
|
|
|
+ // mediaArray[index].media.length,
|
|
|
+ // );
|
|
|
// var loginfo = 'pts: %s, isIDR: %s, length: %s', mediaArray[index].pts, mediaArray[index].isIDR, mediaArray[index].media.length
|
|
|
//I帧返回false,P帧返回true
|
|
|
needToSkip = this.skipFrameUntilI && !mediaArray[index].isIDR;
|
|
@@ -447,9 +457,9 @@ if ("function" === typeof importScripts) {
|
|
|
// console.log("[xmedia] %s ------------ 000", JSON.stringify(mediaArray[index].metadata));
|
|
|
// 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);
|
|
|
if(mediaArray[index].metadata.mediaSrc){
|
|
|
- console.log("角度:"+ mediaArray[index].metadata.newUserStates[0].playerState.camera.angle.yaw);
|
|
|
+ //console.log("角度:"+ mediaArray[index].metadata.newUserStates[0].playerState.camera.angle.yaw);
|
|
|
}
|
|
|
|
|
|
let objData = {
|
|
@@ -462,20 +472,20 @@ 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);
|
|
|
this.slotHasMedia(index)
|
|
|
- console.log("[xmedia] %s ------------ 005", mediaArray[index].pts);
|
|
|
+ //console.log("[xmedia] %s ------------ 005", mediaArray[index].pts);
|
|
|
this.dropPkt += 1;
|
|
|
}
|
|
|
/*
|
|
@@ -518,7 +528,7 @@ if ("function" === typeof importScripts) {
|
|
|
}
|
|
|
}
|
|
|
*/
|
|
|
- console.log('procBufItem');
|
|
|
+ //console.log('procBufItem');
|
|
|
this.dumpJitterBufInfo("Leaving Decoder.prototype.procBufItem, " + loginfo);
|
|
|
this.lastObj = mediaArray[index];
|
|
|
this.resetBufItem(index);
|
|
@@ -607,7 +617,7 @@ if ("function" === typeof importScripts) {
|
|
|
this.procBufItem(this.readPtr);
|
|
|
} catch (error) {
|
|
|
//console.log("[xmedia] 掉帧", error);
|
|
|
- console.log("Work-IT2 掉帧2")
|
|
|
+ //console.log("Work-IT2 掉帧2")
|
|
|
}
|
|
|
|
|
|
// if (this.getNumOfPktToBeDec() > this.prevBufNum) {
|
|
@@ -825,36 +835,36 @@ if ("function" === typeof importScripts) {
|
|
|
Decoder.prototype.isIFrame = function (isIDR, mediaLen) {
|
|
|
// return data.isIDR && media.byteLength !=0
|
|
|
let flag = isIDR && mediaLen != 0;
|
|
|
- if(flag){
|
|
|
- console.log('metaverse---------��IFrame');
|
|
|
- }
|
|
|
- else{
|
|
|
- console.log('metaverse---------����IFrame');
|
|
|
- }
|
|
|
+ // if(flag){
|
|
|
+ // console.log('metaverse---------��IFrame');
|
|
|
+ // }
|
|
|
+ // else{
|
|
|
+ // console.log('metaverse---------����IFrame');
|
|
|
+ // }
|
|
|
return flag;
|
|
|
};
|
|
|
|
|
|
Decoder.prototype.isPFrame = function (isIDR, mediaLen) {
|
|
|
// return !data.isIDR && media.byteLength !=0
|
|
|
let flag = !isIDR && mediaLen != 0;
|
|
|
- if(flag){
|
|
|
- console.log('metaverse---------��PFrame');
|
|
|
- }
|
|
|
- else{
|
|
|
- console.log('metaverse---------����PFrame');
|
|
|
- }
|
|
|
+ // if(flag){
|
|
|
+ // console.log('metaverse---------��PFrame');
|
|
|
+ // }
|
|
|
+ // else{
|
|
|
+ // console.log('metaverse---------����PFrame');
|
|
|
+ // }
|
|
|
return flag;
|
|
|
};
|
|
|
|
|
|
Decoder.prototype.isPureMeta = function (metaLen, mediaLen) {
|
|
|
// return media.byteLength == 0 && meta.byteLength !=0
|
|
|
let flag = mediaLen == 0 && metaLen != 0;
|
|
|
- if(flag){
|
|
|
- console.log('metaverse---------��PureMeta');
|
|
|
- }
|
|
|
- else{
|
|
|
- console.log('metaverse---------����PureMeta');
|
|
|
- }
|
|
|
+ // if(flag){
|
|
|
+ // console.log('metaverse---------��PureMeta');
|
|
|
+ // }
|
|
|
+ // else{
|
|
|
+ // console.log('metaverse---------����PureMeta');
|
|
|
+ // }
|
|
|
return flag;
|
|
|
};
|
|
|
|
|
@@ -879,17 +889,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;
|
|
|
};
|
|
|
|
|
@@ -925,7 +935,7 @@ if ("function" === typeof importScripts) {
|
|
|
if (this.isPFrame(data.isIDR, media.byteLength)) {
|
|
|
// MARKER META1META2
|
|
|
this.packetsDrop += 1;
|
|
|
- console.log("fk1");
|
|
|
+ //console.log("fk1");
|
|
|
return;
|
|
|
}
|
|
|
this.prevSeq = this.seqDiff(pts, 1, 65536);
|
|
@@ -982,19 +992,19 @@ 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(
|
|
@@ -1089,7 +1099,7 @@ if ("function" === typeof importScripts) {
|
|
|
|
|
|
if (cachedFirstFrame != undefined) {
|
|
|
self.postMessage(cachedFirstFrame, [cachedFirstFrame.data.buffer]);
|
|
|
- console.log("cachedFirstFrame", cachedFirstFrame);
|
|
|
+ //console.log("cachedFirstFrame", cachedFirstFrame);
|
|
|
send_out_buffer += 1;
|
|
|
this.receivedEmit++;
|
|
|
cachedFirstFrame = undefined;
|
|
@@ -1296,7 +1306,7 @@ if ("function" === typeof importScripts) {
|
|
|
// }
|
|
|
// }
|
|
|
} catch (e) {
|
|
|
- console.log("catch error ", e);
|
|
|
+ //console.log("catch error ", e);
|
|
|
if (this.errorCacheSize > 0) {
|
|
|
downloadBlob(
|
|
|
this.errorCacheBuffer.subarray(0, this.errorCacheSize),
|
|
@@ -1320,7 +1330,7 @@ if ("function" === typeof importScripts) {
|
|
|
var poc = Module.getValue(resultBuffer + 32, "i32");
|
|
|
var pts = data.frameCnt;
|
|
|
|
|
|
- console.log("ret", ret);
|
|
|
+ //console.log("ret", ret);
|
|
|
|
|
|
if (ret != 0) {
|
|
|
printConsole.log(
|
|
@@ -1428,7 +1438,7 @@ if ("function" === typeof importScripts) {
|
|
|
cachedFirstFrame = objData;
|
|
|
}
|
|
|
}
|
|
|
- console.log("this.startEmit", this.startEmit);
|
|
|
+ //console.log("this.startEmit", this.startEmit);
|
|
|
|
|
|
// if (cacheBuffer != null) {
|
|
|
// Module._free(cacheBuffer)
|
|
@@ -1445,7 +1455,7 @@ if ("function" === typeof importScripts) {
|
|
|
Decoder.prototype.receiveBuffer = function (data) {
|
|
|
framesReturned++;
|
|
|
send_out_buffer -= 1;
|
|
|
- console.log("receiveBuffer", data);
|
|
|
+ //console.log("receiveBuffer", data);
|
|
|
YUVArray.push({ status: 0, buffer: data.buffer });
|
|
|
};
|
|
|
|
|
@@ -1477,7 +1487,7 @@ if ("function" === typeof importScripts) {
|
|
|
try {
|
|
|
self.importScripts(url);
|
|
|
} catch (e) {
|
|
|
- console.log("catch error ", e);
|
|
|
+ //console.log("catch error ", e);
|
|
|
printConsole.error(e.message, "5003");
|
|
|
}
|
|
|
};
|