Skip to content

loggerd: fix audio truncation by processing remaining partial frames #35718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Jul 14, 2025

Fixes an audio truncation issue in the VideoWriter where the last portion of audio data could be lost if it didn't form a complete frame. Previously, any audio samples remaining in the buffer that were fewer than audio_codec_ctx->frame_size would be discarded during cleanup, resulting in truncated audio in the output file.

@deanlee deanlee changed the title loggerd: fix audio truncation by processin remaining partial frames loggerd: fix audio truncation by processing remaining partial frames Jul 14, 2025
@deanlee deanlee force-pushed the loggerd_fix_losing_audio_data branch from b8e2ed3 to 79fd33e Compare July 14, 2025 00:41
@deanlee deanlee marked this pull request as ready for review July 14, 2025 07:17
@adeebshihadeh
Copy link
Contributor

The buffer is so small, does this really make a difference?

@deanlee
Copy link
Contributor Author

deanlee commented Jul 15, 2025

In audio encoding, calling process_remaining_audio() is a standard practice to ensure data integrity, even when using a small buffer.

With AAC encoding at 16 kHz, skipping this step can result in the permanent loss of up to 64 ms of buffered audio. While this may not be noticeable in a single segment, it can introduce small but unwanted gaps between segments, especially when silent video frames appear in those gaps.

@adeebshihadeh adeebshihadeh merged commit 006c060 into commaai:master Jul 15, 2025
15 checks passed
@deanlee deanlee deleted the loggerd_fix_losing_audio_data branch July 16, 2025 02:01
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.

2 participants