Skip to content

Conversation

@josefeliuf
Copy link

Description

This PR closes #108: adds public runtime bitrate setters to esp_webrtc.

int esp_webrtc_set_video_bitrate(esp_webrtc_handle_t, uint32_t bps);

int esp_webrtc_set_audio_bitrate(esp_webrtc_handle_t, uint32_t bps);

Behavior

If rtc->capture_path exists, call esp_capture_sink_set_bitrate() immediately (both for Video and Audio).

If called before start, cache the values and apply them in pc_start() right after esp_capture_sink_setup() / esp_capture_sink_enable().

Why here

esp-webrtc-solution integrates esp_capture as its media layer; providing first-class bitrate control at this level makes it straightforward for applications to adapt quality without restarting streams.

Public API docs (headers) explain that bps is bits per second and that calls are valid before or during streaming.

Related

Testing

Environments

ESP-IDF: latest
Board: ESP32-P4

Scenarios

  • During stream: Run any sender demo (e.g., Video Call). Invoke esp_webrtc_set_video_bitrate(rtc, 300000). Expect lower throughput/quality.

  • Pre-start (pending): Call esp_webrtc_set_video_bitrate(rtc, 500000) before esp_webrtc_start(). Start streaming and confirm bitrate is applied after pc_start() creates/enables the sink.

  • Audio path: Invoke esp_webrtc_set_audio_bitrate(rtc, 64000) and track payload sizes or encoder stats.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

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.

esp_webrtc: add public APIs to set video/audio bitrate via esp_capture (with pending apply before start)

1 participant