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 Aug 3, 2024
2 parents 2638c06 + 7d8ac60 commit e07c1ea
Show file tree
Hide file tree
Showing 41 changed files with 1,567 additions and 171 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ 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.14.0] - 2024-07-23

## What's Changed
* aumix: use mutex_alloc() by @alfredh in https://github.com/baresip/re/pull/1142
* sipreg/reg.c: stop retrying registers early after 401/407 by @maximilianfridrich in https://github.com/baresip/re/pull/1143
* aumix: add locking in aumix_source_count() by @alfredh in https://github.com/baresip/re/pull/1145
* test: init err in test_sip_auth_encode() by @alfredh in https://github.com/baresip/re/pull/1146
* sipreg: refactor response_handler else optimization by @sreimers in https://github.com/baresip/re/pull/1147
* vidmix: improve mutex usage by @alfredh in https://github.com/baresip/re/pull/1148
* udp/mcast: use group scopeid as interface for IPv6 by @maximilianfridrich in https://github.com/baresip/re/pull/1149
* .clangd: suppress -Wgnu-zero-variadic-macro-arguments by @maximilianfridrich in https://github.com/baresip/re/pull/1150
* ci/build: use only macos-latest by @sreimers in https://github.com/baresip/re/pull/1153
* cmake: fix resolv on FreeBSD by @sreimers in https://github.com/baresip/re/pull/1152
* test: use h264_stap_decode_annexb() by @alfredh in https://github.com/baresip/re/pull/1151
* sipsess/reply: terminate session if no (PR)ACK received after 64*T1 by @maximilianfridrich in https://github.com/baresip/re/pull/1155
* rtcp: send BYE manually by @alfredh in https://github.com/baresip/re/pull/1154
* cmake: check accept4 only on linux by @sreimers in https://github.com/baresip/re/pull/1157
* cmake: fix iOS HAVE_ROUTE_LIST and darwin dns by @sreimers in https://github.com/baresip/re/pull/1158
* test: check if header and payload is set by @alfredh in https://github.com/baresip/re/pull/1161


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


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

## What's Changed
Expand Down
9 changes: 7 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.13.0
VERSION 3.14.0
LANGUAGES C
HOMEPAGE_URL https://github.com/baresip/re
DESCRIPTION "Generic library for real-time communications"
)

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

