refactor: stop passing VideoStore an audio decoder it never used

VideoStore took an AVCodecContext for the input audio and ignored it: the
member was initialised to nullptr and open() builds its own from
audio_in_stream's codecpar, with its own codec lookup, time_base and
avcodec_open2, and frees it in the destructor.

So the parameter described a relationship that did not exist, and following it
backwards -- through Monitor::GetAudioCodecContext() to the camera -- suggested
the camera's audio decoder was feeding recording. It was not.

Drop the parameter and say beside the member where the context actually comes
from.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Y6FieTwEXuLhhR4e2yiax
This commit is contained in:
Isaac ConnorandClaude Opus 5 committed 2026-10-10 09:32:17 -04:00
1 parent af0d6ddc32
commit 2baa7a37fb
3 files changed
+2 -3

No files matched your search

-1
View File
@@ -862,7 +862,6 @@ void Event::Run() {
monitor->GetVideoStream(),
monitor->GetVideoCodecContext(),
( monitor->RecordAudio() ? monitor->GetAudioStream() : nullptr ),
( monitor->RecordAudio() ? monitor->GetAudioCodecContext() : nullptr ),
monitor );
if (!videoStore->open()) {
+2 -1
View File
@@ -43,7 +43,6 @@ VideoStore::VideoStore(
AVStream *p_video_in_stream,
AVCodecContext *p_video_in_ctx,
AVStream *p_audio_in_stream,
AVCodecContext *p_audio_in_ctx,
Monitor *p_monitor
) :
chosen_codec_data(nullptr),
@@ -57,6 +56,8 @@ VideoStore::VideoStore(
video_in_stream(p_video_in_stream),
audio_in_stream(p_audio_in_stream),
audio_in_codec(nullptr),
// Opened in open() from audio_in_stream's codecpar, not handed in. The
// caller used to pass a context as well and this ignored it.
audio_in_ctx(nullptr),
audio_out_codec(nullptr),
audio_out_ctx(nullptr),
-1
View File
@@ -138,7 +138,6 @@ class VideoStore {
AVStream *video_in_stream,
AVCodecContext *video_in_ctx,
AVStream *audio_in_stream,
AVCodecContext *audio_in_ctx,
Monitor * p_monitor);
~VideoStore();
bool open();