Skip to content

Commit f3f1ad3

Browse files
committed
Merge branch 'main' into coverity
2 parents 56335b3 + 107c7f6 commit f3f1ad3

28 files changed

+617
-50
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
6060
- name: cmake
6161
run: |
62-
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -Werror -DCMAKE_C_FLAGS="-Werror"
62+
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"
6363
cmake --build build -t retest
6464
6565
- name: retest

.github/workflows/cmake_win.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CMake and Windows
1+
name: Windows
22

33
on:
44
push:

.github/workflows/coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
coverage:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-22.04
1414

1515
env:
1616
CMAKE_GENERATOR: Ninja

.github/workflows/mingw.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
MinGW-w64-build:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-22.04
1414

1515
env:
1616
CMAKE_GENERATOR: Ninja

.github/workflows/sanitizers.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ jobs:
1818
sanitizer: [thread, address, undefined]
1919
env:
2020
CC: clang-18
21+
CXX: clang++-18
2122
CMAKE_GENERATOR: Ninja
2223
CFLAGS: "-fsanitize=${{ matrix.sanitizer }} -fno-sanitize-recover=all -fno-sanitize=function"
24+
CXXFLAGS: "-fsanitize=${{ matrix.sanitizer }} -fno-sanitize-recover=all -fno-sanitize=function"
2325
ASAN_OPTIONS: fast_unwind_on_malloc=0
2426

2527
steps:

CHANGELOG.md

+37
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,43 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## v3.19.0 - 2025-01-15
10+
11+
## What's Changed
12+
* fmt: fix pl trim methods and add tests by @maximilianfridrich in https://github.com/baresip/re/pull/1226
13+
* sipsess: add sipsess_msg getter function by @cspiel1 in https://github.com/baresip/re/pull/1225
14+
* rtp/sess: fix missing srate_tx locking by @sreimers in https://github.com/baresip/re/pull/1231
15+
* rtcp: use rtcp_rtpfb_gnack_encode() function by @alfredh in https://github.com/baresip/re/pull/1233
16+
* net/linux: add net_netlink_addrs by @sreimers in https://github.com/baresip/re/pull/1232
17+
* tcp,udp: set TOS (TCLASS) for IPv6 sockets by @maximilianfridrich in https://github.com/baresip/re/pull/1218
18+
* sys/fs: fix fs_fopen return null check by @sreimers in https://github.com/baresip/re/pull/1237
19+
* test: remove mock tcp-server (unused) by @alfredh in https://github.com/baresip/re/pull/1235
20+
* rtp: remove rtcp_psfb_sli_encode() (unused) by @alfredh in https://github.com/baresip/re/pull/1234
21+
* ci/clang: bump clang-18 and use ubuntu 24.04 by @sreimers in https://github.com/baresip/re/pull/1236
22+
* net/linux/addrs: fix point-to-point peer address bug by @sreimers in https://github.com/baresip/re/pull/1239
23+
* ci/coverage: bump min_cov by @sreimers in https://github.com/baresip/re/pull/1241
24+
* ci/sanitizers: bump clang and ubuntu by @sreimers in https://github.com/baresip/re/pull/1242
25+
* net/linux/addrs: fix netlink kernel warnings by @sreimers in https://github.com/baresip/re/pull/1243
26+
* rem: add au_ prefix to calc_nsamp() by @alfredh in https://github.com/baresip/re/pull/1244
27+
* rem/vidconv: add vidconv_center and x and y source offsets by @sreimers in https://github.com/baresip/re/pull/1240
28+
* test: add testcode for rem au-module by @alfredh in https://github.com/baresip/re/pull/1245
29+
* mem: remove peak from memstat by @alfredh in https://github.com/baresip/re/pull/1238
30+
* debian: replace with CPack DEB Generator by @sreimers in https://github.com/baresip/re/pull/1247
31+
* copyright: happy new year 2025 by @sreimers in https://github.com/baresip/re/pull/1246
32+
* test/vidconv: remove static struct test by @sreimers in https://github.com/baresip/re/pull/1248
33+
* net/linux/addrs: use list instead of fixed array for interface up by @sreimers in https://github.com/baresip/re/pull/1251
34+
* test: optional IPv6 for tcp/udp tos test by @alfredh in https://github.com/baresip/re/pull/1252
35+
* cmake: update min requirement and use range by @sreimers in https://github.com/baresip/re/pull/1253
36+
* rem/vid/frame: fix vidframe init by @sreimers in https://github.com/baresip/re/pull/1257
37+
* atomic: fix compilation for C++ and Windows-ARM64 by @alfredh in https://github.com/baresip/re/pull/1259
38+
* test: add test for C++ applications by @alfredh in https://github.com/baresip/re/pull/1254
39+
* ci: use ubuntu-22.04 were needed by @sreimers in https://github.com/baresip/re/pull/1261
40+
* cmake: enable compiler warnings for C only by @alfredh in https://github.com/baresip/re/pull/1263
41+
42+
43+
**Full Changelog**: https://github.com/baresip/re/compare/v3.18.0...v3.19.0
44+
45+
946
## v3.18.0 - 2024-12-11
1047

