Skip to content

Conversation

@xianshijing-lk
Copy link
Contributor

And we should do it for Desktop only

@ladvoc
Copy link
Contributor

ladvoc commented Dec 22, 2025

Maybe we should add a simple unit test for munge_x_google_start_bitrate?

pub type OnOfferCreated = Box<dyn FnMut(SessionDescription) + Send + Sync>;

#[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))]
const DEFAULT_VP9_START_BITRATE_KBPS: u32 = 2500;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use the currently negotiated bitrate? instead of a fixed amount? the JS logic uses 80% of ultimate bitrate. I think it's ok to go to 100% as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will address the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have negotiated birate in SDP ? any one can point me to the relevant code or give me some hint ?

@ladvoc @cloudwebrtc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I addressed the comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we using 70 or 80? is there a good reason to? I'd like to avoid magic numbers if possible.

Ok(answer)
}

fn munge_x_google_start_bitrate(sdp: &str, start_bitrate_kbps: u32) -> String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use a proper sdp parser/rewriter? instead of string changes? https://crates.io/crates/sdp

in case we'd need to do more munging for other things

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ladvoc @cloudwebrtc , what do you think here ?

If this is the only place that we will need to parse sdp, I would prefer keeping this handmade parser rather than introducing a new dep

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS munges SDP for several purposes, including enabling stereo publishing, and a few other things

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think brining in the SDP crate you have linked to do munging is ok. The crate is lightweight (minimal transitive dependencies) and it comes from the webrtc-rs project.

@xianshijing-lk xianshijing-lk force-pushed the sxian/CLT-2374/implement_x-google-start-bitrate_for_vp9 branch from c88e62d to b33149c Compare January 12, 2026 08:40
Copy link
Contributor

@cloudwebrtc cloudwebrtc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg!

@xianshijing-lk xianshijing-lk merged commit 2cf0eda into main Jan 13, 2026
22 of 23 checks passed
@xianshijing-lk xianshijing-lk deleted the sxian/CLT-2374/implement_x-google-start-bitrate_for_vp9 branch January 13, 2026 00:48
@github-actions github-actions bot mentioned this pull request Jan 10, 2026
@davidzhao davidzhao changed the title try setting x-google-start-bitrate for vp9 improving initial video quality by setting x-google-start-bitrate for svc codecs Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants