Skip to content

Commit

Permalink
Merge branch 'main' into coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Jul 23, 2024
2 parents f370bbd + ab4186e commit 2638c06
Show file tree
Hide file tree
Showing 19 changed files with 214 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ If:
CompileFlags:
Add: [-Wall, -DHAVE_INTTYPES_H, -include re.h]
Remove: [-xobjective-c++-header]
---
Diagnostics:
Suppress: "-Wgnu-zero-variadic-macro-arguments"
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ jobs:
matrix:
build_type: [Release, Debug]
compiler: [gcc, clang]
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12]
os: [ubuntu-20.04, ubuntu-22.04, macos-latest]
exclude:
- os: macos-11
compiler: gcc
- os: macos-12
- os: macos-latest
compiler: gcc
env:
CC: ${{ matrix.compiler }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
timeout-minutes: 20

env:
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: build
- name: build Xcode
run: |
cmake -B build -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=ON -DUSE_OPENSSL=OFF -DCMAKE_C_FLAGS="-Werror"
cmake --build build -- CODE_SIGNING_ALLOWED=NO
cmake -B build_xcode -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=ON -DUSE_OPENSSL=OFF -DCMAKE_C_FLAGS="-Werror"
cmake --build build_xcode -- CODE_SIGNING_ALLOWED=NO
- name: normal build
run: |
cmake -B build -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=ON -DUSE_OPENSSL=OFF -DCMAKE_C_FLAGS="-Werror"
cmake --build build -j
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [v3.13.0] - 2024-06-19

## What's Changed
* http/client: use dynamically sized buffers for PEM setters by @maximilianfridrich in https://github.com/baresip/re/pull/1117
* tls: allow secure TLS renegotiation by @maximilianfridrich in https://github.com/baresip/re/pull/1121
* tls: always enable USE_OPENSSL_SRTP by @alfredh in https://github.com/baresip/re/pull/1122
* main: remove call to openssl init by @alfredh in https://github.com/baresip/re/pull/1120
* sip/transp: Allow ACK w/o Max-Forwards header by @juha-h in https://github.com/baresip/re/pull/1124
* net: remove NET_ADDRSTRLEN by @alfredh in https://github.com/baresip/re/pull/1123
* ci/ios: increase min deployment target by @sreimers in https://github.com/baresip/re/pull/1126
* tls/http: add certificate chain setters by @maximilianfridrich in https://github.com/baresip/re/pull/1125
* sipsess/connect: set sess->established immediately on 200 receival by @maximilianfridrich in https://github.com/baresip/re/pull/1128
* test/cmake: add crypt32 linking for WIN32 by @sreimers in https://github.com/baresip/re/pull/1130
* ci/sanitizers: use clang-17 by @sreimers in https://github.com/baresip/re/pull/1131
* ci/sanitizer: add undefined behavior sanitizer by @sreimers in https://github.com/baresip/re/pull/1132
* sip: verify call-id, to-tag, cseq of INVITE response by @maximilianfridrich in https://github.com/baresip/re/pull/1129
* ci: remove one unneeded directory change by @alfredh in https://github.com/baresip/re/pull/1134
* test: change GENERATOR_SSRC from define to type by @alfredh in https://github.com/baresip/re/pull/1133
* tls: refactoring SNI ctx usage for libressl support by @sreimers in https://github.com/baresip/re/pull/1136
* test: add test_rtcp_loop() by @alfredh in https://github.com/baresip/re/pull/1137
* ci/coverage: increase min coverage by @sreimers in https://github.com/baresip/re/pull/1138
* ci/coverage: use json summary and upload html details by @sreimers in https://github.com/baresip/re/pull/1139
* sip: add host param to sip_send_conn by @sreimers in https://github.com/baresip/re/pull/1141


**Full Changelog**: https://github.com/baresip/re/compare/v3.12.0...v3.13.0

## [v3.12.0] - 2024-05-15

## What's Changed
Expand Down
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
cmake_minimum_required(VERSION 3.14)

project(re
VERSION 3.12.0
VERSION 3.13.0
LANGUAGES C
HOMEPAGE_URL https://github.com/baresip/re
DESCRIPTION "Generic library for real-time communications"
)

set(PROJECT_SOVERSION 24) # bump if ABI breaks
set(PROJECT_SOVERSION 25) # bump if ABI breaks

# Pre-release identifier, comment out on a release
# Increment for breaking changes (dev2, dev3...)
Expand Down Expand Up @@ -585,6 +585,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
src/dns/darwin/srv.c
src/net/bsd/brt.c
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "iOS")
list(APPEND SRCS
src/dns/darwin/srv.c
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
list(APPEND SRCS
src/net/bsd/brt.c
Expand Down
17 changes: 12 additions & 5 deletions cmake/re-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
else()
check_symbol_exists(res_ninit resolv.h HAVE_RESOLV)
endif()
if(HAVE_RESOLV)
if(HAVE_RESOLV AND ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
list(APPEND RE_DEFINITIONS HAVE_RESOLV)
set(RESOLV_LIBRARY) # Provided by libc
elseif(HAVE_RESOLV)
set(RESOLV_LIBRARY resolv)
list(APPEND RE_DEFINITIONS HAVE_RESOLV)
else()
Expand All @@ -77,9 +80,11 @@ if(HAVE_THREADS)
list(APPEND RE_DEFINITIONS HAVE_THREADS)
endif()

check_function_exists(accept4 HAVE_ACCEPT4)
if(HAVE_ACCEPT4)
list(APPEND RE_DEFINITIONS HAVE_ACCEPT4)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
check_function_exists(accept4 HAVE_ACCEPT4)
if(HAVE_ACCEPT4)
list(APPEND RE_DEFINITIONS HAVE_ACCEPT4)
endif()
endif()

if(CMAKE_USE_PTHREADS_INIT)
Expand Down Expand Up @@ -113,7 +118,6 @@ list(APPEND RE_DEFINITIONS
if(UNIX)
list(APPEND RE_DEFINITIONS
HAVE_PWD_H
HAVE_ROUTE_LIST
HAVE_SETRLIMIT
HAVE_STRERROR_R
HAVE_STRINGS_H
Expand All @@ -126,6 +130,9 @@ if(UNIX)
if(NOT ANDROID)
list(APPEND RE_DEFINITIONS HAVE_GETIFADDRS)
endif()
if(NOT IOS)
list(APPEND RE_DEFINITIONS HAVE_ROUTE_LIST)
endif()
endif()


Expand Down
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
libre (3.13.0) unstable; urgency=medium

* version 3.13.0

-- Christian Spielberger <[email protected]> Wed, 19 Jun 2024 07:12:37 +0100

libre (3.12.0) unstable; urgency=medium

* version 3.12.0

-- Alfred E. Heggestad <[email protected]> Wed, 15 May 2024 08:37:35 +0200

libre (3.11.0) unstable; urgency=medium

* version 3.11.0
Expand Down
1 change: 1 addition & 0 deletions include/re_rtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ int rtcp_send_fir_rfc5104(struct rtp_sock *rs, uint32_t ssrc,
int rtcp_debug(struct re_printf *pf, const struct rtp_sock *rs);
void *rtcp_sock(const struct rtp_sock *rs);
int rtcp_stats(struct rtp_sock *rs, uint32_t ssrc, struct rtcp_stats *stats);
int rtcp_send_bye_packet(struct rtp_sock *rs);

/* RTCP utils */
int rtcp_encode(struct mbuf *mb, enum rtcp_type type, uint32_t count, ...);
Expand Down
2 changes: 1 addition & 1 deletion include/rem_aumix.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ int aumix_source_put(struct aumix_source *src, const int16_t *sampv,
size_t sampc);
void aumix_source_readh(struct aumix_source *src, aumix_read_h *readh);
void aumix_source_flush(struct aumix_source *src);
int aumix_debug(struct re_printf *pf, struct aumix *mix);
int aumix_debug(struct re_printf *pf, const struct aumix *mix);
2 changes: 1 addition & 1 deletion mk/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = libre
PROJECT_NUMBER = 3.12.0
PROJECT_NUMBER = 3.13.0
OUTPUT_DIRECTORY = ../re-dox
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
Expand Down
60 changes: 32 additions & 28 deletions rem/aumix/aumix.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/** Defines an Audio mixer */
struct aumix {
mtx_t mutex;
mtx_t *mutex;
cnd_t cond;
struct list srcl;
thrd_t thread;
Expand Down Expand Up @@ -62,21 +62,22 @@ static void destructor(void *arg)
{
struct aumix *mix = arg;

mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);
bool run = mix->run;
mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);

if (run) {

mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);
mix->run = false;
cnd_signal(&mix->cond);
mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);

thrd_join(mix->thread, NULL);
}

mem_deref(mix->af);
mem_deref(mix->mutex);
}


Expand All @@ -85,9 +86,9 @@ static void source_destructor(void *arg)
struct aumix_source *src = arg;

if (src->le.list) {
mtx_lock(&src->mix->mutex);
mtx_lock(src->mix->mutex);
list_unlink(&src->le);
mtx_unlock(&src->mix->mutex);
mtx_unlock(src->mix->mutex);
}

mem_deref(src->aubuf);
Expand All @@ -110,7 +111,7 @@ static int aumix_thread(void *arg)
if (!silence || !frame || !mix_frame)
goto out;

mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);

while (mix->run) {

Expand All @@ -119,13 +120,13 @@ static int aumix_thread(void *arg)

if (!mix->srcl.head) {
mix->af = mem_deref(mix->af);
cnd_wait(&mix->cond, &mix->mutex);
cnd_wait(&mix->cond, mix->mutex);
ts = 0;
}
else {
mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);
sys_usleep(4000);
mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);
}

now = tmr_jiffies();
Expand Down Expand Up @@ -243,7 +244,7 @@ static int aumix_thread(void *arg)
ts += mix->ptime;
}

mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);

out:
mem_deref(mix_frame);
Expand Down Expand Up @@ -287,9 +288,8 @@ int aumix_alloc(struct aumix **mixp, uint32_t srate,
mix->rec_sum.srate = srate;
mix->rec_sum.sampc = mix->frame_size;

err = mtx_init(&mix->mutex, mtx_plain) != thrd_success;
err = mutex_alloc(&mix->mutex);
if (err) {
err = ENOMEM;
goto out;
}

Expand Down Expand Up @@ -328,9 +328,9 @@ void aumix_recordh(struct aumix *mix, aumix_record_h *recordh)
if (!mix)
return;

mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);
mix->recordh = recordh;
mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);
}


Expand All @@ -345,9 +345,9 @@ void aumix_record_sumh(struct aumix *mix, aumix_record_h *recordh)
if (!mix)
return;

mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);
mix->record_sumh = recordh;
mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);
}


Expand Down Expand Up @@ -378,10 +378,10 @@ int aumix_playfile(struct aumix *mix, const char *filepath)
return EINVAL;
}

mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);
mem_deref(mix->af);
mix->af = af;
mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);

return 0;
}
Expand All @@ -399,7 +399,11 @@ uint32_t aumix_source_count(const struct aumix *mix)
if (!mix)
return 0;