1148
## What's Changed

CMakeLists.txt

+12-6
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
# Versioning
1212
#
1313

14-
cmake_minimum_required(VERSION 3.14)
14+
cmake_minimum_required(VERSION 3.15...3.31)
1515

1616
project(re
17-
VERSION 3.18.0
17+
VERSION 3.19.0
1818
LANGUAGES C
1919
HOMEPAGE_URL https://github.com/baresip/re
2020
DESCRIPTION "Generic library for real-time communications"
2121
)
2222

23-
set(PROJECT_SOVERSION 28) # bump if ABI breaks
23+
set(PROJECT_SOVERSION 29) # bump if ABI breaks
2424

2525
# Pre-release identifier, comment out on a release
2626
# Increment for breaking changes (dev2, dev3...)
@@ -63,7 +63,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
6363
if(MSVC)
6464
add_compile_options("/W3")
6565
else()
66-
add_compile_options(
66+
67+
set(c_flags
6768
-pedantic
6869
-Wall
6970
-Wbad-function-cast
@@ -79,19 +80,23 @@ else()
7980
-Wuninitialized
8081
-Wvla
8182
)
83+
84+
add_compile_options(
85+
"$<$<COMPILE_LANGUAGE:C>:${c_flags}>"
86+
)
8287
endif()
8388

8489
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
8590
add_compile_options(
86-
-Wshorten-64-to-32
8791
-Wno-gnu-zero-variadic-macro-arguments
8892
-Wno-c2x-extensions
8993
)
94+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:-Wshorten-64-to-32>")
9095
endif()
9196

9297
check_c_compiler_flag("-Watomic-implicit-seq-cst" COMPILER_SUPPORTS_WATOMIC)
9398
if(COMPILER_SUPPORTS_WATOMIC)
94-
add_compile_options(-Watomic-implicit-seq-cst)
99+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:-Watomic-implicit-seq-cst>")
95100
endif()
96101

97102
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -299,6 +304,7 @@ set(SRCS
299304
src/md5/wrap.c
300305

301306
src/mem/mem.c
307+
src/mem/mem_pool.c
302308
src/mem/secure.c
303309

304310
src/mod/mod.c

include/re_atomic.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -599,16 +599,16 @@ static __forceinline unsigned __int64 _re_atomic_load(
599599

600600
switch (size) {
601601
case 1u:
602-
v = __iso_volatile_load8((const unsigned __int8*)a);
602+
v = __iso_volatile_load8((const volatile __int8*)a);
603603
break;
604604
case 2u:
605-
v = __iso_volatile_load16((const unsigned __int16*)a);
605+
v = __iso_volatile_load16((const volatile __int16*)a);
606606
break;
607607
case 4u:
608-
v = __iso_volatile_load32((const unsigned __int32*)a);
608+
v = __iso_volatile_load32((const volatile __int32*)a);
609609
break;
610610
default:
611-
v = __iso_volatile_load64((const unsigned __int64*)a);
611+
v = __iso_volatile_load64((const volatile __int64*)a);
612612
break;
613613
}
614614

include/re_http.h

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ int https_listen(struct http_sock **sockp, const struct sa *laddr,
202202
const char *cert, http_req_h *reqh, void *arg);
203203
int https_set_verify_msgh(struct http_sock *sock,
204204
https_verify_msg_h *verifyh);
205+
void http_set_max_body_size(struct http_sock *sock, size_t limit);
205206
struct tcp_sock *http_sock_tcp(struct http_sock *sock);
206207
struct tls *http_sock_tls(const struct http_sock *conn);
207208
const struct sa *http_conn_peer(const struct http_conn *conn);

include/re_main.h

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ void re_thread_async_cancel(intptr_t id);
7171
void re_thread_async_main_cancel(intptr_t id);
7272

7373
void re_set_mutex(void *mutexp);
74+
void re_fhs_flush(void);
7475

7576
struct tmrl *re_tmrl_get(void);
7677

include/re_mem.h

+13
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,16 @@ int mem_get_stat(struct memstat *mstat);
3939
/* Secure memory functions */
4040
int mem_seccmp(const uint8_t *s1, const uint8_t *s2, size_t n);
4141
void mem_secclean(void *data, size_t size);
42+
43+
44+
/* Mem Pool */
45+
struct mem_pool;
46+
struct mem_pool_entry;
47+
int mem_pool_alloc(struct mem_pool **poolp, size_t nmemb, size_t membsize,
48+
mem_destroy_h *dh);
49+
int mem_pool_extend(struct mem_pool *pool, size_t num);
50+
struct mem_pool_entry *mem_pool_borrow(struct mem_pool *pool);
51+
struct mem_pool_entry *mem_pool_borrow_extend(struct mem_pool *pool);
52+
void *mem_pool_release(struct mem_pool *pool, struct mem_pool_entry *e);
53+
void *mem_pool_member(const struct mem_pool_entry *entry);
54+
void mem_pool_flush(struct mem_pool *pool);

mk/Doxyfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Project related configuration options
55
#---------------------------------------------------------------------------
66
PROJECT_NAME = libre
7-
PROJECT_NUMBER = 3.18.0
7+
PROJECT_NUMBER = 3.19.0
88
OUTPUT_DIRECTORY = ../re-dox
99
CREATE_SUBDIRS = NO
1010
OUTPUT_LANGUAGE = English

rem/aubuf/aubuf.c

+21-10
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818

1919
#define AUBUF_DEBUG 0
2020

21+
enum { POOL_FRAMES = 25 };
2122

2223
/** Locked audio-buffer with almost zero-copy */
2324
struct aubuf {
2425
struct list afl;
26+
struct mem_pool *pool;
2527
struct pl *id; /**< Audio buffer Identifier */
2628
mtx_t *lock;
2729
size_t wish_sz;
@@ -49,13 +51,13 @@ struct frame {
4951
struct le le;
5052
struct mbuf *mb;
5153
struct auframe af;
54+
struct mem_pool_entry *e;
5255
};
5356

5457

55-
static void frame_destructor(void *arg)
58+
static void frame_destructor(void *data)
5659
{
57-
struct frame *f = arg;
58-
60+
struct frame *f = data;
5961
list_unlink(&f->le);
6062
mem_deref(f->mb);
6163
}
@@ -65,10 +67,10 @@ static void aubuf_destructor(void *arg)
6567
{
6668
struct aubuf *ab = arg;
6769

68-
list_flush(&ab->afl);
6970
mem_deref(ab->lock);
7071
mem_deref(ab->ajb);
7172
mem_deref(ab->id);
73+
mem_deref(ab->pool);
7274
}
7375

7476

@@ -100,7 +102,7 @@ static void read_auframe(struct aubuf *ab, struct auframe *af)
100102
}
101103

102104
if (!mbuf_get_left(f->mb)) {
103-
mem_deref(f);
105+
mem_pool_release(ab->pool, f->e);
104106
}
105107
else if (af->srate && af->ch && sample_size) {
106108

@@ -139,6 +141,11 @@ int aubuf_alloc(struct aubuf **abp, size_t min_sz, size_t max_sz)
139141
if (!ab)
140142
return ENOMEM;
141143

144+
err = mem_pool_alloc(&ab->pool, POOL_FRAMES, sizeof(struct frame),
145+
frame_destructor);
146+
if (err)
147+
goto out;
148+
142149
err = mutex_alloc(&ab->lock);
143150
if (err)
144151
goto out;
@@ -269,10 +276,13 @@ int aubuf_append_auframe(struct aubuf *ab, struct mbuf *mb,
269276
if (!ab || !mb)
270277
return EINVAL;
271278

272-
f = mem_zalloc(sizeof(*f), frame_destructor);
273-
if (!f)
279+
struct mem_pool_entry *e = mem_pool_borrow_extend(ab->pool);
280+
if (!e)
274281
return ENOMEM;
275282

283+
f = mem_pool_member(e);
284+
f->e = e;
285+
276286
f->mb = mem_ref(mb);
277287
if (af)
278288
f->af = *af;
@@ -299,7 +309,7 @@ int aubuf_append_auframe(struct aubuf *ab, struct mbuf *mb,
299309
f = list_ledata(ab->afl.head);
300310
if (f) {
301311
ab->cur_sz -= mbuf_get_left(f->mb);
302-
mem_deref(f);
312+
mem_pool_release(ab->pool, f->e);
303313
}
304314
}
305315

@@ -415,7 +425,7 @@ void aubuf_read_auframe(struct aubuf *ab, struct auframe *af)
415425
struct frame *f = list_ledata(ab->afl.head);
416426
if (f) {
417427
ab->cur_sz -= mbuf_get_left(f->mb);
418-
mem_deref(f);
428+
mem_pool_release(ab->pool, f->e);
419429
}
420430
}
421431

@@ -499,7 +509,8 @@ void aubuf_flush(struct aubuf *ab)
499509

500510
mtx_lock(ab->lock);
501511

502-
list_flush(&ab->afl);
512+
list_clear(&ab->afl);
513+
mem_pool_flush(ab->pool);
503514
ab->fill_sz = ab->wish_sz;
504515
ab->cur_sz = 0;
505516
ab->wr_sz = 0;

rem/vid/frame.c

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ void vidframe_init(struct vidframe *vf, enum vidfmt fmt,
6464

6565
vf->size = *sz;
6666
vf->fmt = fmt;
67+
vf->xoffs = 0;
68+
vf->yoffs = 0;
6769
}
6870

6971

@@ -156,6 +158,8 @@ void vidframe_init_buf(struct vidframe *vf, enum vidfmt fmt,
156158

157159
vf->size = *sz;
158160
vf->fmt = fmt;
161+
vf->xoffs = 0;
162+
vf->yoffs = 0;
159163
}
160164

161165

0 commit comments

Comments
 (0)