Skip to content

Commit

Permalink
Add config for buf
Browse files Browse the repository at this point in the history
  • Loading branch information
sepfy committed Oct 18, 2024
1 parent c33e1f6 commit 85b0b96
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
5 changes: 4 additions & 1 deletion examples/pico/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
)
Expand Down
12 changes: 12 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/peer_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
9 changes: 2 additions & 7 deletions src/peer_signaling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions src/sdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
#define SDP_H_

#include <string.h>
#include "config.h"

#define SDP_CONTENT_LENGTH 10240
#define SDP_ATTR_LENGTH 128

#ifndef ICE_LITE
#define ICE_LITE 0
#endif

typedef struct Sdp {
char content[SDP_CONTENT_LENGTH];
char content[CONFIG_SDP_BUFFER_SIZE];

} Sdp;

Expand Down

0 comments on commit 85b0b96

Please sign in to comment.