UnityRenderStreaming icon indicating copy to clipboard operation
UnityRenderStreaming copied to clipboard

[BUG]: Webcam texture stream sent from macOS, iOS is extremely low resolution

Open Strowy opened this issue 3 years ago • 4 comments

Package version

3.1.0-exp.2

Environment

* OS: macOS, iOS
* Unity version: 2020.3.26
* Network: Local network connection

Steps To Reproduce

  1. Using Bidirectional sample scene, set up a server and connect using a key.
  2. Set up same Bidirectional scene on a macOS device, with settings of connecting to the above server and run renderstream on Awake
  3. Run scene, and enter in same key as in step 1.
  4. Click Start Video/Mic and immediately click Setup.

Current Behavior

Texture received by device in step 1 is of extremely low resolution if step 4 was done quickly enough. This only occurs on macOS and iOS (Windows, Linux, Android are not affected).

image

Expected Behavior

Expected behaviour is that the texture image should be of the expected resolution.

Anything else?

I've identified the issue as occurring when SignalingHandlerBase.CreateConnection() (via SingleConnection here) is called before WebCamStreamSender's StartVideo() coroutine completes, specifically before WebCamStreamSender.m_webCamTexture.didUpdateThisFrame == true.

Strowy avatar Mar 22 '22 06:03 Strowy

Could you try the latest version 3.1.0-exp.3?

karasusan avatar Mar 23 '22 02:03 karasusan

@karasusan I've updated the bug report after isolating the general cause of the bug; it was a setup rather than encoding issue.

I created a fix for the sample (and my project's implementation) by converting BidirectionalSample.SetUp() to call a coroutine to create the connection:

        private void SetUp()
        {
            setUpButton.interactable = false;
            hangUpButton.interactable = true;
            connectionIdInput.interactable = false;

            StartCoroutine(MediaSetupBufferedConnection())
        }

        private IEnumerator MediaSetupBufferedConnection()
        {
            yield return new WaitUntil(() => webCamStreamer.SendTexture != null
                                             && ((WebCamTexture)webCamStreamer.SendTexture).didUpdateThisFrame);
            yield return new WaitForSeconds(0.1f);
           singleConnection.CreateConnection(connectionId);
        }

I'll try upgrading and testing for its occurrence in 3.1.0-exp.3 when I have the time.

Strowy avatar Mar 23 '22 07:03 Strowy

@Strowy Thanks for sharing detail and the great suggestion! We will fix the issue for next milestone.

karasusan avatar Mar 29 '22 02:03 karasusan

memo: URS-430

karasusan avatar Mar 29 '22 02:03 karasusan