Skip to content

add SetRate to nvenc encoder implementations#1194

Open
chenosaurus wants to merge 4 commits into
dc/nvenc_av1from
dc/nvenc_setrate
Open

add SetRate to nvenc encoder implementations#1194
chenosaurus wants to merge 4 commits into
dc/nvenc_av1from
dc/nvenc_setrate

Conversation

@chenosaurus

Copy link
Copy Markdown
Contributor
  • NVENC encoders were not correctly updating encode bitrate and was stuck at the initial rate set by webrtc, this fixes the problem by properly implementing SetRate on the encoder implementation to properly handle requests to change encode config.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes NVENC-based encoders not applying runtime bitrate updates from WebRTC by adding an NvEncoder::SetRates(...) helper that reconfigures an active NVENC session, and wiring WebRTC SetRates(...) calls to invoke it.

Changes:

  • Add NvEncoder::SetRates(frameRate, averageBitrate) to reconfigure NVENC encode parameters during a live session.
  • Call encoder_->SetRates(...) from the H264/H265/AV1 encoder implementations when WebRTC updates rate control parameters.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
webrtc-sys/src/nvidia/NvCodec/NvCodec/NvEncoder/NvEncoder.h Adds the SetRates(...) API to the NVENC wrapper class.
webrtc-sys/src/nvidia/NvCodec/NvCodec/NvEncoder/NvEncoder.cpp Implements SetRates(...) via NVENC reconfigure using current initialize params and updated RC settings.
webrtc-sys/src/nvidia/h265_encoder_impl.cpp Invokes NVENC SetRates(...) during WebRTC rate updates for H265.
webrtc-sys/src/nvidia/h264_encoder_impl.cpp Invokes NVENC SetRates(...) during WebRTC rate updates for H264.
webrtc-sys/src/nvidia/av1_encoder_impl.cpp Invokes NVENC SetRates(...) during WebRTC rate updates for AV1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread webrtc-sys/src/nvidia/h264_encoder_impl.cpp Outdated
Comment thread webrtc-sys/src/nvidia/h265_encoder_impl.cpp Outdated
Comment thread webrtc-sys/src/nvidia/av1_encoder_impl.cpp Outdated
chenosaurus and others added 3 commits June 26, 2026 16:52
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants