rust-sdks icon indicating copy to clipboard operation
rust-sdks copied to clipboard

Set is_screencast on NativeVideoSource creation

Open iparaskev opened this issue 11 months ago • 3 comments

Makes InternalSource's is_screencast configurable when creating a NativeVideoSource. This improves the stream's latency when vp9 is used for sharing screen content.

iparaskev avatar Jan 19 '25 19:01 iparaskev

it seems like you haven't added any nanpa changeset files to this PR.

if this pull request includes changes to code, make sure to add a changeset, by writing a file to .nanpa/<unique-name>.kdl:

minor type="added" "Introduce frobnication algorithm"

refer to the manpage for more information.

ilo-nanpa[bot] avatar Jan 19 '25 19:01 ilo-nanpa[bot]

Would it be sufficient to reuse this flag?

I didn't think of this TBH. It could be done by exposing a setter in VideoTrackSource and then set the is_screencast_ member in publish_track. If you are OK with this, I am happy to go with it.

Side note: The only "problem" I see with this, is that NativeVideoSource will require a kind of two stage initialization, which could be error prone. A way to mitigate it would be to create the NativeVideoSource object in publish_track, but I am not sure if this is acceptable.

iparaskev avatar Jan 21 '25 08:01 iparaskev

Something that I had forgotten to mention when I created this, is that when is_screencast is set, libwebrtc limits the FPS to 5. I had to add spatial_layers.back().maxFramerate = video_codec.maxFramerate; here as a workaround.

iparaskev avatar Mar 23 '25 22:03 iparaskev