Skip to content

Conversation

@josefeliuf
Copy link

This PR fixes #29: runtime bitrate control for esp_capture by correctly forwarding sink bitrate changes to the capture path manager and ultimately the video encoder element.

  1. What was wrong

The current esp_capture_sink_set_bitrate(...) returned ESP_CAPTURE_ERR_NOT_SUPPORTED and mixed audio/video handling, so bitrate updates never reached the GMF video encoder.

  1. What this changes

Dispatches by stream_type and calls path_mngr->set(..., ESP_CAPTURE_PATH_SET_TYPE_{VIDEO|AUDIO}_BITRATE, ...), which stores the bitrate and applies it immediately if the encoder element is already created (or on prepare/start otherwise).

  1. Motivation / context

I’m using espressif/esp-webrtc-solution for a WebRTC sender pipeline. That repo uses esp_capture for media but currently does not expose a public API to change bitrate at runtime, so I added a small wrapper on that side which calls into esp_capture_sink_set_bitrate(...). I plan to open a companion PR in esp-webrtc-solution to expose this API officially. The esp-webrtc-solution README explicitly lists esp_capture as the media capture component.
GitHub

  1. Testing

Environment

ESP-IDF: latest

Board: ESP32-P4

Verified return code is OK and visual quality/throughput adapts; logs show the encoder path receiving updated bitrate.


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.

@github-actions github-actions bot changed the title esp_capture: fix bitrate setter for video/audio; plumb to encoder esp_capture: fix bitrate setter for video/audio; plumb to encoder (AUD-6880) Oct 27, 2025
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_capture_sink_set_bitrate() returns NOT_SUPPORTED and confuses audio/video (AUD-6879)

1 participant