Skip to content

Automated Pull Request#117

Open
github-actions[bot] wants to merge 585 commits intoim-masterfrom
master
Open

Automated Pull Request#117
github-actions[bot] wants to merge 585 commits intoim-masterfrom
master

Conversation

@github-actions
Copy link

@github-actions github-actions bot commented Mar 1, 2026

Merge master to im-master

CI Bot and others added 30 commits June 29, 2025 00:04
…ive (pjsip#4478)

When an audio stream is created as inactive (i.e: SDP `a=inactive` & `port != 0`), the `conf_slot` field in call info is set to 0 which is ambiguous (port 0 is sound device port in conf bridge), it should be `-1/PJSUA_INVALID_ID`.
)

- Fix compile error due to removal of VideoPreviewOpParam.window.handle.setWindow() in pjsip#4273.
- Fix truncated captured video by matching video renderer's format size to the video renderer size.
- Minor updates such as: use default video capture device (was colorbar/2), optional logging to file, add incoming call handling, indentations.
- Update gitignore for intermediate files of this project.
* Misc updates on avi writer

- Apply 'db' prefix (uncompressed) in video data chunk fourcc.
- Update AVI headers when port is destroyed, was only when file size limit is reached.
- Fix compile warnings.

The generated AVI file is now playable in VLC Media Player, but it still doesn't work in Windows Media Player.
…#4530)

Some conference operations, such as connect, disconnect, remove, are asynchronous. There are port validity checks when the request are made. When the op is being executed, there are checks too, but unfortunately in assertion forms. This patch replace the assertions with normal checks (i.e: returning error upon failure).
To resolve pjsip#4431.

Currently WAV player does not use lock, so `set_pos()` & `get_pos()` are not thread-safe. Application must manage the thread safety manually, for example by simply temporarily stopping `get_frame()` using `pjmedia_conf_configure_port()` before & after `get/set_pos()`. However this simple trick is no longer working with the asynchronous conference, so adding a lock to WAV player will be handy for app.
nanangizz and others added 30 commits March 5, 2026 15:35
* Add CLAUDE.md for AI-assisted development context

Provides project-specific instructions for Claude Code and other AI tools,
covering build/test commands, coding conventions (C89, K&R braces, pool
allocation, pj_str_t), architecture layers, module priorities, group lock
patterns, threading model, and API layer guidance.

Co-Authored-By: Claude Code

* Update copilot-instructions.md to match CLAUDE.md content

Replaces the original copilot-instructions.md with comprehensive project
context aligned with CLAUDE.md: coding conventions (C89, K&R braces, pool
allocation, pj_str_t), architecture layers, module priorities, group lock
patterns, threading model, media pipeline, and API layer guidance. Retains
Copilot-specific sections (build system details, env vars, codec list).

Co-Authored-By: Claude Code
* Reject account deletion while active calls exist

pjsua_acc_del() can be called while calls are still active on the
account, leading to use-after-free because callbacks and subsystems
continue referencing the deleted account data.

Add an active-call guard in pjsua_acc_del() that returns PJ_EBUSY if
any call slot still references the account (checking both inv and
async_call.dlg to cover calls in media transport setup). This is
checked under PJSUA_LOCK, which serializes with call setup/teardown.

In the PJSUA2 C++ layer:
- Change Call::acc from Account& to Account* to enable nullable
  semantics and fix the dangling reference on account deletion.
- Add Account::shutdown2() that throws Error on failure, giving
  applications a way to detect and handle PJ_EBUSY explicitly.
- Account::shutdown() now delegates to shutdown2() with a try-catch
  for backward compatibility.
- Account::~Account() calls shutdown2() in a try-catch; on failure,
  nulls user_data to prevent dangling pointer callbacks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address Copilot review: fix shutdown() doc, simplify asserts

- shutdown() doc: replace "fail silently" with "will not throw" to
  accurately describe the behavior (it does log errors internally).
- endpoint.cpp: simplify 3 assert lines to compare Account pointers
  directly instead of dereferencing through acc->getId(), avoiding
  theoretical dangling pointer dereference in debug builds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Refactor account deletion: add pjsua_acc_del2() with force param

Add pjsua_acc_del2() with pjsua_acc_del_param to give callers explicit
control over active-call checking. With force=false (default), it returns
PJ_EBUSY when active calls exist. With force=true, it logs a warning and
proceeds with deletion.

