49 static void remb_values_free(
void *data)
55 .
type =
"REMB Values",
56 .destroy = remb_values_free,
85 feedback = frame->
data.ptr;
94 remb_values = remb_store->
data;
146 frexp(bitrate, &exp);
147 exp = exp > 18 ? exp - 18 : 0;
158 unsigned int bitrate;
160 struct remb_values *remb_values;
162 .
version = AST_FRAMEHOOK_INTERFACE_VERSION,
163 .event_cb = remb_hook_event_cb,
168 e->
command =
"remb set {send|receive}";
170 "Usage: remb set {send|receive} <channel> <bitrate in bits>\n"
171 " Set the REMB value which overwrites what we send or receive\n";
178 return CLI_SHOWUSAGE;
181 if (sscanf(a->argv[4],
"%30d", &bitrate) != 1) {
182 ast_cli(a->fd,
"%s is not a valid bitrate in bits\n", a->argv[4]);
184 }
else if (strcasecmp(a->argv[2],
"send") && strcasecmp(a->argv[2],
"receive")) {
185 ast_cli(a->fd,
"%s is not a valid direction for REMB\n", a->argv[2]);
191 ast_cli(a->fd,
"%s is not a known channel\n", a->argv[3]);
195 ast_channel_lock(chan);
202 if (framehook_id < 0) {
203 ast_cli(a->fd,
"Could not attach framehook for modifying REMB\n");
204 ast_channel_unlock(chan);
209 remb_values =
ast_calloc(1,
sizeof(*remb_values));
211 ast_cli(a->fd,
"Could not create a place to store provided REMB value\n");
213 ast_channel_unlock(chan);
218 remb_store = ast_datastore_alloc(&remb_info, NULL);
220 ast_cli(a->fd,
"Could not create a place to store provided REMB value\n");
222 ast_channel_unlock(chan);
224 ast_free(remb_values);
228 remb_store->
data = remb_values;
231 remb_values = remb_store->
data;
234 if (!strcasecmp(a->argv[2],
"send")) {
236 }
else if (!strcasecmp(a->argv[2],
"receive")) {
240 ast_channel_unlock(chan);
243 ast_cli(a->fd,
"Set REMB %s override to a bitrate of %s on %s\n", a->argv[2], a->argv[3], a->argv[4]);
249 AST_CLI_DEFINE(handle_remb_set,
"Set the REMB value which overwrites what is sent or received"),
252 static int load_module(
void)
258 static int unload_module(
void)
264 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"REMB Modifier Module",
265 .support_level = AST_MODULE_SUPPORT_EXTENDED,
267 .unload = unload_module,
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
float send_bitrate
The amount of bitrate to use for REMB sent to the channel.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define ast_channel_unref(c)
Decrease channel reference count.
descriptor for a cli entry.
ast_framehook_event
These are the types of events that the framehook's event callback can receive.
int ast_framehook_detach(struct ast_channel *chan, int framehook_id)
Detach an framehook from a channel.
An object that represents data received in a feedback report.
Structure for a data store type.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
struct ast_rtp_rtcp_feedback_remb remb
float receive_bitrate
The amount of bitrate to use for REMB received from the channel.
struct ast_frame_subclass subclass
int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interface *i)
Attach an framehook onto a channel for frame interception.
General Asterisk PBX channel definitions.
union ast_frame::@224 data
#define ast_calloc(num, len)
A wrapper for calloc()
Standard Command Line Interface.
char * ast_complete_channels(const char *line, const char *word, int pos, int state, int rpos)
Command completion for the list of active channels.
Data structure associated with a single frame of data.
#define AST_RTP_RTCP_PSFB
#define ASTERISK_GPL_KEY
The text the key() function should return.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Pluggable RTP Architecture.
Asterisk module definitions.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define AST_RTP_RTCP_FMT_REMB