From e2e4d8f401fb9cce92395fa88b40b1e4e080c7c6 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 26 Aug 2025 14:18:51 -0400 Subject: [PATCH] MT#55283 fix DB metadata output Delay writing of call DB entry until a metadata has been set, even if empty. This is so that we can know whether "skip DB" was set or not. Check DB entry status with every event, not just when streams are created. Stream may get created before all relevant data for DB entries is there. Change-Id: I4834c83d83cd367c9570840d7c57e9a3223c195f --- recording-daemon/db.c | 2 ++ recording-daemon/metafile.c | 8 ++++---- recording-daemon/packet.c | 13 ++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/recording-daemon/db.c b/recording-daemon/db.c index 36fa42373..b780348cd 100644 --- a/recording-daemon/db.c +++ b/recording-daemon/db.c @@ -258,6 +258,8 @@ static void db_do_call_id(metafile_t *mf) { return; if (mf->skip_db) return; + if (!mf->metadata) + return; MYSQL_BIND b[2]; my_cstr(&b[0], mf->call_id); diff --git a/recording-daemon/metafile.c b/recording-daemon/metafile.c index 37b9bccca..f49b08bf3 100644 --- a/recording-daemon/metafile.c +++ b/recording-daemon/metafile.c @@ -101,11 +101,11 @@ static void meta_mix_file_output(metafile_t *mf) { return; } - if (mf->mix) - return; + if (!mf->mix) { + mf->mix_out = output_new_ext(mf, "mix", "mixed", "mix"); + mf->mix = mix_new(&mf->mix_lock, &mf->mix_out->sink, mf->media_rec_slots); + } - mf->mix_out = output_new_ext(mf, "mix", "mixed", "mix"); - mf->mix = mix_new(&mf->mix_lock, &mf->mix_out->sink, mf->media_rec_slots); db_do_stream(mf, mf->mix_out, NULL, 0); } diff --git a/recording-daemon/packet.c b/recording-daemon/packet.c index 8ffcdf0f1..77be65b62 100644 --- a/recording-daemon/packet.c +++ b/recording-daemon/packet.c @@ -75,11 +75,14 @@ out: dbg("Init for SSRC %s%lx%s of stream #%lu", FMT_M(ret->ssrc), stream->id); - if (mf->recording_on && !ret->output && output_single) { - char buf[16]; - snprintf(buf, sizeof(buf), "%08lx", ssrc); - tag_t *tag = tag_get(mf, stream->tag); - ret->output = output_new_ext(mf, buf, "single", tag->label); + if (mf->recording_on && output_single) { + if (!ret->output) { + char buf[16]; + snprintf(buf, sizeof(buf), "%08lx", ssrc); + tag_t *tag = tag_get(mf, stream->tag); + ret->output = output_new_ext(mf, buf, "single", tag->label); + } + db_do_stream(mf, ret->output, stream, ssrc); }