pjsua_acc_del() now delegates to pjsua_acc_del2(force=true), preserving
backward compatibility (always deletes).

On the C++ side, Account::shutdown() uses force=true so the destructor
always cleans up the C-layer account, fixing the resource leak where
~Account() could leave an orphaned account when PJ_EBUSY was thrown.
Account::shutdown2() respects the new AccountShutdownParam.force field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add shutdown2() suggestion in shutdown() doc

Mirror the pjsua_acc_del() doc pattern: suggest using shutdown2()
for safer behavior that checks for active calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Update third_party/gsm from 1.0-pl12 to 1.0-pl23

Update the bundled GSM 06.10 codec library from patchlevel 12 (2006) to
patchlevel 23 (2022). Notable changes:
- Fix left-shift of negative signed integer in short_term.c STEP macro
- Fix stdlib.h -> string.h include for memcpy in code.c
- Add extern "C" guards in private.h for C++ compatibility
- Fix nested comment syntax in config.h
- Whitespace cleanup across all source files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix left-shift of negative signed integers in GSM codec

Replace left-shift operators with multiplication or unsigned casts in
15 places across 6 files where signed values can be negative, which is
undefined behavior per C99 §6.5.7. Discovered by fuzz-stream with
UBSan. The upstream libgsm 1.0.23 still has these unfixed.

Files changed:
- private.h: GSM_L_MULT macro (<< 1 -> * 2)
- add.c: gsm_L_mult, gsm_L_asl, gsm_asl, gsm_L_asr, gsm_asr
- lpc.c: Autocorrelation L_ACF doubling, signal rescaling,
  Reflection_coefficients normalization
- preprocess.c: downscaling, recursive filter state, offset compensation
- rpe.c: APCM quantization and inverse quantization
- short_term.c: STEP macro in LAR decoding

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…TSan libdbus (pjsip#4835)

* Relax unittest parallel scheduling test in CI mode

In CI mode, only verify grouping constraints (exclusive tests run in
order, parallel tests appear in correct groups) without requiring exact
completion order within parallel groups. Sleep-based ordering is
unreliable on loaded CI runners, causing flaky failures like "kij"
instead of "kji" when parallel tests i and j complete in swapped order.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Work around ASan sigaltstack crash on macOS ARM64

Apple clang's ASan calls sigaltstack(SS_DISABLE) during thread exit,
which fails on macOS Sequoia ARM64 runners, crashing the process with:
  CHECK failed: sanitizer_posix_libcdep.cpp "((0)) == ((sigaltstack(...)))"

This consistently kills pjsip-test (at test 21/22) and pjsua-test
(at test 168/235) in all ASan-enabled CI jobs. Setting
ASAN_OPTIONS=use_sigaltstack=0 disables ASan's alternate signal stack
usage, avoiding the kernel-level failure.

Co-Authored-By: Claude Code

* Fix ASan PlatformUnpoisonStacks crash on macOS ARM64

Apple clang's ASan inserts __asan_handle_no_return before longjmp
(which is noreturn). On macOS ARM64, this calls PlatformUnpoisonStacks()
which fails with CHECK "AddrIsInMem(addr + size) != 0" when it cannot
determine the worker thread's stack bounds (addr=0x0).

This crashes pjsip-test during SIP parser syntax error recovery
(uri_test -> longjmp -> ASan -> CRASH). The existing workaround
ASAN_OPTIONS=use_sigaltstack=0 only addresses a different ASan crash
(sigaltstack during thread exit) and does not help here.

Fix by adding __attribute__((no_sanitize("address"))) to
pj_throw_exception_() to prevent ASan from instrumenting the longjmp
call. The function only does a thread-local lookup and a longjmp,
so no memory access needs sanitizer checking.

Co-Authored-By: Claude Code

* Fix select_test port conflict causing flaky CI failures

Use an ephemeral port (bind to port 0 + getsockname) instead of hardcoded
port 51232 to eliminate port conflicts when tests run in parallel. The old
code also had a missing pj_htons() on the port assignment and weak error
checking on socket creation. Also revert the sleep from 100ms back to 10ms
since the real fix is the ephemeral port.

Co-Authored-By: Claude Code

* Fix inv_offer_answer_test port conflict causing WSAEACCES on Windows CI

Use an ephemeral port (port 0) instead of hardcoded port 50068 for the
UDP transport in inv_offer_answer_test. Build the contact URI dynamically
from the assigned port. The hardcoded port can conflict with other tests
running in parallel or other processes on the CI runner.

Co-Authored-By: Claude Code

* Add TSan suppression for libdbus lock-order-inversion

TSan reports a potential deadlock between two internal dbus mutexes
during SDL video device initialization. This is not a PJSIP bug but
an internal libdbus locking issue triggered by the SDL2 video device
worker thread (job_thread in sdl_dev.c).

Co-Authored-By: Claude Code

* Revert "Fix ASan PlatformUnpoisonStacks crash on macOS ARM64"

This reverts commit 14a2fb4.

* Fix ASan longjmp crash on macOS ARM64 via ASAN_OPTIONS

Apple clang ASan's PlatformUnpoisonStacks() crashes when longjmp is
used in non-main threads (e.g. SIP parser error recovery via
pj_throw_exception_ -> pj_longjmp). ASan intercepts longjmp at runtime
and fails to determine the worker thread's stack bounds (addr=0x0):
  CHECK failed: asan_poisoning.cpp "AddrIsInMem(...) != 0" (0x0, 0x0)

The previous attempt using __attribute__((no_sanitize("address"))) on
pj_throw_exception_() did not work because ASan intercepts longjmp
globally at the libc level, not via function instrumentation.

Fix by adding detect_stack_use_after_return=0 to ASAN_OPTIONS, which
disables the fake stack that causes ASan to lose track of thread stack
bounds during longjmp.

Co-Authored-By: Claude Code

* Fix inv_offer_answer_test hang due to mismatched contact URI user

The contact URI used "inv_oa_test" as the user part, but the
on_rx_request filter checks for "inv_offer_answer_test". This caused
the incoming INVITE to be ignored and the test to hang indefinitely
waiting for inv_test.complete.

Co-Authored-By: Claude Code

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…4845)

