public void GraphicsFormat() { var graphicsFormat = WebRTC.GetSupportedGraphicsFormat(SystemInfo.graphicsDeviceType); var renderTextureFormat = WebRTC.GetSupportedRenderTextureFormat(SystemInfo.graphicsDeviceType); var textureFormat = WebRTC.GetSupportedTextureFormat(SystemInfo.graphicsDeviceType); var rt = new RenderTexture(10, 10, 0, renderTextureFormat); rt.Create(); Assert.That(rt.graphicsFormat, Is.EqualTo(graphicsFormat)); var tx = new Texture2D(10, 10, textureFormat, false); Assert.That(tx.graphicsFormat, Is.EqualTo(graphicsFormat)); Object.DestroyImmediate(rt); Object.DestroyImmediate(tx); }
private void OnStart() { startButton.interactable = false; callButton.interactable = true; dropDownResolution.interactable = false; dropDownFramerate.interactable = false; if (sendStream == null) { Vector2Int resolution = listResolution[dropDownResolution.value]; int width = resolution.x; int height = resolution.y; var format = WebRTC.GetSupportedGraphicsFormat(SystemInfo.graphicsDeviceType); var tex = new RenderTexture(width, height, 0, format); tex.Create(); destTexture = new RenderTexture(width, height, 0, format); destTexture.Create(); sourceImage.texture = tex; sourceImage.color = Color.white; sendStream = new MediaStream(); sendStream.AddTrack(new VideoStreamTrack(destTexture)); } if (receiveStream == null) { receiveStream = new MediaStream(); receiveStream.OnAddTrack = e => { if (e.Track is VideoStreamTrack track) { track.OnVideoReceived += tex => { receiveImage.texture = tex; receiveImage.color = Color.white; videoUpdateStarted = true; }; } }; } }
public void ValidateGraphicsFormat() { var format = WebRTC.GetSupportedGraphicsFormat(SystemInfo.graphicsDeviceType); Assert.That(() => WebRTC.ValidateGraphicsFormat(format), Throws.Nothing); }