fix bug in http_task which results in a reboot if flac can't allocate out memory

Signed-off-by: Karl Osterseher <karli_o@gmx.at>
This commit is contained in:
Karl Osterseher
2025-01-18 09:30:46 +01:00
Unverified
parent 4e73d36037
commit d9afc3038b
10 changed files with 54 additions and 4041 deletions

9
.clang-format Normal file
View File

@@ -0,0 +1,9 @@
# We'll use defaults from the LLVM style, but with some modifications so that it's close to the CDT K&R style.
BasedOnStyle: LLVM
UseTab: Always
IndentWidth: 4
TabWidth: 4
PackConstructorInitializers: NextLineOnly
BreakConstructorInitializers: AfterColon
IndentAccessModifiers: false
AccessModifierOffset: -4

3
.clangd Normal file
View File

@@ -0,0 +1,3 @@
CompileFlags:
CompilationDatabase: build
Remove: [-m*, -f*]

4007
.project

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,7 @@
if(CONFIG_SNAPCLIENT_ENABLE_ETHERNET)
idf_component_register(SRCS "eth_interface.c"
INCLUDE_DIRS "include")
INCLUDE_DIRS "include"
PRIV_REQUIRES driver esp_eth esp_netif)
else()
idf_component_register()
endif()

View File

@@ -1 +0,0 @@
COMPONENT_SRCDIRS := .

View File

@@ -8,7 +8,13 @@
*/
#include <stdio.h>
#include <string.h>
#include "driver/gpio.h"
#if CONFIG_ETH_USE_SPI_ETHERNET
#include "driver/spi_master.h"
#endif // CONFIG_ETH_USE_SPI_ETHERNET
#include "esp_eth.h"
#include "esp_event.h"
#include "esp_log.h"
@@ -16,10 +22,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "freertos/task.h"
#include "sdkconfig.h"
#if CONFIG_ETH_USE_SPI_ETHERNET
#include "driver/spi_master.h"
#endif // CONFIG_ETH_USE_SPI_ETHERNET
// #include "sdkconfig.h"
static const char *TAG = "ETH";

View File

@@ -136,14 +136,12 @@ esp_err_t my_i2s_channel_enable(i2s_chan_handle_t handle) {
static esp_err_t player_setup_i2s(i2s_port_t i2sNum,
snapcastSetting_t *setting) {
#if USE_SAMPLE_INSERTION
const int __dmaBufMaxLen = 1023;
i2sDmaBufCnt = 22;
i2sDmaBufMaxLen =
100; // OPUS has a minimum frame size of 120
// with DMA buffer set to this value sync algorithm
// works for all decoders. We set it to 100 so
// there will be free space for sample stuffing in each round
// OPUS has a minimum frame size of 120
// with DMA buffer set to this value sync algorithm
// works for all decoders. We set it to 100 so
// there will be free space for sample stuffing in each round
i2sDmaBufMaxLen = 100;
#else
int fi2s_clk;
@@ -232,13 +230,13 @@ static esp_err_t player_setup_i2s(i2s_port_t i2sNum,
}
i2s_std_clk_config_t i2s_clkcfg = {
.sample_rate_hz = sr,
.sample_rate_hz = sr,
#if CONFIG_USE_SAMPLE_INSERTION
.clk_src = I2S_CLK_SRC_DEFAULT,
.clk_src = I2S_CLK_SRC_DEFAULT,
#else
.clk_src = I2S_CLK_SRC_APLL,
.clk_src = I2S_CLK_SRC_APLL,
#endif
.mclk_multiple = I2S_MCLK_MULTIPLE_256,
.mclk_multiple = I2S_MCLK_MULTIPLE_256,
};
i2s_std_config_t tx_std_cfg = {
.clk_cfg = i2s_clkcfg,

View File

@@ -1,21 +1,32 @@
dependencies:
espressif/esp-dsp:
component_hash: 3e7bbd487f1357a1d4944d0c85966d049501ea281b8a4c7f93f7cfedd5b7f23d
component_hash: fa7fe74305df6da25867437ebcd4213e047cbfc0556cf92067ab657fce537c6e
dependencies:
- name: idf
require: private
version: '>=4.2'
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com/
type: service
version: 1.4.12
version: 1.5.2
espressif/mdns:
component_hash: ed10ef031bce505e423c5dbf0fdf2ce7a02df5f9ebffb18df2d6b9852e48817d
component_hash: d36b265164be5139f92de993f08f5ecaa0de0c0acbf84deee1f10bb5902d04ff
dependencies:
- name: idf
require: private
version: '>=5.0'
source:
service_url: https://api.components.espressif.com/
registry_url: https://components.espressif.com/
type: service
version: 1.3.1
version: 1.4.3
idf:
component_hash: null
source:
type: idf
version: 5.1.1
manifest_hash: d6b434b4ae9e215619e0dfb1b731739d5799f7570a1fdee428100c9146c752e2
version: 5.1.5
direct_dependencies:
- espressif/esp-dsp
- espressif/mdns
- idf
manifest_hash: 01df6f188570b9e5362f7a00a294b1d3403de1f5ce8cbd848004d3bc88aa09a8
target: esp32
version: 1.0.0
version: 2.0.0

View File

@@ -1,5 +1,5 @@
idf_component_register(SRCS "main.c"
INCLUDE_DIRS "."
PRIV_REQUIRES esp_timer esp_wifi nvs_flash wifi_interface audio_board audio_hal audio_sal net_functions opus flac ota_server
ui_http_server
ui_http_server eth_interface
)

View File

@@ -1333,7 +1333,8 @@ static void http_get_task(void *pvParameters) {
"failed",
__func__);
return;
// TODO: should insert some abort condition?
vTaskDelay(pdMS_TO_TICKS(10));
}
}