Skip to content

Commit 4a350a4

Browse files
committed
Merge branch 'feature/add_crt_bundle_attach_for_https' into 'main'
feat(gmf_loader): Add some features for gmf_loader See merge request adf/multimedia/esp-gmf!190
2 parents df04d99 + 3e16f09 commit 4a350a4

File tree

7 files changed

+68
-4
lines changed

7 files changed

+68
-4
lines changed

packages/gmf_loader/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## v0.7.2
4+
5+
### Features
6+
7+
- Add `crt_bundle_attach` to use when not enable `CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY`
8+
- Add io_file cache size configuration to improve read and write performance
9+
310
## v0.7.1
411

512
### Bug Fixes
@@ -10,4 +17,4 @@
1017

1118
### Features
1219

13-
- Add initial implementation of `gmf_loader` with official element registration and I/O setup.
20+
- Add initial implementation of `gmf_loader` with official element registration and I/O setup

packages/gmf_loader/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
idf_component_register(
22
SRC_DIRS "./src"
33
INCLUDE_DIRS "./include"
4+
REQUIRES "mbedtls"
45
)

packages/gmf_loader/Kconfigs/kconfig.io.reader

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ menu "GMF IO Reader"
1010
help
1111
Initialize GMF File Reader
1212

13+
menu "IO File Configuration"
14+
depends on GMF_IO_INIT_FILE_READER
15+
16+
config GMF_IO_FILE_READ_CACHE_SIZE
17+
int "IO File Read Cache Size"
18+
default 2048
19+
range 0 65536
20+
help
21+
Configure the buffer size for the GMF IO File Reader.
22+
This setting affects the performance of file reading operations.
23+
Larger buffer sizes may improve read performance but consume more memory.
24+
If the SOC does not have the SOC_SDMMC_PSRAM_DMA_CAPABLE capability, internal memory will be used.
25+
endmenu
26+
1327
config GMF_IO_INIT_HTTP_READER
1428
bool "Initialize GMF HTTP Reader"
1529
default y
@@ -49,7 +63,7 @@ menu "GMF IO Reader"
4963
config GMF_IO_HTTP_READER_OUT_BUF_SIZE
5064
int "HTTP Reader Output Buffer Size"
5165
default 8192
52-
range 1024 16384
66+
range 1024 131072
5367
help
5468
Configure the size of the output buffer for the GMF HTTP Reader.
5569

packages/gmf_loader/Kconfigs/kconfig.io.writer

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@ menu "GMF IO Writer"
1111
help
1212
Initialize GMF file writer
1313

14+
menu "IO File Configuration"
15+
depends on GMF_IO_INIT_FILE_WRITER
16+
17+
config GMF_IO_FILE_WRITE_CACHE_SIZE
18+
int "IO File Write Cache Size"
19+
default 4096
20+
range 0 65536
21+
help
22+
Configure the buffer size for the GMF IO File Writer.
23+
This setting affects the performance of file writing operations.
24+
Larger buffer sizes may improve write performance but consume more memory.
25+
If the SOC does not have the SOC_SDMMC_PSRAM_DMA_CAPABLE capability, internal memory will be used.
26+
endmenu
27+
1428
config GMF_IO_INIT_HTTP_WRITER
1529
bool "Initialize GMF HTTP Writer"
1630
default n
@@ -50,7 +64,7 @@ menu "GMF IO Writer"
5064
config GMF_IO_HTTP_WRITER_OUT_BUF_SIZE
5165
int "HTTP Writer Output Buffer Size"
5266
default 8192
53-
range 1024 16384
67+
range 1024 131072
5468
help
5569
Configure the size of the output buffer for the GMF HTTP Writer.
5670

packages/gmf_loader/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "0.7.1"
1+
version: "0.7.2"
22
description: Espressif GMF Loader is a module that loads elements and I/O components for the GMF pipeline
33
url: https://github.com/espressif/esp-gmf/tree/main/packages/gmf_loader
44
documentation: "https://github.com/espressif/esp-gmf/blob/main/packages/gmf_loader/README.md"

packages/gmf_loader/src/gmf_loader_setup_audio_codec.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@
1616
#include "sdkconfig.h"
1717

1818
static const char *TAG = "GMF_SETUP_AUD_CODEC";
19+
20+
#ifdef CONFIG_GMF_AUDIO_CODEC_INIT_ENCODER
1921
static int8_t _init_encoder_cnt = 0;
22+
#endif /* CONFIG_GMF_AUDIO_CODEC_INIT_ENCODER */
23+
#ifdef CONFIG_GMF_AUDIO_CODEC_INIT_DECODER
2024
static int8_t _init_decoder_cnt = 0;
25+
#endif /* CONFIG_GMF_AUDIO_CODEC_INIT_DECODER */
2126

2227
#if defined(CONFIG_GMF_AUDIO_CODEC_INIT_ENCODER)
2328
static esp_gmf_err_t gmf_loader_setup_default_enc(esp_gmf_pool_handle_t pool)

packages/gmf_loader/src/gmf_loader_setup_io.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
*/
77

88
#include "esp_gmf_err.h"
9+
#include "esp_heap_caps.h"
10+
#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
11+
#include "esp_crt_bundle.h"
12+
#endif /* CONFIG_MBEDTLS_CERTIFICATE_BUNDLE */
913
#include "esp_gmf_io.h"
1014
#include "esp_gmf_io_codec_dev.h"
1115
#include "esp_gmf_io_embed_flash.h"
@@ -42,6 +46,19 @@ static esp_gmf_err_t gmf_loader_setup_default_fs_io(esp_gmf_pool_handle_t pool,
4246

4347
esp_gmf_err_t ret = ESP_GMF_ERR_OK;
4448
file_io_cfg_t fs_cfg = FILE_IO_CFG_DEFAULT();
49+
fs_cfg.cache_caps = MALLOC_CAP_DMA;
50+
if (dir == ESP_GMF_IO_DIR_READER) {
51+
#if CONFIG_GMF_IO_INIT_FILE_READER
52+
fs_cfg.cache_size = CONFIG_GMF_IO_FILE_READ_CACHE_SIZE;
53+
#endif
54+
} else {
55+
#if CONFIG_GMF_IO_INIT_FILE_WRITER
56+
fs_cfg.cache_size = CONFIG_GMF_IO_FILE_WRITE_CACHE_SIZE;
57+
#endif
58+
}
59+
#if SOC_SDMMC_PSRAM_DMA_CAPABLE
60+
fs_cfg.cache_caps |= MALLOC_CAP_SPIRAM;
61+
#endif
4562
esp_gmf_io_handle_t hd = NULL;
4663
fs_cfg.dir = dir;
4764
ret = esp_gmf_io_file_init(&fs_cfg, &hd);
@@ -114,6 +131,12 @@ static esp_gmf_err_t gmf_loader_setup_default_http_io(esp_gmf_pool_handle_t pool
114131
#endif /* CONFIG_GMF_IO_INIT_HTTP_WRITER */
115132
}
116133

134+
#ifdef CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY
135+
http_cfg.cert_pem = NULL;
136+
#elif defined(CONFIG_MBEDTLS_CERTIFICATE_BUNDLE)
137+
http_cfg.crt_bundle_attach = esp_crt_bundle_attach;
138+
#endif
139+
117140
ret = esp_gmf_io_http_init(&http_cfg, &hd);
118141
ESP_GMF_RET_ON_ERROR(TAG, ret, return ret, "Failed to init http io");
119142
ret = esp_gmf_pool_register_io(pool, hd, NULL);

0 commit comments

Comments
 (0)