Browse Source

TT#14008 don't open a mixed output file unless recording is on

This prevents empty mixed output files from being created when mixed
output is enabled in the config but recording isn't active for that
call.

Change-Id: I66ead89dc8a7ea80b81164b3e24d997b0df5f37e
pull/1498/head
Richard Fuchs 4 years ago
parent
commit
2137618b3c
3 changed files with 17 additions and 10 deletions
  1. +15
    -8
      daemon/recording.c
  2. +1
    -1
      include/recording.h
  3. +1
    -1
      recording-daemon/metafile.c

+ 15
- 8
daemon/recording.c View File

@ -52,7 +52,7 @@ static void proc_init(struct call *);
static void sdp_before_proc(struct recording *, const str *, struct call_monologue *, enum call_opmode);
static void sdp_after_proc(struct recording *, GString *str, struct call_monologue *, enum call_opmode opmode);
static void meta_chunk_proc(struct recording *, const char *, const str *);
static void update_flags_proc(struct call *call);
static void update_flags_proc(struct call *call, bool streams);
static void finish_proc(struct call *);
static void dump_packet_proc(struct media_packet *mp, const str *s);
static void init_stream_proc(struct packet_stream *);
@ -269,17 +269,19 @@ static void update_output_dest(struct call *call, str *output_dest) {
}
// lock must be held
static void update_flags_proc(struct call *call) {
static void update_flags_proc(struct call *call, bool streams) {
append_meta_chunk_null(call->recording, "RECORDING %u", call->recording_on ? 1 : 0);
append_meta_chunk_null(call->recording, "FORWARDING %u", call->rec_forwarding ? 1 : 0);
if (!streams)
return;
for (GList *l = call->streams.head; l; l = l->next) {
struct packet_stream *ps = l->data;
append_meta_chunk_null(call->recording, "STREAM %u FORWARDING %u",
ps->unique_id, ps->media->monologue->rec_forwarding ? 1 : 0);
}
}
static void recording_update_flags(struct call *call) {
_rm(update_flags, call);
static void recording_update_flags(struct call *call, bool streams) {
_rm(update_flags, call, streams);
}
// lock must be held
@ -288,7 +290,7 @@ void recording_start(struct call *call, const char *prefix, str *output_dest) {
if (call->recording) {
// already active
recording_update_flags(call);
recording_update_flags(call, true);
return;
}
@ -313,6 +315,11 @@ void recording_start(struct call *call, const char *prefix, str *output_dest) {
_rm(init_struct, call);
// update main call flags (global recording/forwarding on/off) to prevent recording
// features from being started when the stream info (through setup_stream) is
// propagated if recording is actually off
recording_update_flags(call, false);
// if recording has been turned on after initial call setup, we must walk
// through all related objects and initialize the recording stuff. if this
// function is called right at the start of the call, all of the following
@ -333,7 +340,7 @@ void recording_start(struct call *call, const char *prefix, str *output_dest) {
__reset_sink_handlers(ps);
}
recording_update_flags(call);
recording_update_flags(call, true);
}
void recording_stop(struct call *call) {
if (!call->recording)
@ -341,14 +348,14 @@ void recording_stop(struct call *call) {
// check if all recording options are disabled
if (call->recording_on || call->rec_forwarding) {
recording_update_flags(call);
recording_update_flags(call, true);
return;
}
for (GList *l = call->monologues.head; l; l = l->next) {
struct call_monologue *ml = l->data;
if (ml->rec_forwarding) {
recording_update_flags(call);
recording_update_flags(call, true);
return;
}
}


+ 1
- 1
include/recording.h View File

@ -71,7 +71,7 @@ struct recording_method {
void (*sdp_after)(struct recording *, GString *, struct call_monologue *,
enum call_opmode);
void (*meta_chunk)(struct recording *, const char *, const str *);
void (*update_flags)(struct call *call);
void (*update_flags)(struct call *call, bool streams);
void (*dump_packet)(struct media_packet *, const str *s);
void (*finish)(struct call *);


+ 1
- 1
recording-daemon/metafile.c View File

@ -71,7 +71,7 @@ static void meta_destroy(metafile_t *mf) {
// mf is locked
static void meta_stream_interface(metafile_t *mf, unsigned long snum, char *content) {
db_do_call(mf);
if (output_enabled && output_mixed) {
if (output_enabled && output_mixed && mf->recording_on) {
pthread_mutex_lock(&mf->mix_lock);
if (!mf->mix) {
mf->mix_out = output_new(output_dir, mf->parent, "mix", "mix");


Loading…
Cancel
Save