Browse Source

添加日志

xushiting 3 years ago
parent
commit
92568a4d8f
4 changed files with 50 additions and 32 deletions
  1. 8 0
      src/Rtcp.js
  2. 1 1
      src/Socket.js
  3. 25 20
      src/Workers.js
  4. 16 11
      src/v2Decoder/index.js

+ 8 - 0
src/Rtcp.js

@@ -207,6 +207,14 @@ export default class Rtcp extends EventEmitter {
         let t = "";
         let t = "";
         try {
         try {
             t = JSON.stringify(e)
             t = JSON.stringify(e)
+            if(e.action_type != 1009 && e.action_type != 1024){
+                if(e.action_type == 15){
+                    console.log('发送:action_type:'+e.action_type+',trace_id:'+e.trace_id+',joystick_action'+JSON.stringify(e.dir_action)+',playPosition:'+JSON.stringify(window.room.avatars[0].xAvatar.position)+',时间:'+new Date().getTime());
+                }
+                else{
+                    console.log('发送:action_type:'+e.action_type+',trace_id:'+e.trace_id+',playPosition:'+JSON.stringify(window.room.avatars[0].xAvatar.position)+',时间:'+new Date().getTime());
+                }
+            }
         } catch (r) {
         } catch (r) {
             logger.error(r);
             logger.error(r);
             return
             return

+ 1 - 1
src/Socket.js

@@ -207,7 +207,7 @@ export default class Socket extends EventEmitter {
         if (!r) return;
         if (!r) return;
         const n = r.id;
         const n = r.id;
 
 
-        if(n == "heartbeat") console.log("Socket心跳请求时间(ms):", Date.now() - parseInt(r.data))
+        //if(n == "heartbeat") console.log("Socket心跳请求时间(ms):", Date.now() - parseInt(r.data))
 
 
         if (!!n)
         if (!!n)
           switch (
           switch (

+ 25 - 20
src/Workers.js

@@ -781,11 +781,16 @@ export default class Workers {
             break;
             break;
           }
           }
           case 11:{
           case 11:{
-            console.log("Workers:pts: %s, isIDR: %s, length: %s",
+            //if( s.data.mediaLength != 0){
+              console.log("Workers:pts: %s, isIDR: %s, length: %s, traceIds: %s,playPosition:%s, time: %s",
               s.data.pts,
               s.data.pts,
               s.data.isIDR,
               s.data.isIDR,
-              s.data.metadataLength,
+              s.data.mediaLength,
+              s.data.traceIds,
+              s.data.playPosition,
+              new Date().getTime()
             );
             );
+            //}
             break;
             break;
           }
           }
           default:
           default:
@@ -1057,24 +1062,24 @@ export default class Workers {
 
 
     // console.log("zh----", fCnt, b);
     // console.log("zh----", fCnt, b);
     if (b !== 255) {
     if (b !== 255) {
-      console.log("gemer1", {
-        byteLength: e.byteLength,
-        frame: fCnt,
-        mediaLen: $,
-        metaLen: j,
-        b: b,
-        cachedKey: rt,
-        serverTime: _e,
-        it: it,
-        start: c,
-        ot: ot,
-        nt: nt,
-        total: nt,
-        tt: tt,
-        et: et,
-        isPureMeta: ot === nt,
-        at: at,
-      });
+      // console.log("gemer1", {
+      //   byteLength: e.byteLength,
+      //   frame: fCnt,
+      //   mediaLen: $,
+      //   metaLen: j,
+      //   b: b,
+      //   cachedKey: rt,
+      //   serverTime: _e,
+      //   it: it,
+      //   start: c,
+      //   ot: ot,
+      //   nt: nt,
+      //   total: nt,
+      //   tt: tt,
+      //   et: et,
+      //   isPureMeta: ot === nt,
+      //   at: at,
+      // });
     }
     }
     let copyIDR = b;
     let copyIDR = b;
     //console.log("metaverse----IDR:" + copyIDR);
     //console.log("metaverse----IDR:" + copyIDR);

+ 16 - 11
src/v2Decoder/index.js

@@ -415,18 +415,23 @@ if ("function" === typeof importScripts) {
     //   mediaArray[index].isIDR,
     //   mediaArray[index].isIDR,
     //   mediaArray[index].media.length
     //   mediaArray[index].media.length
     // );
     // );
-    console.log("pts: %s, isIDR: %s, length: %s",
-      mediaArray[index].pts,
-      mediaArray[index].isIDR,
-      mediaArray[index].media.length,
-    );
+    // console.log("pts: %s, isIDR: %s, length: %s",
+    //   mediaArray[index].pts,
+    //   mediaArray[index].isIDR,
+    //   mediaArray[index].media.length,
+    // );
+    //if(mediaArray[index].media.length){
+      self.postMessage({
+        t: 11,
+        pts: mediaArray[index].pts,
+        isIDR: mediaArray[index].isIDR,
+        mediaLength: mediaArray[index].media.length,
+        traceIds:mediaArray[index].metadata.traceIds,
+        playPosition:JSON.stringify(mediaArray[index].metadata.newUserStates[0].playerState.player.position),
+        time:new Date().getTime()
+      })
+    //}
 
 
-    self.postMessage({
-      t: 11,
-      pts: mediaArray[index].pts,
-      isIDR: mediaArray[index].isIDR,
-      metadataLength: mediaArray[index].media.length,
-    });
 
 
     // var loginfo = '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