Target: Raspberry Pi 5 (BCM2712, Cortex-A76, aarch64 LP64, 8GB) & Ubuntu 24.04.
include/portable.h / src/portable.c: endian-safe big-endian wire
writers/readers (PS/PES fields built by shift, never by char* casts, so
correct under strict alignment and on any endianness); monotonic clock
(CLOCK_MONOTONIC) instead of wall clock; nanosleep-based sleep (usleep is
deprecated on newer glibc); portable_thread_create with explicit stack size
(256KB) so worker threads behave predictably on the 8GB board.PTHREAD_STACK_MIN signed-vs-unsigned comparison (would break -Werror
on both x86_64 LP64 and aarch64).PRIu64 from <inttypes.h> (LP64-safe on aarch64).common.h missing <stdint.h>/<inttypes.h> -> byte/64-bit types undefined.platform.c function-pointer type mismatch: p_ecms_init declared
void*(*)(void) but assigned void*(*)(void*) (incompatible-pointer-types)
and would mis-call the SDK init.platform.c NET_ECMS_GetLastError ? ... : ... took the address of a
function -> always true (dead ternary). Now calls the getter directly.config.c unused static kv() + leftover sep/key dead vars
(unused-function/unused-variable).main.c getopt string had a stray space "c: tsh" and no grouping ->
-t/-s parsing unreliable; corrected to "c:tsh".main.c self-test set g_cfg.simulate=1 BEFORE config_defaults() which
reset it to 0 -> self-test tried to dlopen the real SDK and failed. Reordered.stream.c push(): logged s->channel AFTER releasing s->lock ->
use-after-unlock race. Now snapshots channel/frames under the lock.stream.c / playback.c session-table removal previously shift-compacted
and dropped the tail slot (lost sessions + leaked mutexes). Now clear-in-place.stream.c stream_stats / playback.c playback_get_session /
alarm.c accessors triggered -Wmisleading-indentation (multi-if on one
line). Rebraced for clarity and warning-clean build.g_head correctly (v1.0 lost
events on wrap).isup_stub.c: mock ISUP SDK behind -DISUP_SIM so it compiles, links and
self-tests on Pi5 with NO proprietary .so. Production: drop real aarch64
libHCNetSDK.so into libs/ and make (no -DISUP_SIM).dlopen for the real SDK so the binary never hard-links
against a library that may be absent.make simulate: 0 warnings, 0 errors../...-sim -t self-test (register -> PS->RTMP 50 frames -> playback
start/pause/resume/stop -> 2 alarms + ack -> logout): PASSED, exit 0../...-sim -c config.ini -s then SIGTERM: graceful shutdown, heartbeat
thread joined, exit 0.