return list_count(&mix->srcl);
mtx_lock(mix->mutex);
uint32_t count = list_count(&mix->srcl);
mtx_unlock(mix->mutex);

return count;
}


Expand Down Expand Up @@ -468,9 +472,9 @@ void aumix_source_readh(struct aumix_source *src, aumix_read_h *readh)
if (!src || !src->mix)
return;

mtx_lock(&src->mix->mutex);
mtx_lock(src->mix->mutex);
src->readh = readh;
mtx_unlock(&src->mix->mutex);
mtx_unlock(src->mix->mutex);
}


Expand Down Expand Up @@ -510,7 +514,7 @@ void aumix_source_enable(struct aumix_source *src, bool enable)

mix = src->mix;

mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);

if (enable) {
list_append(&mix->srcl, &src->le, src);
Expand All @@ -520,7 +524,7 @@ void aumix_source_enable(struct aumix_source *src, bool enable)
list_unlink(&src->le);
}

mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);
}


Expand Down Expand Up @@ -565,7 +569,7 @@ void aumix_source_flush(struct aumix_source *src)
*
* @return 0 if success, otherwise errorcode
*/
int aumix_debug(struct re_printf *pf, struct aumix *mix)
int aumix_debug(struct re_printf *pf, const struct aumix *mix)
{
struct le *le;
int err = 0;
Expand All @@ -574,7 +578,7 @@ int aumix_debug(struct re_printf *pf, struct aumix *mix)
return EINVAL;

re_hprintf(pf, "aumix debug:\n");
mtx_lock(&mix->mutex);
mtx_lock(mix->mutex);
LIST_FOREACH(&mix->srcl, le)
{
struct aumix_source *src = le->data;
Expand All @@ -586,6 +590,6 @@ int aumix_debug(struct re_printf *pf, struct aumix *mix)
}

out:
mtx_unlock(&mix->mutex);
mtx_unlock(mix->mutex);
return err;
}
Loading

0 comments on commit 2638c06

Please sign in to comment.