# Pre-release identifier, comment out on a release
# Increment for breaking changes (dev2, dev3...)
Expand Down Expand Up @@ -132,6 +132,7 @@ set(HEADERS
include/re_convert.h
include/re_crc32.h
include/re_dbg.h
include/re_dd.h
include/re_dns.h
include/re_fmt.h
include/re_h264.h
Expand Down Expand Up @@ -226,6 +227,10 @@ set(SRCS

src/dbg/dbg.c

src/dd/dd.c
src/dd/dd_enc.c
src/dd/putbit.c

src/dns/client.c
src/dns/cstr.c
src/dns/dname.c
Expand Down
1 change: 0 additions & 1 deletion cmake/re-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ endif()

list(APPEND RE_DEFINITIONS
HAVE_ATOMIC
HAVE_INET6
HAVE_SELECT
)

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

* version 3.14.0

-- Sebastian Reimers <[email protected]> Tue, 23 Jul 2024 09:00:00 +0200

libre (3.13.0) unstable; urgency=medium

* version 3.13.0
Expand Down
109 changes: 109 additions & 0 deletions include/re_dd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/**
* @file re_dd.h Dependency Descriptor (DD)
*
* Copyright (C) 2010 - 2023 Alfred E. Heggestad
*/


/*
* Put bits wrapper (XXX: move to common place)
*/

struct putbit {
struct mbuf *mb;
size_t bit_pos;
};

void putbit_init(struct putbit *pb, struct mbuf *mb);
int putbit_one(struct putbit *pb, unsigned bit);
int putbit_write(struct putbit *pb, unsigned count, unsigned val);
int putbit_write_ns(struct putbit *pb, unsigned n, unsigned v);


/*
* Dependency Descriptor (DD)
*
* DT: Decode Target
* DTI: Decode Target Indication
* SID: Spatial ID
* TID: Temporal ID
*/

/* Constants. */
enum {
DD_MAX_SPATIAL_IDS = 4u,
DD_MAX_TEMPORAL_IDS = 4u,
DD_MAX_TEMPLATES = 8u,
DD_MAX_FDIFFS = 16u,
DD_MAX_DECODE_TARGETS= 16u,
DD_MAX_CHAINS = 32u,
};


/* Decode Target Indication (DTI) */
enum dd_dti {
DD_DTI_NOT_PRESENT = 0,
DD_DTI_DISCARDABLE = 1,
DD_DTI_SWITCH = 2,
DD_DTI_REQUIRED = 3,
};

enum dd_next_layer_idc {
DD_SAME_LAYER = 0,
DD_NEXT_TEMPORAL_LAYER = 1,
DD_NEXT_SPATIAL_LAYER = 2,
DD_NO_MORE_TEMPLATES = 3,
};

/*
* https://aomediacodec.github.io/av1-rtp-spec/
* #dependency-descriptor-rtp-header-extension
*/
struct dd {

/* Mandatory Descriptor Fields */
unsigned start_of_frame:1;
unsigned end_of_frame:1;
unsigned frame_dependency_template_id:6;
uint16_t frame_number;

// TODO: needed?
bool ext;

unsigned template_dependency_structure_present_flag:1;
unsigned active_decode_targets_present_flag:1;
unsigned custom_dtis_flag:1;
unsigned custom_fdiffs_flag:1;
unsigned custom_chains_flag:1;

unsigned active_decode_targets_bitmask;
unsigned template_id_offset:6;
uint8_t dt_cnt;
uint8_t template_cnt;
uint8_t max_spatial_id;

uint8_t template_spatial_id[DD_MAX_TEMPLATES];
uint8_t template_temporal_id[DD_MAX_TEMPLATES];

/* render_resolutions */
bool resolutions_present_flag;
uint16_t max_render_width_minus_1[DD_MAX_SPATIAL_IDS];
uint16_t max_render_height_minus_1[DD_MAX_SPATIAL_IDS];
uint8_t render_count;

/* type: enum dd_dti */
uint8_t template_dti[DD_MAX_TEMPLATES][DD_MAX_DECODE_TARGETS];

/* template fdiffs */
uint8_t template_fdiff[DD_MAX_TEMPLATES][DD_MAX_FDIFFS];
uint8_t template_fdiff_cnt[DD_MAX_TEMPLATES];

/* template chains */
uint8_t decode_target_protected_by[DD_MAX_DECODE_TARGETS];
uint8_t template_chain_fdiff[DD_MAX_TEMPLATES][DD_MAX_CHAINS];
uint8_t chain_cnt;
};

int dd_encode(struct mbuf *mb, const struct dd *dd);
int dd_decode(struct dd *dd, const uint8_t *buf, size_t sz);
void dd_print(const struct dd *dd);
18 changes: 18 additions & 0 deletions include/re_h264.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,21 @@ int h264_stap_encode(struct mbuf *mb, const uint8_t *frame,
size_t frame_sz);
int h264_stap_decode_annexb(struct mbuf *mb_frame, struct mbuf *mb_pkt);
int h264_stap_decode_annexb_long(struct mbuf *mb_frame, struct mbuf *mb_pkt);


/*
* Get bits wrapper
*/

struct getbit {
const uint8_t *buf;
size_t pos;
size_t end;
};

void getbit_init(struct getbit *gb, const uint8_t *buf, size_t size);
size_t getbit_get_left(const struct getbit *gb);
unsigned get_bit(struct getbit *gb);
int get_ue_golomb(struct getbit *gb, unsigned *valp);
unsigned get_bits(struct getbit *gb, unsigned n);
unsigned getbit_read_ns(struct getbit *gb, unsigned n);
1 change: 1 addition & 0 deletions include/re_sa.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ bool sa_cmp(const struct sa *l, const struct sa *r, int flag);

bool sa_is_linklocal(const struct sa *sa);
bool sa_is_loopback(const struct sa *sa);
bool sa_is_multicast(const struct sa *sa);
bool sa_is_any(const struct sa *sa);

void sa_set_scopeid(struct sa *sa, uint32_t scopeid);
Expand Down
2 changes: 2 additions & 0 deletions include/re_sip.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ void sip_set_trace_handler(struct sip *sip, sip_trace_h *traceh);
/* transport */
int sip_transp_add(struct sip *sip, enum sip_transp tp,
const struct sa *laddr, ...);
int sip_transp_add_sock(struct sip *sip, enum sip_transp tp,
bool listen, const struct sa *laddr, ...);
int sip_transp_add_websock(struct sip *sip, enum sip_transp tp,
const struct sa *laddr,
bool server, const char *cert, struct tls *tls);
Expand Down
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.13.0
PROJECT_NUMBER = 3.14.0
OUTPUT_DIRECTORY = ../re-dox
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
Expand Down
61 changes: 61 additions & 0 deletions src/av1/getbit.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* @file getbit.c Get bits helper
*
* Copyright (C) 2023 Alfred E. Heggestad
*/

#include <re.h>
#include <re_av1.h>


#define DEBUG_MODULE "av1"
#define DEBUG_LEVEL 5
#include <re_dbg.h>


void getbit_init(struct getbit *gb, const uint8_t *buf, size_t size_bits)
{
if (!gb)
return;

gb->buf = buf;
gb->pos = 0;
gb->end = size_bits;
}


size_t getbit_get_left(const struct getbit *gb)
{
if (!gb)
return 0;

if (gb->end > gb->pos)
return gb->end - gb->pos;
else
return 0;
}


unsigned get_bit(struct getbit *gb)
{
register unsigned tmp;

if (!gb)
return 0;

if (gb->pos >= gb->end) {
DEBUG_WARNING("get_bit: read past end"
" (%zu >= %zu)\n", gb->pos, gb->end);
assert(0);
return 0;
}

const uint8_t *p = gb->buf;
tmp = ((*(p + (gb->pos >> 0x3))) >> (0x7 - (gb->pos & 0x7))) & 0x1;

++gb->pos;

return tmp;
}


Loading

0 comments on commit e07c1ea

Please sign in to comment.