ossrs / srs-unity

WebRTC Samples with SRS SFU server for Unity.
https://ossrs.io
MIT License
64 stars 9 forks source link

Unity import package error for CaptureStream arguments changed. #2

Closed nuoma closed 1 year ago

nuoma commented 1 year ago

After import:Assets\ossrs.io\Video Streaming and WebRTC Samples\Streamer\SrsStreamer.cs(96,64): error CS1503: Argument 4: cannot convert from 'int' to 'Unity.WebRTC.RenderTextureDepth'

Version:unity2021.3.6f1, webRTC v3.0.0-pre.2-December 09, 2022

winlinvip commented 1 year ago

I found this is the API change for Unity WebRTC.

In 2.0, https://docs.unity3d.com/Packages/com.unity.webrtc@2.0/api/Unity.WebRTC.CameraExtension.html public static MediaStream CaptureStream(this Camera cam, int width, int height, int bitrate, RenderTextureDepth depth = RenderTextureDepth.DEPTH_24)

In 2.4, https://docs.unity3d.com/Packages/com.unity.webrtc@2.4/api/Unity.WebRTC.CameraExtension.html public static MediaStream CaptureStream(this Camera cam, int width, int height, RenderTextureDepth depth = RenderTextureDepth.Depth24)

The third parameter bitrate is removed.

winlinvip commented 1 year ago

It's been removed by this PR https://github.com/Unity-Technologies/com.unity.webrtc/issues/498

So should use 2.4.0-exp.11 or higher version.

Please see https://github.com/ossrs/srs-unity#environments for details.

winlinvip commented 1 year ago

Fixed in v1.0.1