xushiting пре 3 година
родитељ
комит
734e34ac79
1 измењених фајлова са 24 додато и 0 уклоњено
  1. 24 0
      笔记.txt

+ 24 - 0
笔记.txt

@@ -0,0 +1,24 @@
+ActionsHandler类中,函数sendData根据用户操作发送不同的数据到服务器
+服务器接受来自sendData的请求数据后,发送视频流(通过webrtc里的inputChannel.onmessage)
+
+前端主线程接受到数据后,开始执行
+this.workers.dataHandle(r.data)  ——> unmarshalStream函数里,通过this.decoderWorker.postMessage(z, [D.buffer])将视频数据传输到worker
+worker里,通过self.onmessage接受到来自主线程的请求并开始执行,然后通过self.postMessage发送请求并传输数据(怀疑将视频流解析成每一帧的yuv数据)到主线程
+
+主线程通过decoderWorker.onmessage来接受来自worker的数据并执行,主要是执行函数:ReceiveDecodeMessage
+ReceiveDecodeMessage函数里给cachedStreams赋值(每帧的yuv数据)
+
+UpdateYUV通过定时器定时运行,并读取cachedStreams的数据,如下:
+this.cachedStreams[e] != null && this.executeFunction("stream", {
+	stream: this.cachedStreams[e],
+	width: this.cachedResolution[e].width,
+	height: this.cachedResolution[e].height,
+	pts: this.cachedPtss[e]
+});
+			
+			
+stream函数因为提前注册过,一旦调用executeFunction,就会执行registerFunction("stream")
+registerFunction("stream")里会调用updateRawYUVData
+
+updateRawYUVData函数会将stream传送到材质贴图(_videoRawYUVTexArray里)上,显示最终的效果
+