The AUDIO link recipe line used spaces instead of a tab character,
causing "missing separator" build failure in the fuzzing CI job.

Co-Authored-By: Claude Code
* Fix ASan crash on macOS ARM64 by disabling noreturn on pj_throw_exception_

Apple Clang's ASan inserts __asan_handle_no_return before calls to
noreturn functions. On macOS ARM64 worker threads, this triggers
PlatformUnpoisonStacks() which crashes with "AddrIsInMem(addr) != 0"
(addr=0x0) because it cannot determine the thread's stack bounds.

The crash occurs when the SIP parser hits a syntax error and calls
PJ_THROW -> pj_throw_exception_ (declared noreturn) -> pj_longjmp.
The ASAN_OPTIONS=detect_stack_use_after_return=0 workaround from
PR pjsip#4835 is insufficient — it only disables fake stacks but does not
prevent __asan_handle_no_return from calling PlatformUnpoisonStacks.

Fix: conditionally remove PJ_ATTR_NORETURN (__attribute__((noreturn)))
from the clang compiler header when ASan is enabled on Apple ARM64.
This prevents the compiler from inserting the problematic
__asan_handle_no_return call at every PJ_THROW call site.

Co-Authored-By: Claude Code

* Fix ASan crash on macOS ARM64 caused by longjmp (LLVM bug)

Apple Clang ASan crashes in PlatformUnpoisonStacks() when longjmp is
called because sigaltstack() returns ss_sp=NULL with ss_flags !=
SS_DISABLE on macOS ARM64 — an LLVM compiler-rt bug.

Changes:
- cc_clang.h: disable PJ_ATTR_NORETURN on Apple ARM64 + ASan
- pjlib test.h: disable exception_test on Apple + ASan
- pjsip test.h: disable uri_test/msg_test on Apple + ASan
  (msg_test was already disabled for all ASan; narrowed to Apple-only)

These tests remain enabled on Linux ASan and all non-ASan builds.

Co-Authored-By: Claude Code
Use max(sock1, sock2) + 1 as nfds instead of PJ_IOQUEUE_MAX_HANDLES.
On POSIX, select() only monitors fds 0..nfds-1, so when socket fds
exceed PJ_IOQUEUE_MAX_HANDLES (64), select() silently ignores them
and times out. This happens on CI with ASan + parallel worker threads
where many fds are already open.

Co-Authored-By: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.