45#define SOFTMIX_MIN_SAMPLE_RATE 8000
48#define DEFAULT_SOFTMIX_INTERVAL 20
51#define SOFTMIX_DATALEN(rate, interval) ((rate/50) * (interval / 10))
54#define SOFTMIX_SAMPLES(rate, interval) (SOFTMIX_DATALEN(rate, interval) / 2)
57#define SOFTMIX_STAT_INTERVAL 100
66#define DEFAULT_SOFTMIX_SILENCE_THRESHOLD 2500
69#define DEFAULT_SOFTMIX_TALKING_THRESHOLD 160
71#define SOFTBRIDGE_VIDEO_DEST_PREFIX "softbridge_dest"
72#define SOFTBRIDGE_VIDEO_DEST_LEN strlen(SOFTBRIDGE_VIDEO_DEST_PREFIX)
73#define SOFTBRIDGE_VIDEO_DEST_SEPARATOR '_'
126 entry->num_times_requested = 1;
134 if (
entry->trans_pvt) {
137 if (
entry->out_frame) {
146 memset(trans_helper, 0,
sizeof(*trans_helper));
165 if (
entry->trans_pvt) {
219 ++
entry->num_times_requested;
245 entry->num_times_requested++;
249 if (!
entry->trans_pvt && (
entry->num_times_requested > 1)) {
277 if (!
entry->num_times_requested) {
283 if (
entry->out_frame) {
290 if (
entry->num_times_requested == 1 &&
entry->trans_pvt) {
298 entry->num_times_requested = 0;
309#ifdef BINAURAL_RENDERING
344 if (set_binaural == 1) {
346 }
else if (set_binaural == 0) {
352 if (binaural_pos_id != -1) {
355 if (is_announcement != -1) {
375 if (set_binaural == 1 || (set_binaural == -1 && sc->
binaural == 1)) {
377 }
else if (set_binaural == 0) {
383 if (setup_fail || !sc->
dsp) {
417#ifdef BINAURAL_RENDERING
467 int source_channel_stream_position)
469 char *dest_video_name;
470 size_t dest_video_name_len;
479 dest_video_name_len += strlen(source_channel_name) + 1;
480 if (source_channel_stream_position != -1) {
481 dest_video_name_len += 11;
484 dest_video_name =
ast_alloca(dest_video_name_len);
485 if (source_channel_stream_position != -1) {
487 snprintf(dest_video_name, dest_video_name_len,
"%s%c%s%c%d",
490 source_channel_stream_position);
493 snprintf(dest_video_name, dest_video_name_len,
"%s%c%s",
495 source_channel_name);
504 const char *channel_name,
const char *sdp_label,
507 char *stream_clone_name =
NULL;
544 const char *channel_name,
const char *sdp_label,
648 if (participant == joiner) {
672 if (participant == joiner) {
687 ast_trace(-1,
"%s/%s: Couldn't request topology change\n",
700 int set_binaural = 0;
705 int skip_binaural_output = 1;
707 int is_announcement = 0;
708 int samplerate_change;
729 skip_binaural_output = 0;
736 if (!skip_binaural_output) {
758 bridge_channel, 0, set_binaural, pos_id, is_announcement);
766 ast_debug(1,
"Channel %s simulating UNHOLD for bridge softmix join.\n",
776 const char *channel_name)
779 int stream_removed = 0;
791 return stream_removed;
889 int video_src_priority;
897 if (video_src_priority == 1) {
910 if (video_src_priority == 1) {
912 int echo = num_src > 1 ? 0 : 1;
915 }
else if (video_src_priority == 2) {
942 int totalsilence = 0;
951 char update_talking = -1;
968 ast_debug(1,
"Channel %s wrote unexpected format into bridge. Got %s, expected %s.\n",
995 if (totalsilence < silence_threshold) {
1023 if (update_talking != -1) {
1124 if (!source_video) {
1141 if (participant == source) {
1148 if (!original_topology) {
1352 ast_log(
LOG_ERROR,
"Synchronous bridge action written to a softmix bridge.\n");
1367 softmix_data->
bitrate = bitrate;
1376 if (bitrate < softmix_data->bitrate) {
1377 softmix_data->
bitrate = bitrate;
1381 if (bitrate > softmix_data->
bitrate) {
1382 softmix_data->
bitrate = bitrate;
1447 if (bitrate < collector->
bitrate) {
1535 exp = exp > 18 ? exp - 18 : 0;
1546 if (bridge_num == -1) {
1564 int channel_native_rate;
1577 }
else if (softmix_data->
internal_rate < channel_native_rate) {
1591 }
else if (softmix_data->
internal_rate == channel_native_rate) {
1609 if (binaural_active) {
1624 ast_debug(1,
"Locking at new rate. Bridge changed from %u to %u.\n",
1633 ast_debug(1,
"Locking at new maximum rate. Bridge changed from %u to %u.\n",
1641 int best_index = -1;
1649 if (best_index == -1
1665 }
else if (best_index == -1) {
1679 ast_debug(1,
"Multiple above internal rate. Bridge changed from %u to %u.\n",
1685 ast_debug(1,
"All below internal rate. Bridge changed from %u to %u.\n",
1694 unsigned int starting_num_entries,
unsigned int binaural_active)
1696 memset(mixing_array, 0,
sizeof(*mixing_array));
1702 if (binaural_active) {
1713 unsigned int binaural_active)
1716 if (binaural_active) {
1722 unsigned int num_entries,
unsigned int binaural_active)
1734 if (binaural_active) {
1760#ifdef BINAURAL_RENDERING
1764 unsigned int stat_iteration_counter = 0;
1766 int update_all_rates = 0;
1779 goto softmix_cleanup;
1792 int remb_update = 0;
1800 "Bridge %s: Conference mixing error, requested mixing length greater than mixing buffer.\n",
1802 goto softmix_cleanup;
1809 goto softmix_cleanup;
1817 if (!stat_iteration_counter) {
1818 memset(&stats, 0,
sizeof(stats));
1824 if (update_all_rates) {
1828#ifdef BINAURAL_RENDERING
1850 if (update_all_rates) {
1856 if (!stat_iteration_counter) {
1868#ifdef BINAURAL_RENDERING
1881 memset(
buf, 0, softmix_datalen);
1882 for (idx = 0; idx < mixing_array.
used_entries; ++idx) {
1883 for (x = 0; x < softmix_samples; ++x) {
1888#ifdef BINAURAL_RENDERING
1889 binaural_mixing(bridge, softmix_data, &mixing_array, bin_buf, ann_buf);
1905 "Replace softmix channel slin format");
1906#ifdef BINAURAL_RENDERING
1910 softmix_samples,
buf);
1938 update_all_rates = 0;
1939 if (!stat_iteration_counter) {
1944 stat_iteration_counter--;
1955 goto softmix_cleanup;
1964 update_all_rates = 1;
1997 while (!softmix_data->
stop) {
2002 if (!softmix_data->
stop) {
2011#ifndef BINAURAL_RENDERING
2029 "binaural processing, Will only process mono audio.\n",
2056 if (softmix_data->
timer) {
2072 softmix_data =
ast_calloc(1,
sizeof(*softmix_data));
2073 if (!softmix_data) {
2080 if (!softmix_data->
timer) {
2089#ifdef BINAURAL_RENDERING
2122 if (!softmix_data) {
2127 softmix_data->
stop = 1;
2138 if (!softmix_data) {
2144 softmix_data->
stop = 1;
2153#ifdef BINAURAL_RENDERING
2189 if (
is_video_dest(stream, source_channel_name, source_channel_stream_position)) {
2234 size_t bridge_stream_position)
2263 size_t removed_streams_count = 0;
2272 if (!added_streams) {
2300 removed_streams[removed_streams_count++] = index;
2306 new_stream, index)) {
2316 removed_streams[removed_streams_count++] = index;
2324 new_stream, index)) {
2386 SCOPE_ENTER(4,
"%s/%s: Old participant topology %s\n",
2391 if (participant == bridge_channel) {
2414 for (removed_stream = 0; removed_stream < removed_streams_count; ++removed_stream) {
2416 removed_streams[removed_stream])) {
2417 ast_trace(-1,
"%s/%s: Removing stream %s\n",
2426 SCOPE_EXIT(
"%s/%s: New participant topology %s\n",
2593#ifdef TEST_FRAMEWORK
2594struct stream_parameters {
2600static struct ast_stream_topology *build_topology(
const struct stream_parameters *params,
size_t num_streams)
2610 for (i = 0; i < num_streams; ++i) {
2639static int validate_stream(
struct ast_test *
test,
struct ast_stream *stream,
2640 const struct stream_parameters *params)
2677 const struct stream_parameters *params,
size_t num_streams)
2687 for (i = 0; i < num_streams; ++i) {
2699 static const struct stream_parameters bob_streams[] = {
2703 static const struct stream_parameters alice_streams[] = {
2707 static const struct stream_parameters alice_dest_stream = {
2710 static const struct stream_parameters bob_dest_stream = {
2718 info->name =
"sfu_append_source_streams";
2719 info->category =
"/bridges/bridge_softmix/";
2720 info->summary =
"Test appending of video streams";
2722 "This tests does stuff.";
2728 topology_alice = build_topology(alice_streams,
ARRAY_LEN(alice_streams));
2729 if (!topology_alice) {
2733 topology_bob = build_topology(bob_streams,
ARRAY_LEN(bob_streams));
2734 if (!topology_bob) {
2749 if (validate_original_streams(
test, topology_alice, alice_streams,
ARRAY_LEN(alice_streams))) {
2768 if (validate_original_streams(
test, topology_bob, bob_streams,
ARRAY_LEN(bob_streams))) {
2787 static const struct stream_parameters params[] = {
2793 static const struct {
2794 const char *channel_name;
2796 int params_index[4];
2797 } removal_results[] = {
2798 {
"PJSIP/Bob-00000001", 4, { 0, 1, 2, 3 }, },
2799 {
"PJSIP/Edward-00000004", 4, { 0, 1, 2, 3 }, },
2800 {
"", 4, { 0, 1, 2, 3 }, },
2807 info->name =
"sfu_remove_destination_streams";
2808 info->category =
"/bridges/bridge_softmix/";
2809 info->summary =
"Test removal of destination video streams";
2811 "This tests does stuff.";
2817 orig = build_topology(params,
ARRAY_LEN(params));
2823 for (i = 0; i <
ARRAY_LEN(removal_results); ++i) {
2834 for (j = 0; j < removal_results[i].num_streams; ++j) {
2841 orig_index = removal_results[i].params_index[j];
2858 if (
is_video_dest(actual, removal_results[i].channel_name, -1) &&
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_realloc(p, len)
A wrapper for realloc()
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
@ AO2_ALLOC_OPT_LOCK_NOLOCK
#define ao2_t_replace(dst, src, tag)
#define ao2_replace(dst, src)
Replace one object reference with another cleaning up the original.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_alloc_options(data_size, destructor_fn, options)
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
#define ast_bridge_unlock(bridge)
Unlock the bridge.
@ AST_BRIDGE_VIDEO_SFU_REMB_LOWEST
@ AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST_ALL
@ AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE
@ AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST
@ AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE_ALL
@ AST_BRIDGE_VIDEO_SFU_REMB_FORCE
@ AST_BRIDGE_VIDEO_SFU_REMB_LOWEST_ALL
int ast_bridge_number_video_src(struct ast_bridge *bridge)
Returns the number of video sources currently active in the bridge.
@ AST_BRIDGE_CAPABILITY_MULTIMIX
@ AST_BRIDGE_VIDEO_MODE_SINGLE_SRC
@ AST_BRIDGE_VIDEO_MODE_TALKER_SRC
@ AST_BRIDGE_VIDEO_MODE_NONE
@ AST_BRIDGE_VIDEO_MODE_SFU
#define ast_bridge_lock(bridge)
Lock the bridge.
void ast_bridge_update_talker_src_video_mode(struct ast_bridge *bridge, struct ast_channel *chan, int talker_energy, int is_keyframe)
Update information about talker energy for talker src video mode.
int ast_bridge_is_video_src(struct ast_bridge *bridge, struct ast_channel *chan)
Determine if a channel is a video src for the bridge.
int ast_bridge_queue_everyone_else(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
Queue the given frame to everyone else.
#define ast_bridge_channel_unlock(bridge_channel)
Unlock the bridge_channel.
int ast_bridge_channel_notify_talking(struct ast_bridge_channel *bridge_channel, int started_talking)
Lets the bridging indicate when a bridge channel has stopped or started talking.
void ast_bridge_channel_stream_map(struct ast_bridge_channel *bridge_channel)
Maps a channel's stream topology to and from the bridge.
#define ast_bridge_channel_lock(bridge_channel)
Lock the bridge_channel.
@ BRIDGE_CHANNEL_STATE_END
int ast_bridge_channel_queue_frame(struct ast_bridge_channel *bridge_channel, struct ast_frame *fr)
Write a frame to the specified bridge_channel.
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause)
Set bridge channel state to leave bridge (if not leaving already).
static void remb_collect_report_all(struct ast_bridge *bridge, struct softmix_bridge_data *softmix_data, float bitrate)
static void gather_softmix_stats(struct softmix_stats *stats, const struct softmix_bridge_data *softmix_data, struct ast_bridge_channel *bridge_channel)
static void remb_collect_report(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct softmix_bridge_data *softmix_data, struct softmix_channel *sc)
#define SOFTMIX_MIN_SAMPLE_RATE
static int append_all_streams(struct ast_stream_topology *dest, const struct ast_stream_topology *source)
static void softmix_process_write_audio(struct softmix_translate_helper *trans_helper, struct ast_format *raw_write_fmt, struct softmix_channel *sc, unsigned int default_sample_size)
static struct ast_bridge_technology softmix_bridge
static void softmix_bridge_data_destroy(struct softmix_bridge_data *softmix_data)
static int append_source_stream(struct ast_stream_topology *dest, const char *channel_name, const char *sdp_label, struct ast_stream *stream, int index)
static void remb_enable_collection(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, size_t bridge_stream_position)
Setup REMB collection for a particular bridge stream and channel.
static struct softmix_translate_helper_entry * softmix_translate_helper_entry_alloc(struct ast_format *dst)
static int is_video_source(const struct ast_stream *stream)
Determine if a stream is a video source stream.
static void remb_send_report(struct ast_bridge_channel *bridge_channel, struct softmix_bridge_data *softmix_data, struct softmix_channel *sc)
static void * softmix_translate_helper_free_entry(struct softmix_translate_helper_entry *entry)
static void softmix_translate_helper_destroy(struct softmix_translate_helper *trans_helper)
static struct softmix_remb_collector * remb_collector_alloc(void)
Allocate a REMB collector.
static void softmix_bridge_write_voice(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
static unsigned int analyse_softmix_stats(struct softmix_stats *stats, struct softmix_bridge_data *softmix_data, int binaural_active)
static void softmix_mixing_array_destroy(struct softmix_mixing_array *mixing_array, unsigned int binaural_active)
static int remove_destination_streams(struct ast_stream_topology *topology, const char *channel_name)
#define SOFTMIX_DATALEN(rate, interval)
Size of the buffer used for sample manipulation.
#define SOFTMIX_SAMPLES(rate, interval)
Number of samples we are dealing with.
static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Function called when a channel is joined into the bridge.
static int softmix_mixing_array_init(struct softmix_mixing_array *mixing_array, unsigned int starting_num_entries, unsigned int binaural_active)
static int is_video_dest(const struct ast_stream *stream, const char *source_channel_name, int source_channel_stream_position)
Determine if a stream is a video destination stream.
static int append_source_streams(struct ast_stream_topology *dest, const char *channel_name, const char *sdp_label, const struct ast_stream_topology *source)
static int remove_all_original_streams(struct ast_stream_topology *dest, const struct ast_stream_topology *source, const struct ast_stream_topology *original)
static void softmix_bridge_check_voice(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
static void softmix_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Function called when a channel leaves the bridge.
static void softmix_translate_helper_cleanup(struct softmix_translate_helper *trans_helper)
static int16_t * softmix_process_read_audio(struct softmix_channel *sc, unsigned int num_samples)
static void softmix_bridge_stream_sources_update(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct softmix_channel *sc)
static void softmix_bridge_stop(struct ast_bridge *bridge)
#define SOFTMIX_STAT_INTERVAL
Number of mixing iterations to perform between gathering statistics.
static void softmix_bridge_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Function called when a channel is unsuspended from the bridge.
#define DEFAULT_SOFTMIX_TALKING_THRESHOLD
static void * softmix_mixing_thread(void *data)
static void softmix_bridge_write_rtcp(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
static void set_softmix_bridge_data(int rate, int interval, struct ast_bridge_channel *bridge_channel, int reset, int set_binaural, int binaural_pos_id, int is_announcement)
static void softmix_pass_video_top_priority(struct ast_bridge *bridge, struct ast_frame *frame)
static void sfu_topologies_on_source_change(struct ast_bridge *bridge, struct ast_bridge_channel *source)
#define DEFAULT_SOFTMIX_SILENCE_THRESHOLD
Default time in ms of silence necessary to declare talking stopped by the bridge.
static void softmix_translate_helper_change_rate(struct softmix_translate_helper *trans_helper, unsigned int sample_rate)
static void softmix_poke_thread(struct softmix_bridge_data *softmix_data)
#define SOFTBRIDGE_VIDEO_DEST_LEN
static int softmix_mixing_array_grow(struct softmix_mixing_array *mixing_array, unsigned int num_entries, unsigned int binaural_active)
#define SOFTBRIDGE_VIDEO_DEST_PREFIX
static void sfu_topologies_on_join(struct ast_bridge *bridge, struct ast_bridge_channel *joiner)
Issue channel stream topology change requests.
static void softmix_bridge_destroy(struct ast_bridge *bridge)
Function called when a bridge is destroyed.
static int load_module(void)
#define SOFTBRIDGE_VIDEO_DEST_SEPARATOR
static int softmix_bridge_write_control(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
static void softmix_bridge_stream_topology_changed(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
stream_topology_changed callback
static void softmix_bridge_write_video(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
static int softmix_mixing_loop(struct ast_bridge *bridge)
Mixing loop.
static int unload_module(void)
#define DEFAULT_SOFTMIX_INTERVAL
Interval at which mixing will take place. Valid options are 10, 20, and 40.
static int sfu_topologies_on_leave(struct ast_bridge_channel *leaver, struct ast_bridge_channels_list *participants)
static int softmix_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
static void softmix_translate_helper_init(struct softmix_translate_helper *trans_helper, unsigned int sample_rate)
static int softmix_bridge_create(struct ast_bridge *bridge)
Function called when a bridge is created.
static void clear_talking(struct ast_bridge_channel *bridge_channel)
static void map_source_to_destinations(const char *source_channel_name, size_t bridge_stream_position, struct ast_bridge_channels_list *participants, int source_channel_stream_position)
Map a source stream to all of its destination streams.
static void softmix_bridge_write_text(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
int set_binaural_data_join(struct convolve_data *data, unsigned int default_sample_size)
Joins a channel into a virtual enviroment build with the help of binaural synthesis.
void create_binaural_frame(struct ast_bridge_channel *bridge_channel, struct softmix_channel *sc, int16_t *bin_buf, int16_t *ann_buf, unsigned int softmix_datalen, unsigned int softmix_samples, int16_t *buf)
Creates a frame out of binaural audio data.
void softmix_process_write_binaural_audio(struct softmix_channel *sc, unsigned int default_sample_size)
Writes the binaural audio to a channel.
void binaural_mixing(struct ast_bridge *bridge, struct softmix_bridge_data *softmix_data, struct softmix_mixing_array *mixing_array, int16_t *bin_buf, int16_t *ann_buf)
Mixes all binaural audio data contained in the mixing array.
void add_binaural_mixing(struct ast_bridge *bridge, struct softmix_bridge_data *softmix_data, unsigned int softmix_samples, struct softmix_mixing_array *mixing_array, struct softmix_channel *sc, const char *channel_name)
Processes audio data with the binaural synthesis and adds the result to the mixing array.
int init_convolve_data(struct convolve_data *data, unsigned int default_sample_size)
Preinits a specific number of channels (CONVOLVE_CHANNEL_PREALLOC) at the beginning of a conference.
void check_binaural_position_change(struct ast_bridge *bridge, struct softmix_bridge_data *softmix_data)
Checks if a position change in the virtual enviroment is requested by one of the participants.
void free_convolve_data(struct convolve_data *data)
Frees all channels and data needed for binaural audio processing.
void set_binaural_data_leave(struct convolve_data *data, unsigned int pos, unsigned int default_sample_size)
Removes a channel from the binaural conference bridge. Marks the position in the virtual room as unus...
Multi-party software based channel mixing (header)
#define BINAURAL_MIXING_INTERVAL
#define SOFTMIX_BINAURAL_SAMPLE_RATE
#define DEFAULT_ENERGY_HISTORY_LEN
@ AST_BRIDGE_PREFERENCE_BASE_MULTIMIX
#define ast_bridge_technology_register(technology)
See __ast_bridge_technology_register()
int ast_bridge_technology_unregister(struct ast_bridge_technology *technology)
Unregister a bridge technology from use.
static struct ast_timer * timer
const char * ast_channel_name(const struct ast_channel *chan)
int ast_channel_request_stream_topology_change(struct ast_channel *chan, struct ast_stream_topology *topology, void *change_source)
Request that the stream topology of a channel change.
struct ast_format * ast_channel_rawreadformat(struct ast_channel *chan)
int ast_set_read_format_path(struct ast_channel *chan, struct ast_format *raw_format, struct ast_format *core_format)
Set specific read path on channel.
#define ast_channel_lock(chan)
int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception)
Waits for input on an fd.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
int ast_set_write_format_interleaved_stereo(struct ast_channel *chan, struct ast_format *format)
Sets write format for a channel. All internal data will than be handled in an interleaved format....
struct ast_format * ast_channel_rawwriteformat(struct ast_channel *chan)
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
int ast_channel_hold_state(const struct ast_channel *chan)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
#define ast_channel_unlock(chan)
ast_media_type
Types of media.
const char * ast_codec_media_type2str(enum ast_media_type type)
Conversion function to take a media type and turn it into a string.
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold)
Set the minimum average magnitude threshold to determine talking by the DSP.
void ast_dsp_free(struct ast_dsp *dsp)
struct ast_dsp * ast_dsp_new_with_rate(unsigned int sample_rate)
Allocates a new dsp with a specific internal sample rate used during processing.
int ast_dsp_silence_with_energy(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence, int *frames_energy)
Process the audio frame for silence.
static struct formats formats
#define SCOPE_EXIT_LOG(__log_level,...)
#define SCOPE_EXIT_RTN(...)
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_ENTER(level,...)
#define SCOPE_EXIT_EXPR(__expr,...)
#define SCOPE_EXIT_LOG_RTN(__log_level,...)
#define ast_trace(level,...)
const char * ast_msg_data_get_attribute(struct ast_msg_data *msg, enum ast_msg_data_attribute_type attribute_type)
Get attribute from ast_msg_data.
char * ast_frame_type2str(enum ast_frame_type frame_type, char *ftype, size_t len)
Copy the discription of a frame type into the provided string.
@ AST_FRAME_BRIDGE_ACTION_SYNC
@ AST_FRAME_BRIDGE_ACTION
@ AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED
#define DEBUG_ATLEAST(level)
#define ast_debug(level,...)
Log a DEBUG message.
int ast_callid_threadassoc_add(ast_callid callid)
Adds a known callid to thread storage of the calling thread.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define ast_cond_destroy(cond)
#define ast_cond_wait(cond, mutex)
#define AST_PTHREADT_NULL
#define ast_cond_init(cond, attr)
#define ast_mutex_init(pmutex)
#define ast_mutex_unlock(a)
#define ast_mutex_destroy(a)
#define ast_mutex_lock(a)
#define ast_cond_signal(cond)
Out-of-call text message support.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static void * cleanup(void *unused)
#define AST_RTP_RTCP_PSFB
#define AST_RTP_RTCP_FMT_REMB
int ast_slinfactory_init_with_format(struct ast_slinfactory *sf, struct ast_format *slin_out)
Initialize a slinfactory.
unsigned int ast_slinfactory_available(const struct ast_slinfactory *sf)
Retrieve number of samples currently in a slinfactory.
int ast_slinfactory_read(struct ast_slinfactory *sf, short *buf, size_t samples)
Read samples from a slinfactory.
void ast_slinfactory_flush(struct ast_slinfactory *sf)
Flush the contents of a slinfactory.
int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f)
Feed audio into a slinfactory.
void ast_slinfactory_destroy(struct ast_slinfactory *sf)
Destroy the contents of a slinfactory.
struct ast_stream_topology * ast_stream_topology_alloc(void)
Create a stream topology.
const char * ast_stream_to_str(const struct ast_stream *stream, struct ast_str **buf)
Get a string representing the stream for debugging/display purposes.
struct ast_stream * ast_stream_alloc(const char *name, enum ast_media_type type)
Create a new media stream representation.
int ast_stream_topology_set_stream(struct ast_stream_topology *topology, unsigned int position, struct ast_stream *stream)
Set a specific position in a topology.
const char * ast_stream_get_name(const struct ast_stream *stream)
Get the name of a stream.
int ast_stream_set_metadata(struct ast_stream *stream, const char *m_key, const char *value)
Set a stream metadata value.
@ AST_STREAM_STATE_RECVONLY
Set when the stream is receiving media only.
@ AST_STREAM_STATE_INACTIVE
Set when the stream is not sending OR receiving media.
@ AST_STREAM_STATE_REMOVED
Set when the stream has been removed/declined.
@ AST_STREAM_STATE_SENDRECV
Set when the stream is sending and receiving media.
@ AST_STREAM_STATE_SENDONLY
Set when the stream is sending media only.
const char * ast_stream_state2str(enum ast_stream_state state)
Convert the state of a stream into a string.
void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state)
Set the state of a stream.
int ast_stream_topology_append_stream(struct ast_stream_topology *topology, struct ast_stream *stream)
Append a stream to the topology.
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
struct ast_stream * ast_stream_clone(const struct ast_stream *stream, const char *name)
Create a deep clone of an existing stream.
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream)
Get the current state of a stream.
enum ast_media_type ast_stream_get_type(const struct ast_stream *stream)
Get the media type of a stream.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
void ast_stream_set_formats(struct ast_stream *stream, struct ast_format_cap *caps)
Set the current negotiated formats of a stream.
void ast_stream_free(struct ast_stream *stream)
Destroy a media stream representation.
const struct ast_format_cap * ast_stream_get_formats(const struct ast_stream *stream)
Get the current negotiated formats of a stream.
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_tmp(init_len, __expr)
Provides a temporary ast_str and returns a copy of its buffer.
#define ast_str_alloca(init_len)
Structure that contains information regarding a channel in a bridge.
struct ast_vector_int to_bridge
void * tech_pvt
Private information unique to the bridge technology.
struct ast_bridge_channel::@198 stream_map
struct ast_format * write_format
struct ast_bridge * bridge
Bridge this channel is participating in.
struct ast_bridge_features * features
struct ast_channel * chan
struct ast_vector_int to_channel
struct ast_bridge_tech_optimizations tech_args
unsigned int send_sdp_label
unsigned int maximum_sample_rate
The maximum sample rate softmix uses to mix channels.
unsigned int internal_sample_rate
The internal sample rate softmix uses to mix channels.
unsigned int binaural_active
struct ast_bridge_video_mode video_mode
unsigned int internal_mixing_interval
The mixing interval indicates how quickly softmix mixing should occur to mix audio.
unsigned int silence_threshold
unsigned int talking_threshold
unsigned int drop_silence
Structure that is the essence of a bridge technology.
unsigned int video_update_discard
union ast_bridge_video_mode::@189 mode_data
enum ast_bridge_video_mode_type mode
struct ast_bridge_video_sfu_data sfu_data
unsigned int remb_send_interval
enum ast_bridge_video_sfu_remb_behavior remb_behavior
Structure that contains information about a bridge.
struct ast_bridge_softmix softmix
const ast_string_field uniqueid
struct ast_bridge_channels_list channels
unsigned int num_channels
unsigned int frame_ending
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
Structure used to transport a message through the frame core.
An object that represents data received in a feedback report.
struct ast_rtp_rtcp_feedback_remb remb
Support for dynamic strings.
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
Integer vector definition.
unsigned int internal_rate
struct convolve_data convolve
struct ast_bridge * bridge
Bridge pointer passed to the softmix mixing thread.
struct timeval last_video_update
unsigned int binaural_init
struct timeval last_remb_update
unsigned int default_sample_size
unsigned int internal_mixing_interval
struct softmix_bridge_data::@102 remb_collectors
Structure which contains per-channel mixing information.
unsigned int talking
TRUE if a channel is talking.
struct ast_stream_topology * topology
struct softmix_remb_collector * remb_collector
struct softmix_channel::@101 video_sources
unsigned int binaural_pos
short final_buf[MAX_DATALEN]
short our_buf[MAX_DATALEN]
struct ast_format * read_slin_format
unsigned int is_announcement
struct ast_slinfactory factory
struct video_follow_talker_data video_talker
struct ast_frame write_frame
struct ast_rtp_rtcp_feedback_remb remb
unsigned int used_entries
struct convolve_channel_pair ** chan_pairs
unsigned int max_num_entries
struct ast_rtp_rtcp_feedback feedback
unsigned int sample_rates[16]
unsigned int num_above_internal_rate
unsigned int num_channels[16]
unsigned int highest_supported_rate
unsigned int num_above_maximum_rate
unsigned int num_at_internal_rate
unsigned int maximum_rate
struct softmix_translate_helper_entry::@99 entry
struct ast_trans_pvt * trans_pvt
struct ast_format * dst_format
struct ast_frame * out_frame
struct softmix_translate_helper::@100 entries
struct ast_format * slin_src
int energy_history[DEFAULT_ENERGY_HISTORY_LEN]
int energy_history_cur_slot
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
#define AST_TEST_DEFINE(hdr)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
void ast_timer_close(struct ast_timer *handle)
Close an opened timing handle.
int ast_timer_ack(const struct ast_timer *handle, unsigned int quantity)
Acknowledge a timer event.
int ast_timer_set_rate(const struct ast_timer *handle, unsigned int rate)
Set the timing tick rate.
struct ast_timer * ast_timer_open(void)
Open a timer.
int ast_timer_fd(const struct ast_timer *handle)
Get a poll()-able file descriptor for a timer.
struct ast_frame * ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, int consume)
translates one or more frames Apply an input frame into the translator and receive zero or one output...
void ast_translator_free_path(struct ast_trans_pvt *tr)
Frees a translator path Frees the given translator path structure.
struct ast_trans_pvt * ast_translator_build_path(struct ast_format *dest, struct ast_format *source)
Builds a translator path Build a path (possibly NULL) from source to dest.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static force_inline void ast_slinear_saturated_subtract(short *input, short *value)
#define ast_pthread_create(a, b, c, d)
static force_inline void ast_slinear_saturated_add(short *input, short *value)
Vector container support.
#define AST_VECTOR_REPLACE(vec, idx, elem)
Replace an element at a specific position in a vector, growing the vector if needed.
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define AST_VECTOR_GET_INDEX_NTH(vec, nth, value, cmp)
Get the nth index from a vector that matches the given comparison.
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
#define AST_VECTOR_ELEM_DEFAULT_CMP(elem, value)
Default comparator for AST_VECTOR_REMOVE_ELEM_UNORDERED()
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.