Comments (4)
@Julius-Caesar6
Can you give me a code snippet to replicate your issue?
from com.unity.webrtc.
Of course. In the VideoReceive sample in VideoReceiveSample.cs from line 81 ("video.OnVideoReceived += tex =>") instead of line 83: "receiveImage.texture =tex;", paste this code:
` // Original line where rawImage texture is set to tex.
// receiveImage.texture = tex;
Texture2D originalReceivedTexture = tex as Texture2D;
// Setting rawImage texture to the Texture2D also works and gives the correct live view.
// receiveImage.texture = originalReceivedTexture;
// Get pixels of texture into array of Colors.
Color[] texturePixels = originalReceivedTexture.GetPixels();
// Pixel manipulation ... (for example grayscaling)
// Apply pixels back to new texture
Texture2D processedTexture = new Texture2D(tex.width, tex.height);
processedTexture.SetPixels(texturePixels);
processedTexture.Apply();
// In this instance in play mode the rawImage only shows a gray image.
receiveImage.texture = processedTexture;`
So what happens is that by doing nothing to the pixels yet and just getting them from one texture and setting them to another, the live aspect is somehow lost. I don't necessarily need to set the pixels to a new texture (in this snippet it is just to illustrate), but need the live pixel values of "tex".
Thank you for your time and help!
from com.unity.webrtc.
@Julius-Caesar6
Hi, thanks for the detail, I replicated your issue.
originalReceivedTexture is updated asynchronously on GPU. CPU memory in texture is not updated, therefore GetPixels returns gray color buffer.
Can you try ReadPixels instead of GetPixels? ReadPixels can read CPU memory from rendertarget.
In addition, reading CPU memory is high cost generally, please check the performance.
from com.unity.webrtc.
@karasusan
Thank you for you reply!
I will try your recommendations and see if I can get it working.
from com.unity.webrtc.
Related Issues (20)
- [BUG]: Missing meta files for /Runtime/Plugins/iOS HOT 4
- [BUG]: Memory leak when receiving long-running video stream (iOS, Mac, Linux) HOT 3
- [BUG]: VideoStream onTrack doesn't work in the Android environment. HOT 1
- [REQUEST]: Can the receiving party extract float-type data containing the other party's voice data? HOT 1
- [REQUEST]: Manually set VideoStreamTrack label HOT 2
- [BUG]: Erratic ICE with multiple parallel PeerConnections HOT 1
- [REQUEST]: Add a public function to update the frame rendering under application control HOT 2
- [REQUEST]: WebRTC for VisionOS HOT 15
- [BUG]: No data sent on VideoStreamTracks on Pico after multiple cleanups HOT 1
- [BUG]: Segmentation Fault on Startup with High Resolution Display (Version 2021.3.20f1) HOT 1
- [BUG]: Freezing when RTCPeerConnection is closing HOT 2
- [BUG]: Encoder/Decoder priority HOT 2
- [BUG]: Wrong Candidate Pair Generation while establishing ICE Connection HOT 1
- [BUG]: E2ELantency calculation
- [BUG]: High Latency in Receiving Video Stream with H264 codec
- [BUG]: HOT 1
- [BUG]: Unable to connect streams between two devices with relay-only mode forced
- [BUG]: '__debug' file not found while building the plugin on MAC and xcode15 HOT 1
- WebGL branch [thaina/experimental/webgl-platform]
- [REQUEST]: Mipmap support for incoming video streams
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from com.unity.webrtc.