diff --git a/examples/pico/CMakeLists.txt b/examples/pico/CMakeLists.txt index 5381860..52082ab 100644 --- a/examples/pico/CMakeLists.txt +++ b/examples/pico/CMakeLists.txt @@ -9,6 +9,7 @@ pico_sdk_init() include(FreeRTOS_Kernel_import.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/../../third_party/coreHTTP/httpFilePaths.cmake) include(${CMAKE_CURRENT_LIST_DIR}/../../third_party/coreMQTT/mqttFilePaths.cmake) include_directories( @@ -93,7 +94,9 @@ target_compile_definitions(peer PRIVATE CONFIG_USE_LWIP=1 CONFIG_USE_USRSCTP=0 CONFIG_MBEDTLS_2_X=1 - CONFIG_DATA_BUFFER_SIZE=4096 + CONFIG_DATA_BUFFER_SIZE=512 + CONFIG_AUDIO_BUFFER_SIZE=2048 + CONFIG_SDP_BUFFER_SIZE=4096 HTTP_DO_NOT_USE_CUSTOM_CONFIG MQTT_DO_NOT_USE_CUSTOM_CONFIG ) diff --git a/src/config.h b/src/config.h index 83de727..4de3495 100644 --- a/src/config.h +++ b/src/config.h @@ -38,6 +38,18 @@ #define CONFIG_DATA_BUFFER_SIZE (SCTP_MTU * 128) #endif +#ifndef CONFIG_SDP_BUFFER_SIZE +#define CONFIG_SDP_BUFFER_SIZE 8096 +#endif + +#ifndef CONFIG_MQTT_BUFFER_SIZE +#define CONFIG_MQTT_BUFFER_SIZE 4096 +#endif + +#ifndef CONFIG_HTTP_BUFFER_SIZE +#define CONFIG_HTTP_BUFFER_SIZE 4096 +#endif + #define AUDIO_LATENCY 20 // ms #define KEEPALIVE_CONNCHECK 10000 #define CONFIG_IPV6 0 diff --git a/src/peer_connection.c b/src/peer_connection.c index 26920d4..56ec655 100644 --- a/src/peer_connection.c +++ b/src/peer_connection.c @@ -232,7 +232,7 @@ int peer_connection_send_audio(PeerConnection* pc, const uint8_t* buf, size_t le #if (CONFIG_AUDIO_BUFFER_SIZE) > 0 return buffer_push_tail(pc->audio_rb, buf, len); #else - return rtp_encoder_encode(&pc->artp_encoder, data, bytes); + return rtp_encoder_encode(&pc->artp_encoder, buf, len); #endif } diff --git a/src/peer_signaling.c b/src/peer_signaling.c index 5e0176d..bd0fa53 100644 --- a/src/peer_signaling.c +++ b/src/peer_signaling.c @@ -18,12 +18,7 @@ #define KEEP_ALIVE_TIMEOUT_SECONDS 60 #define CONNACK_RECV_TIMEOUT_MS 1000 -#ifndef BUF_SIZE -#define BUF_SIZE 2048 -#endif - #define TOPIC_SIZE 128 - #define HOST_LEN 64 #define CRED_LEN 128 @@ -47,8 +42,8 @@ typedef struct PeerSignaling { TransportInterface_t transport; NetworkContext_t net_ctx; - uint8_t mqtt_buf[BUF_SIZE]; - uint8_t http_buf[BUF_SIZE]; + uint8_t mqtt_buf[CONFIG_MQTT_BUFFER_SIZE]; + uint8_t http_buf[CONFIG_HTTP_BUFFER_SIZE]; char subtopic[TOPIC_SIZE]; char pubtopic[TOPIC_SIZE]; diff --git a/src/sdp.h b/src/sdp.h index ebebab8..ed91bcf 100644 --- a/src/sdp.h +++ b/src/sdp.h @@ -2,8 +2,8 @@ #define SDP_H_ #include +#include "config.h" -#define SDP_CONTENT_LENGTH 10240 #define SDP_ATTR_LENGTH 128 #ifndef ICE_LITE @@ -11,7 +11,7 @@ #endif typedef struct Sdp { - char content[SDP_CONTENT_LENGTH]; + char content[CONFIG_SDP_BUFFER_SIZE]; } Sdp;