Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
fb08864
Add ffmpeg-based in-memory stream history ring (opt-in via PA_STREAM_…
Gin890 Oct 12, 2026
78a8a0b
Fix several bugs in the ffmpeg stream history ring found during review.
Gin890 Oct 12, 2026
3f84c5d
Replace the libx264 video fallback with ffmpeg's built-in LGPL mpeg4 …
Gin890 Oct 14, 2026
8d5016d
add ffmpeg library files
jw098 Oct 14, 2026
913b8cb
fix build
jw098 Oct 14, 2026
512964e
Fix the stream history ring save path and make it build against ffmpe…
Gin890 Oct 14, 2026
0e5a460
fix build
jw098 Oct 14, 2026
4c5295f
fix ffmpeg EAGAIN sign convention
jw098 Oct 14, 2026
b03df6c
install ffmpeg libraries for mac/linux CI
jw098 Oct 14, 2026
d3b26b9
attempt to fix mac CI
jw098 Oct 14, 2026
ab70e7b
fix CI
jw098 Oct 14, 2026
04a75f8
Fix ffmpeg C++ linkage, C4458 under /W4 /WX, and mac/linux pkg-config…
Gin890 Oct 14, 2026
ed744bc
fix build
jw098 Oct 14, 2026
87b0cad
Stop keying ffmpeg API differences on version macros; detect the actu…
Gin890 Oct 15, 2026
09a557c
Stream history: drop the dual ffmpeg API-generation support; enforce …
Gin890 Oct 15, 2026
d5cca56
Stream history: enforce the ffmpeg 5.1 floor instead of 7.x
Gin890 Oct 15, 2026
f57f7f5
Stream history: fall back to the next video encoder if it fails at ru…
Gin890 Oct 15, 2026
94fb593
Stream history: never free a failed hardware encoder context
Gin890 Oct 15, 2026
d857f45
fix build
jw098 Oct 15, 2026
f6de868
Stream history: fix pixel format selection on ffmpeg 7.0+, don't pois…
Gin890 Oct 15, 2026
38981bb
Stream history: use a mpeg4-compatible timebase and set the frame rate
Gin890 Oct 15, 2026
c4e8ed4
Stream history: mux from codec-parameter snapshots, not live contexts
Gin890 Oct 16, 2026
1631196
Stream history: convert H.264 from Annex B to AVCC when muxing MP4
Gin890 Oct 16, 2026
dd6f85a
Stream history: open the output file before avformat_write_header
Gin890 Oct 16, 2026
3194cca
Stream history: write a valid avcC record when muxing MP4
Gin890 Oct 17, 2026
ff1a0ef
Stream history: keep video dts strictly increasing when muxing to file
Gin890 Oct 17, 2026
a4271e4
Stream history: set the AAC encoder's sample format (FLTP) and de-int…
Gin890 Oct 17, 2026
ba5d217
Stream history: initialize the audio resampler before use
Gin890 Oct 17, 2026
52e16db
Stream history: stamp MKV packets in milliseconds and interleave the …
Gin890 Oct 17, 2026
4fdd189
Stream history: remember every runtime-failed video encoder, not just…
Gin890 Oct 17, 2026
d52def1
Stream history: drop the unused <libavutil/opt.h> include
Gin890 Oct 17, 2026
f13f88e
Stream history: log the first video packet's bytes at mux time
pa-devbot Oct 17, 2026
f77be22
adjust visibility of StreamHistory Options, depending on whether ffmp…
jw098 Oct 17, 2026
f6c51b6
minor change
jw098 Oct 17, 2026
f4a3bb8
Stream history: add the Media Foundation encoder (h264_mf) to the Win…
pa-devbot Oct 17, 2026
35ef52e
add info about the ffmpeg library
jw098 Oct 18, 2026
321b94a
Stream history: fix two documentation inaccuracies (comments only)
pa-devbot Oct 22, 2026
4155802
Stream history: deduplicate the ffmpeg >= 5.1 API check into pa_check…
pa-devbot Oct 23, 2026
e648701
move ffmpeg binary into own folder. zip the dlls.
jw098 Oct 23, 2026
c7fbf1a
Stream history: keep ffmpeg binaries in their own 3rdPartyBinaries/ff…
pa-devbot Oct 23, 2026
15ea49c
remove duplicate ffmpeg binaries
jw098 Oct 23, 2026
1b155b3
update comments
jw098 Oct 23, 2026
33a832a
Stream history: consume the audio pipeline's working stream instead o…
pa-devbot Oct 24, 2026
33ce7cc
Stream history: decouple the ring tracker from the input's shape
pa-devbot Oct 24, 2026
366ddb6
Stream history: keep one keyframe interval of headroom in the ring
pa-devbot Oct 25, 2026
5ce8e53
use Pimpl
jw098 Oct 25, 2026
75d29b0
m_-prefix the ring tracker's Data members
jw098 Oct 25, 2026
b860546
Stream history: document the ring tracker's functions
pa-devbot Oct 25, 2026
3815bce
add comments
jw098 Oct 26, 2026
982c5e3
add comments
jw098 Oct 26, 2026
2226b2d
Stream history: fix a null-encoder crash, a shutdown hang, and saves …
claude Oct 26, 2026
74b34b9
Stream history: fix A/V sync, a save/fallback race, and receive-side …
claude Oct 26, 2026
4b7c766
Stream history: move the H.264 bitstream helpers into their own file
claude Oct 26, 2026
4c6a267
Stream history: add unit tests for the H.264 bitstream helpers
claude Oct 26, 2026
38e5983
Stream history: fix two H.264 bitstream bugs found by the new tests
claude Oct 26, 2026
6db8887
Stream history: add test hooks to the ring tracker
claude Oct 26, 2026
e8445ad
Stream history: add end-to-end tests for the ring tracker
claude Oct 26, 2026
52eb339
Stream history: build and destroy the tracker outside the session lock
claude Oct 26, 2026
2a8aa5f
Stream history: recognize 3-byte start codes in H.264 Annex B extradata
claude Oct 26, 2026
b0c1ace
Stream history: test NV12 frames, audio jitter and drift, resolution …
claude Oct 26, 2026
4a219ac
Stream history: drop audio overlapping a re-sync, report the memory cap
claude Oct 27, 2026
7220132
Stream history: test that a backwards audio re-sync drops the overlap
claude Oct 27, 2026
da64f6c
Stream history: extract the Windows ffmpeg DLLs per version; fix the …
claude Oct 27, 2026
f879d64
Build instructions: install ffmpeg for the stream history
claude Oct 27, 2026
81d8771
Stream history: extract the Windows ffmpeg DLLs once, like OpenCV
claude Oct 27, 2026
2c6ff89
Stream history: fix the ffmpeg 7.0 build and correct the ring's comments
claude Oct 27, 2026
190542b
Stream history: correct and clarify comments
claude Oct 28, 2026
2f523bc
Stream history: disable video when the scaler cannot be created
claude Nov 11, 2026
ac1433d
Stream history: log each stretch of failed frame conversions
claude Nov 11, 2026
708b9c6
add comments. rename member variables for clarity
jw098 Nov 6, 2026
f69adfb
add comments
jw098 Nov 11, 2026
7d37eed
Stream history: tighten the encoder failure handling
claude Nov 11, 2026
f4d4795
add comments
jw098 Nov 11, 2026
574c543
Stream history: own ffmpeg frames and packets with unique_ptr
claude Nov 11, 2026
47c207d
Stream history: unmap the video frame with an RAII guard
claude Nov 11, 2026
8986050
Stream history: ffmpeg RAII header; RAII in mux_to_file()
claude Nov 11, 2026
ba62938
Stream history: own the encoder state with RAII members
claude Nov 11, 2026
1958d4f
add comments. minor refactor to the loop draining packets from the en…
jw098 Nov 12, 2026
5b1c650
update comments
jw098 Nov 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/cpp-ci-serial-programs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
cd Arduino-Source
sudo apt update
sudo apt install ccache clang-tools libopencv-dev libsystemd-dev libsdl3-dev
sudo apt install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev

sudo apt install ./3rdPartyBinaries/libdpp-10.1.6-linux-x64.deb

Expand All @@ -112,7 +113,7 @@ jobs:
cd Arduino-Source
# libsodium, openssl@3, opus and pkgconf are libdpp's dependencies, installed here so
# their versions can go into the libdpp cache key below.
brew install opencv@4 onnxruntime ccache libsodium openssl@3 opus pkgconf sdl3
brew install opencv@4 onnxruntime ccache libsodium openssl@3 opus pkgconf sdl3 ffmpeg

brew tap-new --no-git PA/libdpp
brew trust PA/libdpp
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ SerialPrograms/bin/
.vscode
.qtcreator

# 3rdPartyBinaries
discord_social_sdk_win/
discord_partner_sdk.dll
3rdPartyBinaries/discord_social_sdk_mac/
3rdPartyBinaries/discord_social_sdk_linux/
3rdPartyBinaries/onnxruntime-osx-arm64-*/
3rdPartyBinaries/onnxruntime-osx-x86_64-*/

opencv_world4120.dll
opencv_world4120d.dll
3rdPartyBinaries/ffmpeg/*.dll

# macOS hidden system file
.DS_Store
Expand Down Expand Up @@ -59,8 +62,6 @@ SerialPrograms/*.lib
Resources/*
Packages/
SerialPrograms/CMakeLists.txt.user
opencv_world4120.dll
opencv_world4120d.dll

# Python cache
__pycache__
Expand Down
4 changes: 4 additions & 0 deletions 3rdParty/ffmpeg/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
LGPL build taken from:
https://github.com/btbn/ffmpeg-builds/releases/tag/autobuild-2026-10-13-13-05
version: "n9.0.2-27-g7e93014c5b-20261013"
ffmpeg-n9.0.2-27-g7e93014c5b-win64-lgpl-shared-9.0.zip
36 changes: 36 additions & 0 deletions 3rdParty/ffmpeg/libavcodec/ac3_parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* AC-3 parser prototypes
* Copyright (c) 2003 Fabrice Bellard
* Copyright (c) 2003 Michael Niedermayer
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef AVCODEC_AC3_PARSER_H
#define AVCODEC_AC3_PARSER_H

#include <stddef.h>
#include <stdint.h>

/**
* Extract the bitstream ID and the frame size from AC-3 data.
*/
int av_ac3_parse_header(const uint8_t *buf, size_t size,
uint8_t *bitstream_id, uint16_t *frame_size);


#endif /* AVCODEC_AC3_PARSER_H */
37 changes: 37 additions & 0 deletions 3rdParty/ffmpeg/libavcodec/adts_parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef AVCODEC_ADTS_PARSER_H
#define AVCODEC_ADTS_PARSER_H

#include <stddef.h>
#include <stdint.h>

#define AV_AAC_ADTS_HEADER_SIZE 7

/**
* Extract the number of samples and frames from AAC data.
* @param[in] buf pointer to AAC data buffer
* @param[out] samples Pointer to where number of samples is written
* @param[out] frames Pointer to where number of frames is written
* @return Returns 0 on success, error code on failure.
*/
int av_adts_header_parse(const uint8_t *buf, uint32_t *samples,
uint8_t *frames);

#endif /* AVCODEC_ADTS_PARSER_H */
Loading
Loading