summaryrefslogtreecommitdiff
path: root/tests/test_abstract_jb.c
blob: 53614bca136282a32cf812e98b8b16b609f38dee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 2012, Matt Jordan
 *
 * Matt Jordan <mjordan@digium.com>
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

/*!
 * \file
 * \brief Abstract Jitterbuffer Tests
 *
 * \author \verbatim Matt Jordan <mjordan@digium.com> \endverbatim
 *
 * Tests the abstract jitter buffer API.  This tests both adaptive and fixed
 * jitter buffers.  Functions defined in abstract_jb that are not part of the
 * abstract jitter buffer API are not tested by this unit test.
 *
 * \ingroup tests
 */

/*** MODULEINFO
	<depend>TEST_FRAMEWORK</depend>
	<support_level>core</support_level>
 ***/

#include "asterisk.h"

#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/test.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/frame.h"
#include "asterisk/format_cache.h"

#define DEFAULT_FRAME_MS 160
#define DEFAULT_CONFIG_FLAGS 0
#define DEFAULT_CONFIG_SIZE (DEFAULT_FRAME_MS) * 10
#define DEFAULT_CONFIG_RESYNC_THRESHOLD (DEFAULT_FRAME_MS) * 2
#define DEFAULT_CONFIG_TARGET_EXTRA -1

/*!
 * \internal
 * \brief Destructor for a jitter buffer
 *
 * \param jb The jitter buffer to destroy
 *
 * \note This will destroy all frames still in the jitter buffer
 */
static void dispose_jitterbuffer(struct ast_jb *jb)
{
	if (!jb || !jb->impl || !jb->jbobj) {
		return;
	}

	jb->impl->empty_and_reset(jb->jbobj);

	jb->impl->destroy(jb->jbobj);
	jb->impl = NULL;
	jb->jbobj = NULL;
}

/*!
 * \internal
 * \brief Create a test frame
 *
 * \param timestamp the time in ms of the frame
 * \param seqno the frame's sequence number
 *
 * \returns a malloc'd frame
 */
static struct ast_frame *create_test_frame(long timestamp,
		int seqno)
{
	struct ast_frame f = {0};

	f.subclass.format = ast_format_slin;
	f.frametype = AST_FRAME_VOICE;
	f.src = "TEST";
	f.ts = timestamp;
	f.len = DEFAULT_FRAME_MS;
	f.seqno = seqno;

	return ast_frisolate(&f);
}

/*! \internal
 * \brief Test two numeric (long int) values.
*/
#define LONG_INT_TEST(actual, expected) do { \
	if ((actual) != (expected)) { \
		ast_test_status_update(test, #actual ": expected [%ld]; actual [%ld]\n", (long int)(expected), (long int)(actual)); \
		return AST_TEST_FAIL; \
	} } while (0)

/*! \internal
 * \brief Test two numeric (int) values.
*/
#define INT_TEST(actual, expected) do { \
	if ((actual) != (expected)) { \
		ast_test_status_update(test, #actual ": expected [%d]; actual [%d]\n", (expected), (actual)); \
		return AST_TEST_FAIL; \
	} } while (0)

/*! \internal
 * \brief Test two numeric (unsigned int) values.
*/
#define UINT_TEST(actual, expected) do { \
	if ((actual) != (expected)) { \
		ast_test_status_update(test, #actual ": expected [%u]; actual [%u]\n", (expected), (actual)); \
		return AST_TEST_FAIL; \
	} } while (0)

/*! \internal
 * \brief Test two string values
*/
#define STRING_TEST(actual, expected) do { \
	if (strcmp((actual), (expected))) { \
		ast_test_status_update(test, #actual ": expected [%s]; actual [%s]\n", (expected), (actual)); \
		return AST_TEST_FAIL; \
	} } while (0)

/*! \internal
 * \brief Verify that two frames have the same properties
 */
#define VERIFY_FRAME(actual, expected) do { \
	UINT_TEST((actual)->frametype, (expected)->frametype); \
	INT_TEST((actual)->seqno, (expected)->seqno); \
	LONG_INT_TEST((actual)->ts, (expected)->ts); \
	LONG_INT_TEST((actual)->len, (expected)->len); \
	STRING_TEST((actual)->src, (expected)->src); \
} while (0)

/*! \internal
 * \brief Get the implementation for a jitter buffer
 */
#define OBTAIN_JITTERBUFFER_IMPL(impl, ast_jb_type, literal_name) do { \
	(impl) = ast_jb_get_impl((ast_jb_type)); \
	if (!(impl)) { \
		ast_test_status_update(test, "Error: no %s jitterbuffer defined\n", (literal_name)); \
		return AST_TEST_FAIL; \
	} \
	if (strcmp((impl)->name, (literal_name))) { \
		ast_test_status_update(test, "Error: requested %s jitterbuffer and received %s\n", (literal_name), (impl)->name); \
		return AST_TEST_FAIL; \
	} } while (0)

/*! \internal
 * \brief Make a jitter buffer configuration object with default values
 */
#define MAKE_DEFAULT_CONFIG(conf, impl) do { \
	(conf)->flags = DEFAULT_CONFIG_FLAGS; \
	strcpy((conf)->impl, (impl)->name); \
	(conf)->max_size = DEFAULT_CONFIG_SIZE; \
	(conf)->resync_threshold = DEFAULT_CONFIG_RESYNC_THRESHOLD; \
	(conf)->target_extra = DEFAULT_CONFIG_TARGET_EXTRA; \
	} while (0)

/*!
 * \internal
 * \brief A container object for the jitter buffers, used for all tests
 */
static struct ast_jb default_jb = {
	.impl = NULL,
	.jbobj = NULL
};

/*!
 * \internal
 * \brief Construct a test name
 */
#define TEST_NAME(type_name, specifier) type_name ## _  ## specifier

#define TEST_NAME2(test_name) #test_name
#define STRINGIFY_TESTNAME(test_name) TEST_NAME2(test_name)

/*!
 * \internal
 * \brief Test nominal construction of a jitter buffer
 *
 * \param type_name The enum type of the jitter buffer to create
 * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
 */
#define test_create_nominal(type_name, literal_type_name) AST_TEST_DEFINE(TEST_NAME(type_name, create)) {\
	RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
	const struct ast_jb_impl *impl; \
	struct ast_jb_conf conf; \
\
	switch (cmd) { \
	case TEST_INIT: \
		info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, create)); \
		info->category = "/main/abstract_jb/"; \
		info->summary = "Test nominal creation of a " literal_type_name " jitterbuffer"; \
		info->description = \
			"Tests nominal creation of a " literal_type_name " jitterbuffer using the " \
			" jitterbuffer API."; \
		return AST_TEST_NOT_RUN; \
	case TEST_EXECUTE: \
		break; \
	} \
 \
	ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name,  create))"...\n"); \
	OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
	MAKE_DEFAULT_CONFIG(&conf, impl); \
 \
	jb->jbobj = impl->create(&conf); \
	jb->impl = impl; \
	if (!jb->jbobj) { \
		ast_test_status_update(test, "Error: Failed to adaptive jitterbuffer\n"); \
		return AST_TEST_FAIL; \
	} \
 \
	return AST_TEST_PASS; \
}

/*!
 * \internal
 * \brief Test putting the initial frame into a jitter buffer
 *
 * \param type_name The enum type of the jitter buffer to create
 * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
 */
#define test_put_first(type_name, literal_type_name) AST_TEST_DEFINE(TEST_NAME(type_name,  put_first)) {\
	RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
	const struct ast_jb_impl *impl; \
	struct ast_jb_conf conf; \
	RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
	RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
	int res; \
\
	switch (cmd) { \
	case TEST_INIT: \
		info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name,  put_first)); \
		info->category = "/main/abstract_jb/"; \
		info->summary = "Test putting a frame into a " literal_type_name " jitterbuffer"; \
		info->description = \
			"This tests putting a single frame into a " literal_type_name " jitterbuffer " \
			"when the jitterbuffer is empty and verifying that it is indeed " \
			"the first frame on the jitterbufffer"; \
		return AST_TEST_NOT_RUN; \
	case TEST_EXECUTE: \
		break; \
	} \
\
	ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name,  create))"...\n"); \
	OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
	MAKE_DEFAULT_CONFIG(&conf, impl); \
	jb->jbobj = impl->create(&conf); \
	jb->impl = impl; \
	if (!jb->jbobj) { \
		ast_test_status_update(test, "Error: Failed to adaptive jitterbuffer\n"); \
		return AST_TEST_FAIL; \
	} \
\
	expected_frame = create_test_frame(1000, 0); \
	res = jb->impl->put_first(jb->jbobj, \
		expected_frame, \
		1100); \
	if (res != AST_JB_IMPL_OK) { \
		ast_test_status_update(test, "Error: Got %d back from put_first (expected %d)\n", \
			res, AST_JB_IMPL_OK); \
		return AST_TEST_FAIL; \
	} \
\
	res = jb->impl->remove(jb->jbobj, &actual_frame); \
	if (!actual_frame || res != AST_JB_IMPL_OK) { \
		ast_test_status_update(test, "Error: failed to retrieve first frame\n"); \
		return AST_TEST_FAIL; \
	} \
	expected_frame = create_test_frame(1000, 0); \
	VERIFY_FRAME(actual_frame, expected_frame); \
	return AST_TEST_PASS; \
}

/*!
 * \internal
 * \brief Test putting a voice frames into a jitter buffer
 *
 * \param type_name The enum type of the jitter buffer to create
 * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
 */
#define test_put(type_name, literal_type_name) AST_TEST_DEFINE(TEST_NAME(type_name, put)) {\
	RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
	const struct ast_jb_impl *impl; \
	struct ast_jb_conf conf; \
	RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
	RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
	int res; \
	long next; \
	int i; \
\
	switch (cmd) { \
	case TEST_INIT: \
		info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put)); \
		info->category = "/main/abstract_jb/"; \
		info->summary = "Test putting frames onto a " literal_type_name " jitterbuffer"; \
		info->description = \
			"This tests putting multiple frames into a " literal_type_name " jitterbuffer"; \
		return AST_TEST_NOT_RUN; \
	case TEST_EXECUTE: \
		break; \
	} \
\
	ast_test_status_update(test, "Executing "STRINGIFY_TESTNAME(TEST_NAME(type_name, put))"...\n"); \
	OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
	MAKE_DEFAULT_CONFIG(&conf, impl); \
	jb->jbobj = impl->create(&conf); \
	jb->impl = impl; \
\
	expected_frame = create_test_frame(1000, 0); \
	jb->impl->put_first(jb->jbobj, expected_frame, 1100); \
	for (i = 1; i < 10; i++) { \
		expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
		res = jb->impl->put(jb->jbobj, \
			expected_frame, \
			1100 + i * DEFAULT_FRAME_MS); \
		if (res != AST_JB_IMPL_OK) { \
			ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
				i, res, AST_JB_IMPL_OK); \
			return AST_TEST_FAIL; \
		} \
	} \
\
	for (i = 0; i < 10; i++) { \
		expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
		next = jb->impl->next(jb->jbobj); \
		res = jb->impl->get(jb->jbobj, &actual_frame, next, DEFAULT_FRAME_MS); \
		if (res != AST_JB_IMPL_OK) { \
			ast_test_status_update(test, "Error: failed to retrieve frame %i at time %ld\n", \
				i, next); \
			return AST_TEST_FAIL; \
		} \
		VERIFY_FRAME(actual_frame, expected_frame); \
		ast_frfree(expected_frame); \
		expected_frame = NULL; \
	} \
	return AST_TEST_PASS; \
}

/*!
 * \internal
 * \brief Test overflowing the limits of a jitter buffer
 *
 * \param type_name The enum type of the jitter buffer to create
 * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
 * \param overflow_limit The number of frames at which we expect the buffer to overflow
 */
#define test_put_overflow(type_name, literal_type_name, overflow_limit) AST_TEST_DEFINE(TEST_NAME(type_name, put_overflow)) {\
	RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
	const struct ast_jb_impl *impl; \
	struct ast_jb_conf conf; \
	RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
	int res; \
	int i; \
\
	switch (cmd) { \
	case TEST_INIT: \
		info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name,  put_overflow)); \
		info->category = "/main/abstract_jb/"; \
		info->summary = "Test putting frames onto a " literal_type_name " jitterbuffer " \
			"that ends up overflowing the maximum allowed slots in the buffer"; \
		info->description = \
			"This tests putting multiple frames into a " literal_type_name " jitterbuffer " \
			"until the jitterbuffer overflows"; \
		return AST_TEST_NOT_RUN; \
	case TEST_EXECUTE: \
		break; \
	} \
\
	ast_test_status_update(test, "Executing "STRINGIFY_TESTNAME(TEST_NAME(type_name, put_overflow))"...\n"); \
	OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
	MAKE_DEFAULT_CONFIG(&conf, impl); \
	jb->jbobj = impl->create(&conf); \
	jb->impl = impl; \
\
	expected_frame = create_test_frame(1000, 0); \
	jb->impl->put_first(jb->jbobj, expected_frame, 1100); \
	for (i = 1; i <= (overflow_limit); i++) { \
		expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
		res = jb->impl->put(jb->jbobj, \
			expected_frame, \
			1100 + i * DEFAULT_FRAME_MS); \
		if (res != AST_JB_IMPL_OK) { \
			ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
				i, res, AST_JB_IMPL_OK); \
			return AST_TEST_FAIL; \
		} \
	} \
