Merge pull request #1606 in FS/freeswitch from ~LAZEDO/freeswitch:feature/FS-11312 to master
* commit '0e0d5881444fa7af0730c56dc24ef7fc730870a1': FS-11312 [core] prevent double firing record_start event
This commit is contained in:
commit
e53c17ff68
|
@ -1145,6 +1145,7 @@ struct record_helper {
|
|||
uint32_t writes;
|
||||
uint32_t vwrites;
|
||||
const char *completion_cause;
|
||||
int start_event_sent;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1188,6 +1189,7 @@ static void send_record_stop_event(switch_channel_t *channel, switch_codec_imple
|
|||
{
|
||||
switch_event_t *event;
|
||||
|
||||
rh->start_event_sent = 0;
|
||||
if (rh->fh) {
|
||||
switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out);
|
||||
if (read_impl->actual_samples_per_second) {
|
||||
|
@ -1304,10 +1306,13 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
|||
}
|
||||
}
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file);
|
||||
switch_channel_event_set_data(channel, event);
|
||||
switch_event_fire(&event);
|
||||
if(rh->start_event_sent == 0) {
|
||||
rh->start_event_sent = 1;
|
||||
if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, event);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
}
|
||||
|
||||
rh->silence_time = switch_micro_time_now();
|
||||
|
|
Loading…
Reference in New Issue