63 if (!instance1 || !instance2) {
107 for (index = 0; index < num; index++) {
108 frame_out.
seqno = seqno + index;
118 for (index = 0; index < num; index++) {
141 info->name =
"nack_no_packet_loss";
142 info->category =
"/res/res_rtp/";
143 info->summary =
"nack no packet loss unit test";
145 "Tests sending packets with no packet loss and " 146 "validates that the send buffer stores sent packets " 147 "and the receive buffer is empty";
163 "Send buffer did not have the expected count of 10");
166 "Receive buffer did not have the expected count of 0");
179 info->name =
"nack_nominal";
180 info->category =
"/res/res_rtp/";
181 info->summary =
"nack nominal unit test";
183 "Tests sending packets with some packet loss and " 184 "validates that a NACK request is sent on reaching " 185 "the triggering amount of lost packets";
215 "Receive buffer did not have the expected count of 0");
229 info->name =
"nack_overflow";
230 info->category =
"/res/res_rtp/";
231 info->summary =
"nack overflow unit test";
233 "Tests that when the buffer hits its capacity, we " 234 "queue all the packets we currently have stored";
255 "Receive buffer did not have the expected count of max buffer size");
261 "Receive buffer did not have the expected count of 0");
276 info->name =
"lost_packet_stats_nominal";
277 info->category =
"/res/res_rtp/";
278 info->summary =
"lost packet stats nominal unit test";
280 "Tests that when some packets are lost, we calculate that " 281 "loss correctly when doing lost packet statistics";
356 .remb.br_mantissa = 1000,
361 .data.ptr = &feedback,
362 .datalen =
sizeof(feedback),
368 info->name =
"remb_nominal";
369 info->category =
"/res/res_rtp/";
370 info->summary =
"remb nominal unit test";
372 "Tests sending and receiving a REMB packet";
392 ast_test_validate(
test, frame_in !=
NULL,
"Did not receive a REMB frame");
394 "REMB frame did not have the expected frametype");
396 "REMB frame did not have the expected subclass integer");
399 received_feedback = frame_in->data.ptr;
401 "REMB frame did not have the expected feedback format");
403 "REMB received exponent did not match sent exponent");
405 "REMB received mantissa did not match sent mantissa");
419 info->name =
"sr_rr_nominal";
420 info->category =
"/res/res_rtp/";
421 info->summary =
"SR/RR nominal unit test";
423 "Tests sending SR/RR and receiving it; includes SDES";
447 "Sender report frame did not have the expected frametype");
449 "Sender report frame did not have the expected subclass integer");
451 "SDES was never processed for sender report");
461 "Receiver report frame did not have the expected frametype");
463 "Receiver report frame did not have the expected subclass integer");
481 info->name =
"fir_nominal";
482 info->category =
"/res/res_rtp/";
483 info->summary =
"fir nominal unit test";
485 "Tests sending and receiving a FIR packet";
517 ast_test_validate(
test, frame_in !=
NULL,
"Did not receive a FIR frame");
519 "FIR frame did not have the expected frametype");
521 "FIR frame did not have the expected subclass integer");
int ast_rtp_instance_activate(struct ast_rtp_instance *instance)
Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance...
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk main include file. File version handling, generic pbx functions.
static int test_init_rtp_instances(struct ast_rtp_instance **instance1, struct ast_rtp_instance **instance2, struct ast_sched_context *test_sched, enum test_type type)
int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat)
Retrieve statistics about an RTP instance.
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
#define ast_set_flag(p, flag)
void ast_rtp_instance_set_schedid(struct ast_rtp_instance *instance, int id)
Set the schedid for RTCP.
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
An object that represents data received in a feedback report.
static void test_write_and_read_frames(struct ast_rtp_instance *instance1, struct ast_rtp_instance *instance2, int seqno, int num)
static int load_module(void)
#define AST_TEST_REGISTER(cb)
static void test_write_frames(struct ast_rtp_instance *instance, int seqno, int num)
static void test_read_frames(struct ast_rtp_instance *instance, int num)
struct ast_rtp_rtcp_feedback_remb remb
static void ast_sched_context_destroy_wrapper(struct ast_sched_context *sched)
Socket address structure.
int ast_rtp_instance_get_sdes_received(struct ast_rtp_instance *instance)
Get the value of sdes_received on the test engine.
size_t ast_rtp_instance_get_send_buffer_count(struct ast_rtp_instance *instance)
Get the current size of the send buffer.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
#define AST_TEST_UNREGISTER(cb)
#define ast_rtp_instance_set_remote_address(instance, address)
Set the address of the remote endpoint that we are sending RTP to.
size_t ast_rtp_instance_get_recv_buffer_count(struct ast_rtp_instance *instance)
Get the current size of the receive buffer.
void ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the local address that we are expecting RTP on.
int ast_rtp_instance_destroy(struct ast_rtp_instance *instance)
Destroy an RTP instance.
void ast_rtp_instance_drop_packets(struct ast_rtp_instance *instance, int num)
Set the number of packets to drop on RTP read.
size_t ast_rtp_instance_get_recv_buffer_max(struct ast_rtp_instance *instance)
Get the maximum size of the receive buffer.
static int unload_module(void)
Data structure associated with a single frame of data.
AST_TEST_DEFINE(nack_no_packet_loss)
#define AST_RTP_RTCP_PSFB
void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
Set the value of an RTP instance property.
union ast_frame::@263 data
enum ast_frame_type frametype
struct ast_rtp_instance * ast_rtp_instance_new(const char *engine_name, struct ast_sched_context *sched, const struct ast_sockaddr *sa, void *data)
Create a new RTP instance.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Pluggable RTP Architecture.
Asterisk module definitions.
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
void ast_rtp_instance_queue_report(struct ast_rtp_instance *instance)
Sends a SR/RR report the next time RTP would be sent.
void ast_rtp_instance_reset_test_engine(struct ast_rtp_instance *instance)
Resets all the fields to default values for the test engine.
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
#define AST_RTP_RTCP_FMT_REMB