\
	for (i = (overflow_limit)+1; i < (overflow_limit) + 5; i++) { \
		expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
		res = jb->impl->put(jb->jbobj, \
			expected_frame, \
			1100 + i * DEFAULT_FRAME_MS); \
		if (res != AST_JB_IMPL_DROP) { \
			expected_frame = NULL; \
			ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
				i, res, AST_JB_IMPL_DROP); \
			return AST_TEST_FAIL; \
		} \
		ast_frfree(expected_frame); \
		expected_frame = NULL;\
	} \
\
	return AST_TEST_PASS; \
}

/*!
 * \internal
 * \brief Test putting voice frames into a jitter buffer out of order
 *
 * \param type_name The enum type of the jitter buffer to create
 * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
 * \param synch_limit The synchronization limit for this particular type of jitter buffer
 */
#define test_put_out_of_order(type_name, literal_type_name, synch_limit) AST_TEST_DEFINE(TEST_NAME(type_name, put_out_of_order)) {\
	RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
	const struct ast_jb_impl *impl; \
	struct ast_jb_conf conf; \
	RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
	RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
	int res; \
	long next; \
	int i; \
\
	switch (cmd) { \
	case TEST_INIT: \
		info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put_out_of_order)); \
		info->category = "/main/abstract_jb/"; \
		info->summary = "Test putting out of order frames onto a " literal_type_name " jitterbuffer"; \
		info->description = \
			"This tests putting multiple frames into a " literal_type_name " jitterbuffer " \
			"that arrive out of order.  Every 3rd frame is put in out of order."; \
		return AST_TEST_NOT_RUN; \
	case TEST_EXECUTE: \
		break; \
	} \
\
	ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name, put_out_of_order)) "...\n"); \
	OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
	MAKE_DEFAULT_CONFIG(&conf, impl); \
	conf.resync_threshold = (synch_limit); \
	jb->jbobj = impl->create(&conf); \
	jb->impl = impl; \
\
	expected_frame = create_test_frame(1000, 0); \
	jb->impl->put_first(jb->jbobj, expected_frame, 1100); \
	for (i = 1; i <= 10; i++) { \
		if (i % 3 == 1 && i != 10) { \
			expected_frame = create_test_frame(1000 + ((i + 1) * DEFAULT_FRAME_MS), 0); \
		} else if (i % 3 == 2) { \
			expected_frame = create_test_frame(1000 + ((i - 1) * DEFAULT_FRAME_MS), 0); \
		} else { \
			expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
		} \
		res = jb->impl->put(jb->jbobj, \
			expected_frame, \
			1100 + i * DEFAULT_FRAME_MS); \
		if (res != AST_JB_IMPL_OK) { \
			ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
				i, res, AST_JB_IMPL_OK); \
			return AST_TEST_FAIL; \
		} \
	} \
\
	for (i = 0; i <= 10; i++) { \
		expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
		next = jb->impl->next(jb->jbobj); \
		res = jb->impl->get(jb->jbobj, &actual_frame, next, DEFAULT_FRAME_MS); \
		if (res != AST_JB_IMPL_OK) { \
			ast_test_status_update(test, "Error: failed to retrieve frame at %ld\n", \
				next); \
			return AST_TEST_FAIL; \
		} \
		VERIFY_FRAME(actual_frame, expected_frame); \
		ast_frfree(expected_frame); \
		expected_frame = NULL; \
	} \
\
	return AST_TEST_PASS; \
}


test_create_nominal(AST_JB_ADAPTIVE, "adaptive")

test_put_first(AST_JB_ADAPTIVE, "adaptive")

test_put(AST_JB_ADAPTIVE, "adaptive")

test_put_overflow(AST_JB_ADAPTIVE, "adaptive", 10)

test_put_out_of_order(AST_JB_ADAPTIVE, "adaptive", DEFAULT_FRAME_MS * 2)

test_create_nominal(AST_JB_FIXED, "fixed")

test_put_first(AST_JB_FIXED, "fixed")

test_put(AST_JB_FIXED, "fixed")

test_put_overflow(AST_JB_FIXED, "fixed", 12)

test_put_out_of_order(AST_JB_FIXED, "fixed", DEFAULT_CONFIG_RESYNC_THRESHOLD)

static int unload_module(void)
{
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, create));
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_first));
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put));
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_overflow));
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_out_of_order));

	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, create));
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_first));
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put));
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_overflow));
	AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_out_of_order));

	return 0;
}

static int load_module(void)
{
	AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, create));
	AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_first));
	AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put));
	AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_overflow));
	AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_out_of_order));

	AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, create));
	AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_first));
	AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put));
	AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_overflow));
	AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_out_of_order));

	return AST_MODULE_LOAD_SUCCESS;
}

AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Abstract JitterBuffer API Tests");