Allow configuring http_stream buffer_size and buffer_size_tx (AUD-7208)#1587
Open
stintel wants to merge 2 commits intoespressif:release/v2.xfrom
Open
Allow configuring http_stream buffer_size and buffer_size_tx (AUD-7208)#1587stintel wants to merge 2 commits intoespressif:release/v2.xfrom
stintel wants to merge 2 commits intoespressif:release/v2.xfrom
Conversation
And move HTTP_STREAM_BUFFER_SIZE from http_stream.c to http_stream.h and use it in the HTTP_STREAM_CFG_DEFAULT() macro. This makes it possible to configure a different HTTP receive buffer size. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
And define the previous hardcoded default of 1024 HTTP_STREAM_BUFFER_SIZE_TX, and use it in the HTTP_STREAM_CFG_DEFAULT() macro, for ESP-IDF 4.1 and higher. This makes it possible to configure a different HTTP send buffer size. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
The http_stream component hardcodes buffer_size (2048) and buffer_size_tx (1024) when creating the internal esp_http_client. This makes it impossible for users to configure these values, thus there is no easy way to fix this error:
This PR adds both buffer_size and buffer_size_tx as fields in http_stream_cfg_t, with defaults matching the previous hardcoded values (HTTP_STREAM_BUFFER_SIZE = 2048, HTTP_STREAM_BUFFER_SIZE_TX = 1024). The _http_open() function now reads from the config struct instead of using hardcoded constants.
buffer_size_tx is guarded with #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0) to match the upstream esp_http_client_config_t field availability.
This is a non-breaking change — existing code using HTTP_STREAM_CFG_DEFAULT() gets the same values as before.
Testing
Compile and runtime-tested in Willow.
Checklist
Before submitting a Pull Request, please ensure the following: