UnityRenderStreaming icon indicating copy to clipboard operation
UnityRenderStreaming copied to clipboard

[BUG] VideoStreamInput interferes with CaptureScreenshotIntoRenderTexture

Open burakkaraceylan opened this issue 2 years ago • 5 comments

I am trying to receive webcam input from the browser and send screen capture from unity. When using the bidirectional example the screen record of unity shows for a couple of seconds but when the webcam media is received from the web browser some corrupted video signal overlays on the screen. This doesn't happen with camera stream captures.

screen-capture (1)

burakkaraceylan avatar Dec 10 '21 12:12 burakkaraceylan

Could you tell me more information?

  • Platform (windows, macOS)
  • Browser
  • Browser version
  • Unity
  • Unity version
  • Encoder type

karasusan avatar Dec 11 '21 00:12 karasusan

Sure, sorry about that.

Platform: Windows 11 Browser: Google Chrome Browser Version: 96.0.4664.93 Unity version: 2020.3.21f Encoder type: software

Below is the function that takes the screenshot and sends it over the mediastream.

IEnumerator RecordFrame()
{
    yield return new WaitForEndOfFrame();
    ScreenCapture.CaptureScreenshotIntoRenderTexture(m_sendTexture);
}

burakkaraceylan avatar Dec 11 '21 07:12 burakkaraceylan

@burakkaraceylan Thanks your replay. We can't support Windows 11 yet, so the environment may be a problem. As a confirmation, do ours Bidirectional sample and Broadcast sample work in your environment?

kannan-xiao4 avatar Dec 14 '21 02:12 kannan-xiao4

Hello @kannan-xiao4

Those samples work fine and as I stated, using the webcamstreamsender also works fine in my project. The problem happens when I use the screenstreamsender from the unity and webcam stream from the browser. More specifically the image captured by ScreenCapture.CaptureScreenshotIntoRenderTexture gets broken.

Sometimes the remote webcam image appears overlayed on top of the screen capture, sometimes the image is completely distorted. Looks like some kind of buffer overflow happening.

Could you confirm that bidirectional example works if you use screenstreamsender please?

burakkaraceylan avatar Dec 14 '21 08:12 burakkaraceylan

@burakkaraceylan Thank you for the details. We will check behavior. memo:URS-382

kannan-xiao4 avatar Dec 21 '21 06:12 kannan-xiao4