Multi-party software based channel mixing. More...
#include "asterisk.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/bridging.h"
#include "asterisk/bridging_technology.h"
#include "asterisk/frame.h"
#include "asterisk/options.h"
#include "asterisk/logger.h"
#include "asterisk/slinfactory.h"
#include "asterisk/astobj2.h"
#include "asterisk/timing.h"
Go to the source code of this file.
Data Structures | |
struct | softmix_channel |
Define used to turn on 16 kHz audio support. More... | |
Macros | |
#define | SOFTMIX_DATALEN (160 * (SOFTMIX_INTERVAL / 10)) |
Size of the buffer used for sample manipulation. More... | |
#define | SOFTMIX_INTERVAL 20 |
Interval at which mixing will take place. Valid options are 10, 20, and 40. More... | |
#define | SOFTMIX_SAMPLES (SOFTMIX_DATALEN / 2) |
Number of samples we are dealing with. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | load_module (void) |
static int | softmix_bridge_create (struct ast_bridge *bridge) |
Function called when a bridge is created. More... | |
static int | 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 int | softmix_bridge_leave (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Function called when a channel leaves the bridge. More... | |
static int | softmix_bridge_poke (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Function called when the channel's thread is poked. More... | |
static int | softmix_bridge_thread (struct ast_bridge *bridge) |
Function which acts as the mixing thread. More... | |
static enum ast_bridge_write_result | softmix_bridge_write (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
Function called when a channel writes a frame into the bridge. More... | |
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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static 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 SOFTMIX_DATALEN (160 * (SOFTMIX_INTERVAL / 10)) |
Size of the buffer used for sample manipulation.
Definition at line 63 of file bridge_softmix.c.
Referenced by softmix_bridge_join(), and softmix_bridge_thread().
#define SOFTMIX_INTERVAL 20 |
Interval at which mixing will take place. Valid options are 10, 20, and 40.
Definition at line 60 of file bridge_softmix.c.
Referenced by softmix_bridge_thread().
#define SOFTMIX_SAMPLES (SOFTMIX_DATALEN / 2) |
Number of samples we are dealing with.
Definition at line 66 of file bridge_softmix.c.
Referenced by softmix_bridge_join(), and softmix_bridge_thread().
|
static |
Definition at line 322 of file bridge_softmix.c.
|
static |
Definition at line 322 of file bridge_softmix.c.
|
static |
Definition at line 317 of file bridge_softmix.c.
References ast_bridge_technology_register.
|
static |
Function called when a bridge is created.
Definition at line 90 of file bridge_softmix.c.
References ast_timer_open(), ast_bridge::bridge_pvt, and timer.
|
static |
Function called when a bridge is destroyed.
Definition at line 104 of file bridge_softmix.c.
References ast_timer_close(), and ast_bridge::bridge_pvt.
|
static |
Function called when a channel is joined into the bridge.
Definition at line 115 of file bridge_softmix.c.
References ast_calloc, AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR16, AST_FRAME_VOICE, ast_mutex_init, ast_slinfactory_init(), ast_bridge_channel::bridge_pvt, ast_frame_subclass::codec, ast_frame::data, ast_frame::datalen, softmix_channel::factory, softmix_channel::final_buf, softmix_channel::frame, ast_frame::frametype, softmix_channel::lock, ast_frame::ptr, ast_frame::samples, SOFTMIX_DATALEN, SOFTMIX_SAMPLES, and ast_frame::subclass.
|
static |
Function called when a channel leaves the bridge.
Definition at line 148 of file bridge_softmix.c.
References ast_free, ast_mutex_destroy, ast_slinfactory_destroy(), ast_bridge_channel::bridge_pvt, softmix_channel::factory, and softmix_channel::lock.
|
static |
Function called when the channel's thread is poked.
Definition at line 203 of file bridge_softmix.c.
References ast_mutex_lock, ast_mutex_unlock, ast_write(), ast_bridge_channel::bridge_pvt, ast_bridge_channel::chan, softmix_channel::frame, softmix_channel::have_frame, and softmix_channel::lock.
|
static |
Function which acts as the mixing thread.
Definition at line 220 of file bridge_softmix.c.
References ao2_lock, ao2_unlock, ast_bridge::array_num, AST_LIST_TRAVERSE, ast_log(), ast_mutex_lock, ast_mutex_unlock, ast_slinear_saturated_add(), ast_slinear_saturated_subtract(), ast_slinfactory_available(), ast_slinfactory_read(), ast_timer_ack(), ast_timer_fd(), ast_timer_set_rate(), ast_waitfor_n_fd(), ast_bridge_channel::bridge_pvt, ast_bridge::bridge_pvt, softmix_channel::factory, softmix_channel::final_buf, softmix_channel::have_audio, softmix_channel::have_frame, softmix_channel::lock, LOG_ERROR, softmix_channel::our_buf, ast_bridge::refresh, SOFTMIX_DATALEN, SOFTMIX_INTERVAL, SOFTMIX_SAMPLES, ast_bridge::stop, ast_bridge_channel::thread, and timer.
|
static |
Function called when a channel writes a frame into the bridge.
Definition at line 170 of file bridge_softmix.c.
References AST_BRIDGE_WRITE_SUCCESS, AST_BRIDGE_WRITE_UNSUPPORTED, AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR16, AST_FRAME_VOICE, ast_mutex_lock, ast_mutex_unlock, ast_slinfactory_feed(), ast_write(), ast_bridge_channel::bridge_pvt, ast_bridge_channel::chan, ast_frame_subclass::codec, softmix_channel::factory, softmix_channel::frame, ast_frame::frametype, softmix_channel::have_frame, softmix_channel::lock, and ast_frame::subclass.
|
static |
Definition at line 312 of file bridge_softmix.c.
References ast_bridge_technology_unregister().
|
static |
Definition at line 322 of file bridge_softmix.c.
|
static |
Definition at line 322 of file bridge_softmix.c.
|
static |
Definition at line 294 of file bridge_softmix.c.