esp_capture: fix bitrate setter for video/audio; plumb to encoder (AUD-6880) #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes #29: runtime bitrate control for
esp_captureby correctly forwarding sink bitrate changes to the capture path manager and ultimately the video encoder element.The current
esp_capture_sink_set_bitrate(...) returnedESP_CAPTURE_ERR_NOT_SUPPORTEDand mixed audio/video handling, so bitrate updates never reached the GMF video encoder.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).
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
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: