diff --git a/Runtime/Scripts/Internal/TaskYieldInstruction.cs.meta b/Runtime/Scripts/Internal/TaskYieldInstruction.cs.meta new file mode 100644 index 00000000..b5448938 --- /dev/null +++ b/Runtime/Scripts/Internal/TaskYieldInstruction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2826c9df3de89432494d893a4ac353e4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/WebCameraSource.cs b/Runtime/Scripts/WebCameraSource.cs index efe2098a..b550f632 100644 --- a/Runtime/Scripts/WebCameraSource.cs +++ b/Runtime/Scripts/WebCameraSource.cs @@ -28,10 +28,12 @@ protected override VideoRotation GetVideoRotation() { switch (CamTexture.videoRotationAngle) { + case 0: return VideoRotation._0; case 90: return VideoRotation._90; - case 180: return VideoRotation._0; + case 180: return VideoRotation._180; + case 270: return VideoRotation._270; } - return VideoRotation._180; + return VideoRotation._0; } public WebCameraSource(WebCamTexture texture, VideoBufferType bufferType = VideoBufferType.Rgba) : base(VideoStreamSource.Texture, bufferType) @@ -81,8 +83,13 @@ protected override bool ReadBuffer() } CamTexture.GetPixels32(_readBuffer); - MemoryMarshal.Cast(_readBuffer) - .CopyTo(_captureBuffer.AsSpan()); + // GetPixels32 returns rows bottom-up; WebRTC expects top-down. Flip while copying. + var src = MemoryMarshal.Cast(_readBuffer); + var dst = _captureBuffer.AsSpan(); + int rowBytes = width * GetStrideForBuffer(_bufferType); + for (int y = 0; y < height; y++) + src.Slice(y * rowBytes, rowBytes) + .CopyTo(dst.Slice((height - 1 - y) * rowBytes, rowBytes)); _requestPending = true;