Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Multi-party software based channel mixing. More...
#include "asterisk.h"
#include <math.h>
#include "asterisk/stream.h"
#include "asterisk/test.h"
#include "asterisk/vector.h"
#include "asterisk/message.h"
#include "bridge_softmix/include/bridge_softmix_internal.h"
Go to the source code of this file.
Data Structures | |
struct | softmix_remb_collector |
struct | softmix_stats |
struct | softmix_translate_helper |
struct | softmix_translate_helper_entry |
Macros | |
#define | DEFAULT_SOFTMIX_INTERVAL 20 |
Interval at which mixing will take place. Valid options are 10, 20, and 40. More... | |
#define | DEFAULT_SOFTMIX_SILENCE_THRESHOLD 2500 |
Default time in ms of silence necessary to declare talking stopped by the bridge. More... | |
#define | DEFAULT_SOFTMIX_TALKING_THRESHOLD 160 |
#define | SOFTBRIDGE_VIDEO_DEST_LEN strlen(SOFTBRIDGE_VIDEO_DEST_PREFIX) |
#define | SOFTBRIDGE_VIDEO_DEST_PREFIX "softbridge_dest" |
#define | SOFTBRIDGE_VIDEO_DEST_SEPARATOR '_' |
#define | SOFTMIX_DATALEN(rate, interval) ((rate/50) * (interval / 10)) |
Size of the buffer used for sample manipulation. More... | |
#define | SOFTMIX_MIN_SAMPLE_RATE 8000 /* 8 kHz sample rate */ |
#define | SOFTMIX_SAMPLES(rate, interval) (SOFTMIX_DATALEN(rate, interval) / 2) |
Number of samples we are dealing with. More... | |
#define | SOFTMIX_STAT_INTERVAL 100 |
Number of mixing iterations to perform between gathering statistics. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static unsigned int | analyse_softmix_stats (struct softmix_stats *stats, struct softmix_bridge_data *softmix_data, int binaural_active) |
static int | append_all_streams (struct ast_stream_topology *dest, const struct ast_stream_topology *source) |
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 int | append_source_streams (struct ast_stream_topology *dest, const char *channel_name, const char *sdp_label, const struct ast_stream_topology *source) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | clear_talking (struct ast_bridge_channel *bridge_channel) |
static void | gather_softmix_stats (struct softmix_stats *stats, const struct softmix_bridge_data *softmix_data, struct ast_bridge_channel *bridge_channel) |
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. More... | |
static int | is_video_source (const struct ast_stream *stream) |
Determine if a stream is a video source stream. More... | |
static int | load_module (void) |
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. More... | |
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) |
static void | remb_collect_report_all (struct ast_bridge *bridge, struct softmix_bridge_data *softmix_data, float bitrate) |
static struct softmix_remb_collector * | remb_collector_alloc (void) |
Allocate a REMB collector. More... | |
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. More... | |
static void | remb_send_report (struct ast_bridge_channel *bridge_channel, struct softmix_bridge_data *softmix_data, struct softmix_channel *sc) |
static int | remove_all_original_streams (struct ast_stream_topology *dest, const struct ast_stream_topology *source, const struct ast_stream_topology *original) |
static int | remove_destination_streams (struct ast_stream_topology *topology, const char *channel_name) |
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 | sfu_topologies_on_join (struct ast_bridge *bridge, struct ast_bridge_channel *joiner) |
Issue channel stream topology change requests. More... | |
static int | sfu_topologies_on_leave (struct ast_bridge_channel *leaver, struct ast_bridge_channels_list *participants) |
static void | sfu_topologies_on_source_change (struct ast_bridge *bridge, struct ast_bridge_channel *source) |
static void | softmix_bridge_check_voice (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
static int | softmix_bridge_create (struct ast_bridge *bridge) |
Function called when a bridge is created. More... | |
static void | softmix_bridge_data_destroy (struct softmix_bridge_data *softmix_data) |
static void | softmix_bridge_destroy (struct ast_bridge *bridge) |
Function called when a bridge is destroyed. More... | |
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. More... | |
static void | softmix_bridge_leave (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Function called when a channel leaves the bridge. More... | |
static void | softmix_bridge_stop (struct ast_bridge *bridge) |
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_stream_topology_changed (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
stream_topology_changed callback More... | |
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. More... | |
static int | softmix_bridge_write (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
static int | softmix_bridge_write_control (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
static void | softmix_bridge_write_rtcp (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
static void | softmix_bridge_write_text (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
static void | softmix_bridge_write_video (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
static void | softmix_bridge_write_voice (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
static void | softmix_mixing_array_destroy (struct softmix_mixing_array *mixing_array, unsigned int binaural_active) |
static int | softmix_mixing_array_grow (struct softmix_mixing_array *mixing_array, unsigned int num_entries, unsigned int binaural_active) |
static int | softmix_mixing_array_init (struct softmix_mixing_array *mixing_array, unsigned int starting_num_entries, unsigned int binaural_active) |
static int | softmix_mixing_loop (struct ast_bridge *bridge) |
Mixing loop. More... | |
static void * | softmix_mixing_thread (void *data) |
static void | softmix_pass_video_top_priority (struct ast_bridge *bridge, struct ast_frame *frame) |
static void | softmix_poke_thread (struct softmix_bridge_data *softmix_data) |
static int16_t * | softmix_process_read_audio (struct softmix_channel *sc, unsigned int num_samples) |
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 void | softmix_translate_helper_change_rate (struct softmix_translate_helper *trans_helper, unsigned int sample_rate) |
static void | softmix_translate_helper_cleanup (struct softmix_translate_helper *trans_helper) |
static void | softmix_translate_helper_destroy (struct softmix_translate_helper *trans_helper) |
static struct softmix_translate_helper_entry * | softmix_translate_helper_entry_alloc (struct ast_format *dst) |
static void * | softmix_translate_helper_free_entry (struct softmix_translate_helper_entry *entry) |
static void | softmix_translate_helper_init (struct softmix_translate_helper *trans_helper, unsigned int sample_rate) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Multi-party software based channel mixing" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_bridge_technology | softmix_bridge |
Multi-party software based channel mixing.
Definition in file bridge_softmix.c.
#define DEFAULT_SOFTMIX_INTERVAL 20 |
Interval at which mixing will take place. Valid options are 10, 20, and 40.
Definition at line 48 of file bridge_softmix.c.
#define DEFAULT_SOFTMIX_SILENCE_THRESHOLD 2500 |
Default time in ms of silence necessary to declare talking stopped by the bridge.
This is the time at which a channel's own audio will stop getting mixed out of its own write audio stream because it is no longer talking.
Definition at line 66 of file bridge_softmix.c.
#define DEFAULT_SOFTMIX_TALKING_THRESHOLD 160 |
Default minimum average magnitude threshold to determine talking by the DSP.
Definition at line 69 of file bridge_softmix.c.
#define SOFTBRIDGE_VIDEO_DEST_LEN strlen(SOFTBRIDGE_VIDEO_DEST_PREFIX) |
Definition at line 72 of file bridge_softmix.c.
#define SOFTBRIDGE_VIDEO_DEST_PREFIX "softbridge_dest" |
Definition at line 71 of file bridge_softmix.c.
#define SOFTBRIDGE_VIDEO_DEST_SEPARATOR '_' |
Definition at line 73 of file bridge_softmix.c.
#define SOFTMIX_DATALEN | ( | rate, | |
interval | |||
) | ((rate/50) * (interval / 10)) |
Size of the buffer used for sample manipulation.
Definition at line 51 of file bridge_softmix.c.
#define SOFTMIX_MIN_SAMPLE_RATE 8000 /* 8 kHz sample rate */ |
The minimum sample rate of the bridge.
Definition at line 45 of file bridge_softmix.c.
#define SOFTMIX_SAMPLES | ( | rate, | |
interval | |||
) | (SOFTMIX_DATALEN(rate, interval) / 2) |
Number of samples we are dealing with.
Definition at line 54 of file bridge_softmix.c.
#define SOFTMIX_STAT_INTERVAL 100 |
Number of mixing iterations to perform between gathering statistics.
Definition at line 57 of file bridge_softmix.c.
|
static |
Definition at line 2894 of file bridge_softmix.c.
|
static |
Definition at line 2894 of file bridge_softmix.c.
|
static |
Definition at line 1604 of file bridge_softmix.c.
References ARRAY_LEN, ast_debug, softmix_stats::highest_supported_rate, softmix_bridge_data::internal_rate, softmix_stats::locked_rate, softmix_stats::maximum_rate, MIN, softmix_stats::num_above_internal_rate, softmix_stats::num_above_maximum_rate, softmix_stats::num_at_internal_rate, softmix_stats::num_channels, softmix_stats::sample_rates, and SOFTMIX_BINAURAL_SAMPLE_RATE.
Referenced by softmix_mixing_loop().
|
static |
Definition at line 566 of file bridge_softmix.c.
References ast_stream_clone(), ast_stream_free(), ast_stream_get_state(), AST_STREAM_STATE_REMOVED, ast_stream_topology_append_stream(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_set_stream(), and NULL.
Referenced by sfu_topologies_on_join(), sfu_topologies_on_source_change(), and softmix_bridge_stream_sources_update().
|
static |
Definition at line 503 of file bridge_softmix.c.
References ast_asprintf, ast_free, ast_stream_clone(), ast_stream_free(), ast_stream_set_metadata(), ast_stream_set_state(), AST_STREAM_STATE_SENDONLY, ast_stream_topology_append_stream(), ast_strlen_zero(), NULL, SOFTBRIDGE_VIDEO_DEST_PREFIX, and SOFTBRIDGE_VIDEO_DEST_SEPARATOR.
Referenced by append_source_streams(), and softmix_bridge_stream_sources_update().
|
static |
Definition at line 543 of file bridge_softmix.c.
References append_source_stream(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), and is_video_source().
Referenced by sfu_topologies_on_join(), and sfu_topologies_on_source_change().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 2894 of file bridge_softmix.c.
|
static |
Definition at line 1035 of file bridge_softmix.c.
References ast_bridge_channel_notify_talking(), ast_mutex_lock, ast_mutex_unlock, ast_slinfactory_flush(), softmix_channel::factory, softmix_channel::lock, softmix_channel::talking, and ast_bridge_channel::tech_pvt.
Referenced by softmix_bridge_check_voice(), and softmix_bridge_write_control().
|
static |
Definition at line 1560 of file bridge_softmix.c.
References ARRAY_LEN, ast_channel_lock, ast_channel_rawreadformat(), ast_channel_unlock, ast_format_get_sample_rate(), ast_bridge_channel::chan, softmix_stats::highest_supported_rate, softmix_bridge_data::internal_rate, MAX, softmix_stats::maximum_rate, softmix_stats::num_above_internal_rate, softmix_stats::num_above_maximum_rate, softmix_stats::num_at_internal_rate, softmix_stats::num_channels, softmix_stats::sample_rates, and SOFTMIX_MIN_SAMPLE_RATE.
Referenced by softmix_mixing_loop().
|
static |
Determine if a stream is a video destination stream.
A source channel name can be provided to narrow this to a destination stream for a particular source channel. Further, a source stream name can be provided to narrow this to a particular source stream's destination. However, empty strings can be provided to match any destination video stream, regardless of source channel or source stream.
stream | The stream to test |
source_channel_name | The name of a source video channel to match |
source_channel_stream_position | The position of the video on the source channel |
1 | The stream is a video destination stream |
0 | The stream is not a video destination stream |
Definition at line 466 of file bridge_softmix.c.
References ast_alloca, AST_MEDIA_TYPE_VIDEO, ast_stream_get_name(), ast_stream_get_state(), ast_stream_get_type(), AST_STREAM_STATE_REMOVED, ast_strlen_zero(), SOFTBRIDGE_VIDEO_DEST_LEN, SOFTBRIDGE_VIDEO_DEST_PREFIX, and SOFTBRIDGE_VIDEO_DEST_SEPARATOR.
Referenced by map_source_to_destinations(), remove_destination_streams(), and softmix_bridge_stream_sources_update().
|
static |
Determine if a stream is a video source stream.
stream | The stream to test |
1 | The stream is a video source |
0 | The stream is not a video source |
Definition at line 439 of file bridge_softmix.c.
References AST_MEDIA_TYPE_VIDEO, ast_stream_get_name(), ast_stream_get_state(), ast_stream_get_type(), AST_STREAM_STATE_REMOVED, SOFTBRIDGE_VIDEO_DEST_LEN, and SOFTBRIDGE_VIDEO_DEST_PREFIX.
Referenced by append_source_streams(), softmix_bridge_stream_sources_update(), and softmix_bridge_stream_topology_changed().
|
static |
Definition at line 2883 of file bridge_softmix.c.
References ast_bridge_technology_register, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, softmix_bridge, and unload_module().
|
static |
Map a source stream to all of its destination streams.
source_channel_name | Name of channel where the source stream originates |
bridge_stream_position | The slot in the bridge where source video will come from |
participants | The bridge_channels in the bridge |
source_channel_stream_position | The position of the stream on the source channel |
Definition at line 2168 of file bridge_softmix.c.
References ast_bridge_channel_lock, ast_bridge_channel_unlock, ast_channel_get_stream_topology(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, AST_LIST_TRAVERSE, ast_stream_topology_get_count(), ast_stream_topology_get_stream(), AST_VECTOR_APPEND, AST_VECTOR_REPLACE, ast_bridge_channel::chan, is_video_dest(), ast_bridge_channel::stream_map, ast_bridge_channel::tech_pvt, ast_bridge_channel::to_channel, and softmix_channel::video_sources.
Referenced by softmix_bridge_stream_topology_changed().
|
static |
Definition at line 1394 of file bridge_softmix.c.
References AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE, AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE_ALL, AST_BRIDGE_VIDEO_SFU_REMB_FORCE, AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST, AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST_ALL, AST_BRIDGE_VIDEO_SFU_REMB_LOWEST, AST_BRIDGE_VIDEO_SFU_REMB_LOWEST_ALL, AST_VECTOR_GET, AST_VECTOR_SIZE, softmix_remb_collector::bitrate, softmix_bridge_data::bitrate, ast_rtp_rtcp_feedback_remb::br_exp, ast_rtp_rtcp_feedback_remb::br_mantissa, ast_bridge_video_sfu_data::estimated_bitrate, ast_bridge_video_mode::mode_data, softmix_channel::remb, ast_bridge_video_sfu_data::remb_behavior, remb_collect_report_all(), softmix_bridge_data::remb_collectors, ast_bridge_video_mode::sfu_data, ast_bridge::softmix, ast_bridge_softmix::video_mode, and softmix_channel::video_sources.
Referenced by softmix_mixing_loop().
|
static |
Definition at line 1363 of file bridge_softmix.c.
References AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE, AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE_ALL, AST_BRIDGE_VIDEO_SFU_REMB_FORCE, AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST, AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST_ALL, AST_BRIDGE_VIDEO_SFU_REMB_LOWEST, AST_BRIDGE_VIDEO_SFU_REMB_LOWEST_ALL, softmix_bridge_data::bitrate, ast_bridge_video_mode::mode_data, ast_bridge_video_sfu_data::remb_behavior, ast_bridge_video_mode::sfu_data, ast_bridge::softmix, and ast_bridge_softmix::video_mode.
Referenced by remb_collect_report().
|
static |
Allocate a REMB collector.
non-NULL | success |
NULL | failure |
Definition at line 2208 of file bridge_softmix.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, AST_FRAME_RTCP, AST_RTP_RTCP_FMT_REMB, AST_RTP_RTCP_PSFB, ast_frame::data, ast_frame::datalen, softmix_remb_collector::feedback, ast_rtp_rtcp_feedback::fmt, softmix_remb_collector::frame, ast_frame::frametype, ast_frame_subclass::integer, NULL, ast_frame::ptr, and ast_frame::subclass.
Referenced by remb_enable_collection().
|
static |
Setup REMB collection for a particular bridge stream and channel.
bridge | The bridge |
bridge_channel | Channel that is collecting REMB information |
bridge_stream_position | The slot in the bridge where source video comes from |
Definition at line 2233 of file bridge_softmix.c.
References ao2_ref, AST_VECTOR_REPLACE, softmix_bridge_data::bridge, softmix_channel::remb_collector, remb_collector_alloc(), softmix_bridge_data::remb_collectors, ast_bridge::tech_pvt, and ast_bridge_channel::tech_pvt.
Referenced by softmix_bridge_stream_topology_changed().
|
static |
Definition at line 1474 of file bridge_softmix.c.
References ast_bridge_channel_queue_frame(), AST_VECTOR_GET, AST_VECTOR_SIZE, softmix_remb_collector::bitrate, softmix_bridge_data::bitrate, ast_rtp_rtcp_feedback_remb::br_exp, ast_rtp_rtcp_feedback_remb::br_mantissa, softmix_remb_collector::feedback, softmix_remb_collector::frame, ast_rtp_rtcp_feedback::remb, softmix_channel::remb_collector, ast_bridge_channel::stream_map, ast_frame::stream_num, and ast_bridge_channel::to_bridge.
Referenced by softmix_mixing_loop().
|
static |
Definition at line 1071 of file bridge_softmix.c.
References ast_stream_clone(), ast_stream_free(), ast_stream_get_name(), ast_stream_set_state(), AST_STREAM_STATE_REMOVED, ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_set_stream(), and NULL.
Referenced by sfu_topologies_on_source_change().
|
static |
Definition at line 775 of file bridge_softmix.c.
References ast_stream_set_state(), AST_STREAM_STATE_REMOVED, ast_stream_topology_get_count(), ast_stream_topology_get_stream(), and is_video_dest().
Referenced by sfu_topologies_on_leave().
|
static |
Definition at line 303 of file bridge_softmix.c.
References ao2_replace, ast_assert, ast_bridge_channel_leave_bridge(), ast_channel_lock, ast_channel_rawreadformat(), ast_channel_unlock, ast_dsp_free(), ast_dsp_new_with_rate(), ast_dsp_set_threshold(), ast_format_cache_get_slin_by_rate(), AST_FRAME_VOICE, ast_mutex_lock, ast_mutex_unlock, ast_set_read_format_path(), ast_set_write_format(), ast_set_write_format_interleaved_stereo(), ast_slinfactory_destroy(), ast_slinfactory_init_with_format(), softmix_channel::binaural, BINAURAL_MIXING_INTERVAL, softmix_channel::binaural_pos, BRIDGE_CHANNEL_STATE_END, ast_bridge_channel::chan, ast_frame::data, ast_frame::datalen, DEFAULT_SOFTMIX_TALKING_THRESHOLD, softmix_channel::dsp, softmix_channel::factory, softmix_channel::final_buf, ast_frame_subclass::format, ast_frame::frametype, softmix_channel::is_announcement, softmix_channel::lock, NULL, ast_frame::ptr, softmix_channel::rate, softmix_channel::read_slin_format, ast_frame::samples, SOFTMIX_DATALEN, SOFTMIX_SAMPLES, ast_frame::subclass, ast_bridge_tech_optimizations::talking_threshold, ast_bridge_channel::tech_args, ast_bridge_channel::tech_pvt, and softmix_channel::write_frame.
Referenced by softmix_bridge_join(), and softmix_mixing_loop().
|
static |
Issue channel stream topology change requests.
When in SFU mode, each participant needs to be able to send video directly to other participants in the bridge. This means that all participants need to have their topologies updated. The joiner needs to have destination streams for all current participants, and the current participants need to have destinations streams added for the joiner's sources.
bridge | |
joiner | The channel that is joining the softmix bridge |
Definition at line 619 of file bridge_softmix.c.
References append_all_streams(), append_source_streams(), ast_channel_get_stream_topology(), ast_channel_lock, ast_channel_name(), ast_channel_request_stream_topology_change(), ast_channel_uniqueid(), ast_channel_unlock, AST_LIST_TRAVERSE, ast_stream_topology_alloc(), ast_stream_topology_clone(), ast_stream_topology_free(), ast_trace, ast_bridge_channel::chan, ast_bridge::channels, LOG_ERROR, NULL, RAII_VAR, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_LOG_RTN, SCOPE_EXIT_RTN, ast_bridge_softmix::send_sdp_label, ast_bridge::softmix, ast_bridge_channel::tech_pvt, and softmix_channel::topology.
Referenced by softmix_bridge_join().
|
static |
Definition at line 794 of file bridge_softmix.c.
References ast_channel_name(), ast_channel_request_stream_topology_change(), AST_LIST_TRAVERSE, ast_bridge_channel::chan, NULL, remove_destination_streams(), ast_bridge_channel::tech_pvt, and softmix_channel::topology.
Referenced by softmix_bridge_leave().
|
static |
Definition at line 1115 of file bridge_softmix.c.
References append_all_streams(), append_source_streams(), ast_channel_get_stream_topology(), ast_channel_lock, ast_channel_name(), ast_channel_request_stream_topology_change(), ast_channel_uniqueid(), ast_channel_unlock, AST_LIST_TRAVERSE, ast_stream_topology_alloc(), ast_stream_topology_clone(), ast_stream_topology_free(), ast_bridge_channel::bridge, ast_bridge_channel::chan, ast_bridge::channels, cleanup(), NULL, remove_all_original_streams(), ast_bridge_softmix::send_sdp_label, ast_bridge::softmix, ast_bridge_channel::tech_pvt, and softmix_channel::topology.
Referenced by softmix_bridge_write_control().
|
static |
Definition at line 1058 of file bridge_softmix.c.
References clear_talking(), ast_bridge_channel::features, and ast_bridge_features::mute.
Referenced by softmix_bridge_write().
|
static |
Function called when a bridge is created.
Definition at line 2068 of file bridge_softmix.c.
References ast_calloc, ast_cond_init, ast_log, AST_LOG_WARNING, ast_mutex_init, ast_pthread_create, AST_PTHREADT_NULL, ast_timer_open(), AST_VECTOR_INIT, softmix_bridge_data::bridge, softmix_bridge_data::cond, softmix_bridge_data::default_sample_size, DEFAULT_SOFTMIX_INTERVAL, softmix_bridge_data::internal_mixing_interval, softmix_bridge_data::internal_rate, softmix_bridge_data::lock, NULL, softmix_bridge_data::remb_collectors, softmix_bridge_data_destroy(), SOFTMIX_MIN_SAMPLE_RATE, softmix_mixing_thread(), SOFTMIX_SAMPLES, ast_bridge::tech_pvt, softmix_bridge_data::thread, and softmix_bridge_data::timer.
|
static |
Definition at line 2054 of file bridge_softmix.c.
References ao2_cleanup, ast_cond_destroy, ast_free, ast_mutex_destroy, ast_timer_close(), AST_VECTOR_FREE, AST_VECTOR_RESET, softmix_bridge_data::cond, softmix_bridge_data::lock, NULL, softmix_bridge_data::remb_collectors, and softmix_bridge_data::timer.
Referenced by softmix_bridge_create(), and softmix_bridge_destroy().
|
static |
Function called when a bridge is destroyed.
Definition at line 2132 of file bridge_softmix.c.
References ast_cond_signal, ast_debug, ast_mutex_lock, ast_mutex_unlock, AST_PTHREADT_NULL, softmix_bridge_data::bridge, softmix_bridge_data::cond, softmix_bridge_data::convolve, free_convolve_data(), softmix_bridge_data::lock, NULL, softmix_bridge_data_destroy(), softmix_bridge_data::stop, ast_bridge::tech_pvt, thread, softmix_bridge_data::thread, and ast_bridge::uniqueid.
|
static |
Function called when a channel is joined into the bridge.
Definition at line 696 of file bridge_softmix.c.
References AST_BRIDGE_VIDEO_MODE_SFU, ast_calloc, ast_channel_hold_state(), ast_channel_name(), AST_CONTROL_HOLD, AST_CONTROL_UNHOLD, ast_debug, ast_format_get_channel_count(), ast_free, ast_indicate(), ast_log, ast_mutex_init, convolve_data::binaural_active, ast_bridge_softmix::binaural_active, softmix_bridge_data::bridge, ast_bridge_channel::chan, softmix_bridge_data::convolve, softmix_bridge_data::default_sample_size, DEFAULT_SOFTMIX_INTERVAL, softmix_bridge_data::internal_mixing_interval, softmix_bridge_data::internal_rate, softmix_channel::lock, LOG_ERROR, ast_bridge_video_mode::mode, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, set_binaural_data_join(), set_softmix_bridge_data(), sfu_topologies_on_join(), ast_bridge::softmix, softmix_poke_thread(), ast_bridge::tech_pvt, ast_bridge_channel::tech_pvt, ast_bridge::uniqueid, ast_bridge_softmix::video_mode, and ast_bridge_channel::write_format.
|
static |
Function called when a channel leaves the bridge.
Definition at line 816 of file bridge_softmix.c.
References ao2_cleanup, AST_BRIDGE_VIDEO_MODE_SFU, ast_dsp_free(), ast_free, ast_mutex_destroy, ast_slinfactory_destroy(), ast_stream_topology_free(), AST_VECTOR_FREE, softmix_channel::binaural, ast_bridge_softmix::binaural_active, softmix_channel::binaural_pos, softmix_bridge_data::bridge, ast_bridge::channels, softmix_bridge_data::convolve, softmix_bridge_data::default_sample_size, softmix_channel::dsp, softmix_channel::factory, ast_frame_subclass::format, softmix_channel::lock, ast_bridge_video_mode::mode, NULL, softmix_channel::remb_collector, set_binaural_data_leave(), sfu_topologies_on_leave(), ast_bridge::softmix, ast_frame::subclass, ast_bridge::tech_pvt, ast_bridge_channel::tech_pvt, softmix_channel::topology, ast_bridge_softmix::video_mode, softmix_channel::video_sources, and softmix_channel::write_frame.
|
static |
Definition at line 2117 of file bridge_softmix.c.
References ast_mutex_lock, ast_mutex_unlock, softmix_bridge_data::bridge, softmix_bridge_data::lock, softmix_bridge_data::stop, and ast_bridge::tech_pvt.
|
static |
Definition at line 2256 of file bridge_softmix.c.
References append_all_streams(), append_source_stream(), ast_channel_get_stream_topology(), ast_channel_name(), ast_channel_request_stream_topology_change(), ast_channel_uniqueid(), AST_LIST_TRAVERSE, AST_MEDIA_TYPE_VIDEO, ast_str_tmp, ast_stream_get_name(), ast_stream_get_state(), ast_stream_get_type(), ast_stream_set_state(), ast_stream_state2str(), AST_STREAM_STATE_INACTIVE, AST_STREAM_STATE_RECVONLY, AST_STREAM_STATE_REMOVED, AST_STREAM_STATE_SENDONLY, AST_STREAM_STATE_SENDRECV, ast_stream_to_str(), ast_stream_topology_alloc(), ast_stream_topology_clone(), ast_stream_topology_free(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_stream_topology_to_str(), ast_trace, ast_bridge_channel::chan, ast_bridge::channels, cleanup(), is_video_dest(), is_video_source(), LOG_ERROR, MAX, NULL, SCOPE_ENTER, SCOPE_EXIT, SCOPE_EXIT_EXPR, SCOPE_EXIT_LOG, ast_bridge_softmix::send_sdp_label, SOFTBRIDGE_VIDEO_DEST_LEN, SOFTBRIDGE_VIDEO_DEST_PREFIX, ast_bridge::softmix, ast_bridge_channel::tech_pvt, and softmix_channel::topology.
Referenced by softmix_bridge_stream_topology_changed().
|
static |
stream_topology_changed callback
For most video modes, nothing beyond the ordinary is required. For the SFU case, though, we need to completely remap the streams in order to ensure video gets directed where it is expected to go.
bridge | The bridge |
bridge_channel | Channel whose topology has changed |
Definition at line 2450 of file bridge_softmix.c.
References ao2_bump, ao2_cleanup, ast_bridge_channel_lock, ast_bridge_channel_stream_map(), ast_bridge_channel_unlock, AST_BRIDGE_VIDEO_MODE_NONE, AST_BRIDGE_VIDEO_MODE_SFU, AST_BRIDGE_VIDEO_MODE_SINGLE_SRC, AST_BRIDGE_VIDEO_MODE_TALKER_SRC, ast_channel_get_stream_topology(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, AST_LIST_TRAVERSE, AST_MEDIA_TYPE_END, AST_MEDIA_TYPE_VIDEO, ast_stream_get_state(), ast_stream_get_type(), AST_STREAM_STATE_REMOVED, ast_stream_topology_free(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), AST_VECTOR_APPEND, AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_ELEM_DEFAULT_CMP, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_GET_INDEX_NTH, AST_VECTOR_INIT, AST_VECTOR_REPLACE, AST_VECTOR_RESET, AST_VECTOR_SIZE, softmix_bridge_data::bridge, ast_bridge_channel::chan, ast_bridge::channels, is_video_source(), map_source_to_destinations(), ast_bridge_video_mode::mode, NULL, softmix_bridge_data::remb_collectors, remb_enable_collection(), SCOPE_ENTER, SCOPE_EXIT_RTN, ast_bridge::softmix, softmix_bridge_stream_sources_update(), ast_bridge_channel::stream_map, ast_bridge::tech_pvt, ast_bridge_channel::tech_pvt, ast_bridge_channel::to_bridge, ast_bridge_channel::to_channel, type, ast_bridge_softmix::video_mode, and softmix_channel::video_sources.
|
static |
Function called when a channel is unsuspended from the bridge.
Definition at line 415 of file bridge_softmix.c.
References ast_format_cache_get_slin_by_rate(), ast_set_write_format_interleaved_stereo(), softmix_channel::binaural, ast_bridge_channel::chan, softmix_channel::rate, softmix_poke_thread(), ast_bridge::tech_pvt, and ast_bridge_channel::tech_pvt.
|
static |
Definition at line 1309 of file bridge_softmix.c.
References ast_assert, ast_bridge_queue_everyone_else(), ast_debug, AST_FRAME_BRIDGE_ACTION, AST_FRAME_BRIDGE_ACTION_SYNC, AST_FRAME_CONTROL, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, AST_FRAME_NULL, AST_FRAME_RTCP, AST_FRAME_TEXT, AST_FRAME_TEXT_DATA, AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_log, ast_frame::frametype, LOG_ERROR, softmix_bridge_check_voice(), softmix_bridge_write_control(), softmix_bridge_write_rtcp(), softmix_bridge_write_text(), softmix_bridge_write_video(), softmix_bridge_write_voice(), ast_bridge::tech_pvt, and ast_bridge_channel::tech_pvt.
|
static |
Definition at line 1222 of file bridge_softmix.c.
References ast_bridge_queue_everyone_else(), AST_BRIDGE_VIDEO_MODE_SFU, AST_CONTROL_HOLD, AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED, AST_CONTROL_VIDUPDATE, ast_tvdiff_ms(), ast_tvnow(), softmix_bridge_data::bridge, clear_talking(), ast_frame_subclass::integer, softmix_bridge_data::last_video_update, ast_bridge_video_mode::mode, sfu_topologies_on_source_change(), ast_bridge::softmix, ast_frame::subclass, ast_bridge::tech_pvt, ast_bridge_softmix::video_mode, and ast_bridge_video_mode::video_update_discard.
Referenced by softmix_bridge_write().
|
static |
Definition at line 1271 of file bridge_softmix.c.
References AST_BRIDGE_VIDEO_MODE_SFU, ast_mutex_lock, ast_mutex_unlock, AST_RTP_RTCP_FMT_REMB, AST_RTP_RTCP_PSFB, ast_frame::data, ast_rtp_rtcp_feedback::fmt, ast_frame_subclass::integer, softmix_channel::lock, ast_bridge_video_mode::mode, ast_bridge_video_mode::mode_data, ast_frame::ptr, softmix_channel::remb, ast_rtp_rtcp_feedback::remb, ast_bridge_video_sfu_data::remb_send_interval, ast_bridge_video_mode::sfu_data, ast_bridge::softmix, ast_frame::subclass, ast_bridge_channel::tech_pvt, and ast_bridge_softmix::video_mode.
Referenced by softmix_bridge_write().
|
static |
Definition at line 1186 of file bridge_softmix.c.
References ast_bridge_queue_everyone_else(), ast_channel_name(), AST_FRAME_TEXT_DATA, ast_frame_type2str(), ast_log, AST_MSG_DATA_ATTR_BODY, AST_MSG_DATA_ATTR_FROM, ast_msg_data_get_attribute(), ast_bridge_channel::chan, ast_frame::data, ast_frame::datalen, DEBUG_ATLEAST, ast_frame::frametype, LOG_DEBUG, and ast_frame::ptr.
Referenced by softmix_bridge_write().
|
static |
Definition at line 886 of file bridge_softmix.c.
References ast_bridge_is_video_src(), ast_bridge_number_video_src(), ast_bridge_queue_everyone_else(), ast_bridge_update_talker_src_video_mode(), AST_BRIDGE_VIDEO_MODE_NONE, AST_BRIDGE_VIDEO_MODE_SFU, AST_BRIDGE_VIDEO_MODE_SINGLE_SRC, AST_BRIDGE_VIDEO_MODE_TALKER_SRC, ast_mutex_lock, ast_mutex_unlock, ast_bridge_channel::chan, video_follow_talker_data::energy_average, ast_frame_subclass::frame_ending, softmix_channel::lock, ast_bridge_video_mode::mode, NULL, ast_bridge::softmix, softmix_pass_video_top_priority(), ast_frame::subclass, ast_bridge_channel::tech_pvt, ast_bridge_softmix::video_mode, and softmix_channel::video_talker.
Referenced by softmix_bridge_write().
|
static |
Definition at line 937 of file bridge_softmix.c.
References ast_bridge_channel_notify_talking(), AST_BRIDGE_VIDEO_MODE_TALKER_SRC, ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_debug, ast_dsp_silence_with_energy(), ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_get_name(), ast_mutex_lock, ast_mutex_unlock, ast_set_read_format_path(), ast_slinfactory_available(), ast_slinfactory_feed(), ast_slinfactory_flush(), softmix_bridge_data::bridge, ast_bridge_channel::chan, DEFAULT_ENERGY_HISTORY_LEN, DEFAULT_SOFTMIX_SILENCE_THRESHOLD, ast_bridge_tech_optimizations::drop_silence, softmix_channel::dsp, video_follow_talker_data::energy_accum, video_follow_talker_data::energy_average, video_follow_talker_data::energy_history, video_follow_talker_data::energy_history_cur_slot, softmix_channel::factory, ast_frame_subclass::format, softmix_bridge_data::internal_mixing_interval, softmix_bridge_data::internal_rate, softmix_channel::lock, ast_bridge_video_mode::mode, softmix_channel::read_slin_format, ast_bridge_tech_optimizations::silence_threshold, ast_bridge::softmix, SOFTMIX_SAMPLES, ast_frame::subclass, softmix_channel::talking, ast_bridge_channel::tech_args, ast_bridge::tech_pvt, ast_bridge_channel::tech_pvt, ast_bridge_softmix::video_mode, and softmix_channel::video_talker.
Referenced by softmix_bridge_write().
|
static |
Definition at line 1712 of file bridge_softmix.c.
References ast_free, softmix_mixing_array::buffers, and softmix_mixing_array::chan_pairs.
Referenced by softmix_mixing_loop().
|
static |
Definition at line 1721 of file bridge_softmix.c.
References ast_log, ast_realloc, softmix_mixing_array::buffers, softmix_mixing_array::chan_pairs, LOG_NOTICE, softmix_mixing_array::max_num_entries, and tmp().
Referenced by softmix_mixing_loop().
|
static |
Definition at line 1693 of file bridge_softmix.c.
References ast_calloc, ast_log, softmix_mixing_array::buffers, softmix_mixing_array::chan_pairs, LOG_NOTICE, and softmix_mixing_array::max_num_entries.
Referenced by softmix_mixing_loop().
|
static |
Mixing loop.
0 | on success |
-1 | on failure |
Definition at line 1752 of file bridge_softmix.c.
References add_binaural_mixing(), analyse_softmix_stats(), ao2_t_replace, ast_bridge_channel_queue_frame(), ast_bridge_lock, ast_bridge_unlock, AST_BRIDGE_VIDEO_MODE_SFU, ast_channel_name(), ast_channel_rawwriteformat(), ast_format_cache_get_slin_by_rate(), AST_LIST_TRAVERSE, ast_log, ast_mutex_lock, ast_mutex_unlock, ast_slinear_saturated_add(), ast_timer_ack(), ast_timer_fd(), ast_timer_set_rate(), ast_tvdiff_ms(), ast_tvnow(), ast_waitfor_n_fd(), softmix_channel::binaural, convolve_data::binaural_active, ast_bridge_softmix::binaural_active, binaural_mixing(), softmix_bridge_data::bitrate, softmix_bridge_data::bridge, buf, softmix_mixing_array::buffers, ast_bridge_channel::chan, ast_bridge::channels, check_binaural_position_change(), softmix_bridge_data::convolve, create_binaural_frame(), ast_frame::datalen, softmix_bridge_data::default_sample_size, softmix_channel::final_buf, ast_frame_subclass::format, gather_softmix_stats(), softmix_bridge_data::internal_mixing_interval, ast_bridge_softmix::internal_mixing_interval, softmix_bridge_data::internal_rate, ast_bridge_softmix::internal_sample_rate, softmix_bridge_data::last_remb_update, softmix_channel::lock, softmix_stats::locked_rate, LOG_ERROR, LOG_WARNING, MAX_DATALEN, softmix_mixing_array::max_num_entries, softmix_stats::maximum_rate, ast_bridge_softmix::maximum_sample_rate, ast_bridge_video_mode::mode, ast_bridge_video_mode::mode_data, NULL, ast_bridge::num_active, ast_bridge::num_channels, remb_collect_report(), ast_bridge_video_sfu_data::remb_send_interval, remb_send_report(), ast_frame::samples, set_softmix_bridge_data(), ast_bridge_video_mode::sfu_data, ast_bridge::softmix, SOFTMIX_DATALEN, softmix_mixing_array_destroy(), softmix_mixing_array_grow(), softmix_mixing_array_init(), softmix_process_read_audio(), softmix_process_write_audio(), SOFTMIX_SAMPLES, SOFTMIX_STAT_INTERVAL, softmix_translate_helper_change_rate(), softmix_translate_helper_cleanup(), softmix_translate_helper_destroy(), softmix_translate_helper_init(), softmix_bridge_data::stop, ast_frame::subclass, ast_bridge_channel::suspended, ast_bridge::tech_pvt, ast_bridge_channel::tech_pvt, softmix_bridge_data::timer, timer, ast_bridge::uniqueid, softmix_mixing_array::used_entries, ast_bridge_softmix::video_mode, and softmix_channel::write_frame.
Referenced by softmix_mixing_thread().
|
static |
Definition at line 1985 of file bridge_softmix.c.
References ast_bridge_lock, ast_bridge_unlock, ast_callid_threadassoc_add(), ast_cond_wait, ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, ast_bridge_softmix::binaural_active, softmix_bridge_data::binaural_init, softmix_bridge_data::bridge, ast_bridge::callid, softmix_bridge_data::cond, softmix_bridge_data::convolve, softmix_bridge_data::default_sample_size, init_convolve_data(), softmix_bridge_data::internal_mixing_interval, softmix_bridge_data::internal_rate, softmix_bridge_data::lock, LOG_ERROR, LOG_WARNING, NULL, ast_bridge::num_active, ast_bridge::softmix, SOFTMIX_BINAURAL_SAMPLE_RATE, softmix_mixing_loop(), SOFTMIX_SAMPLES, softmix_bridge_data::stop, and ast_bridge::uniqueid.
Referenced by softmix_bridge_create().
|
static |
Definition at line 862 of file bridge_softmix.c.
References ast_bridge_channel_queue_frame(), ast_bridge_is_video_src(), AST_LIST_TRAVERSE, ast_bridge_channel::bridge, ast_bridge_channel::chan, ast_bridge::channels, and ast_bridge_channel::suspended.
Referenced by softmix_bridge_write_video().
|
static |
Definition at line 407 of file bridge_softmix.c.
References ast_cond_signal, ast_mutex_lock, ast_mutex_unlock, softmix_bridge_data::cond, and softmix_bridge_data::lock.
Referenced by softmix_bridge_join(), and softmix_bridge_unsuspend().
|
static |
Definition at line 184 of file bridge_softmix.c.
References ast_slinfactory_available(), ast_slinfactory_read(), softmix_channel::factory, softmix_channel::have_audio, NULL, and softmix_channel::our_buf.
Referenced by softmix_mixing_loop().
|
static |
Definition at line 203 of file bridge_softmix.c.
References ao2_replace, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_FRAME_VOICE, AST_LIST_INSERT_HEAD, AST_LIST_TRAVERSE, ast_slinear_saturated_subtract(), ast_translate(), ast_translator_build_path(), softmix_channel::binaural, entry::data, ast_frame::datalen, softmix_translate_helper::entries, softmix_channel::final_buf, ast_frame_subclass::format, softmix_channel::have_audio, MAX_DATALEN, NULL, softmix_channel::our_buf, ast_frame::samples, softmix_translate_helper::slin_src, softmix_process_write_binaural_audio(), softmix_translate_helper_entry_alloc(), ast_frame::subclass, and softmix_channel::write_frame.
Referenced by softmix_mixing_loop().
|
static |
Definition at line 159 of file bridge_softmix.c.
References ast_format_cache_get_slin_by_rate(), AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_translator_build_path(), ast_translator_free_path(), softmix_translate_helper::entries, softmix_translate_helper_entry::entry, softmix_translate_helper::slin_src, and softmix_translate_helper_free_entry().
Referenced by softmix_mixing_loop().
|
static |
Definition at line 271 of file bridge_softmix.c.
References ast_frfree, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_translator_free_path(), softmix_translate_helper::entries, softmix_translate_helper_entry::entry, NULL, and softmix_translate_helper_free_entry().
Referenced by softmix_mixing_loop().
|
static |
Definition at line 150 of file bridge_softmix.c.
References AST_LIST_REMOVE_HEAD, softmix_translate_helper::entries, softmix_translate_helper_entry::entry, and softmix_translate_helper_free_entry().
Referenced by softmix_mixing_loop().
|
static |
Definition at line 117 of file bridge_softmix.c.
References ao2_bump, ast_calloc, softmix_translate_helper_entry::entry, and NULL.
Referenced by softmix_process_write_audio().
|
static |
Definition at line 130 of file bridge_softmix.c.
References ao2_cleanup, ast_free, ast_frfree, ast_translator_free_path(), and NULL.
Referenced by softmix_translate_helper_change_rate(), softmix_translate_helper_cleanup(), and softmix_translate_helper_destroy().
|
static |
Definition at line 144 of file bridge_softmix.c.
References ast_format_cache_get_slin_by_rate(), and softmix_translate_helper::slin_src.
Referenced by softmix_mixing_loop().
|
static |
Definition at line 2875 of file bridge_softmix.c.
References ast_bridge_technology_unregister(), AST_TEST_UNREGISTER, and softmix_bridge.
Referenced by load_module().
|
static |
Definition at line 2894 of file bridge_softmix.c.
|
static |
Definition at line 2894 of file bridge_softmix.c.
|
static |
Definition at line 2579 of file bridge_softmix.c.
Referenced by load_module(), and unload_module().