Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
Macros | Functions | Variables
test_abstract_jb.c File Reference

Abstract Jitterbuffer Tests. More...

#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"
Include dependency graph for test_abstract_jb.c:

Go to the source code of this file.

Macros

#define DEFAULT_CONFIG_FLAGS   0
 
#define DEFAULT_CONFIG_RESYNC_THRESHOLD   (DEFAULT_FRAME_MS) * 2
 
#define DEFAULT_CONFIG_SIZE   (DEFAULT_FRAME_MS) * 10
 
#define DEFAULT_CONFIG_TARGET_EXTRA   -1
 
#define DEFAULT_FRAME_MS   160
 
#define INT_TEST(actual, expected)
 
#define LONG_INT_TEST(actual, expected)
 
#define MAKE_DEFAULT_CONFIG(conf, impl)
 
#define OBTAIN_JITTERBUFFER_IMPL(impl, ast_jb_type, literal_name)
 
#define STRING_TEST(actual, expected)
 
#define STRINGIFY_TESTNAME(test_name)   TEST_NAME2(test_name)
 
#define test_create_nominal(type_name, literal_type_name)
 
#define TEST_NAME(type_name, specifier)   type_name ## _ ## specifier
 
#define TEST_NAME2(test_name)   #test_name
 
#define test_put(type_name, literal_type_name)
 
#define test_put_first(type_name, literal_type_name)
 
#define test_put_out_of_order(type_name, literal_type_name, synch_limit)
 
#define test_put_overflow(type_name, literal_type_name, overflow_limit)
 
#define UINT_TEST(actual, expected)
 
#define VERIFY_FRAME(actual, expected)
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static struct ast_framecreate_test_frame (long timestamp, int seqno)
 
static void dispose_jitterbuffer (struct ast_jb *jb)
 
static int load_module (void)
 
 test_create_nominal (test_put_first(AST_JB_ADAPTIVE, test_put_first("adaptive")
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Abstract JitterBuffer API Tests" , .key = ASTERISK_GPL_KEY , .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_infoast_module_info = &__mod_info
 
static struct ast_jb default_jb
 

Detailed Description

Abstract Jitterbuffer Tests.

Author
Matt Jordan <mjordan@digium.com> 

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.

Definition in file test_abstract_jb.c.

Macro Definition Documentation

◆ DEFAULT_CONFIG_FLAGS

#define DEFAULT_CONFIG_FLAGS   0

Definition at line 47 of file test_abstract_jb.c.

◆ DEFAULT_CONFIG_RESYNC_THRESHOLD

#define DEFAULT_CONFIG_RESYNC_THRESHOLD   (DEFAULT_FRAME_MS) * 2

Definition at line 49 of file test_abstract_jb.c.

◆ DEFAULT_CONFIG_SIZE

#define DEFAULT_CONFIG_SIZE   (DEFAULT_FRAME_MS) * 10

Definition at line 48 of file test_abstract_jb.c.

◆ DEFAULT_CONFIG_TARGET_EXTRA

#define DEFAULT_CONFIG_TARGET_EXTRA   -1

Definition at line 50 of file test_abstract_jb.c.

◆ DEFAULT_FRAME_MS

#define DEFAULT_FRAME_MS   160

Definition at line 46 of file test_abstract_jb.c.

◆ INT_TEST

#define INT_TEST (   actual,
  expected 
)
Value:
do { \
if ((actual) != (expected)) { \
ast_test_status_update(test, #actual ": expected [%d]; actual [%d]\n", (expected), (actual)); \
return AST_TEST_FAIL; \
} } while (0)
@ AST_TEST_FAIL
Definition test.h:196

Definition at line 109 of file test_abstract_jb.c.

109 { \
110 if ((actual) != (expected)) { \
111 ast_test_status_update(test, #actual ": expected [%d]; actual [%d]\n", (expected), (actual)); \
112 return AST_TEST_FAIL; \
113 } } while (0)

◆ LONG_INT_TEST

#define LONG_INT_TEST (   actual,
  expected 
)
Value:
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)

Definition at line 100 of file test_abstract_jb.c.

100 { \
101 if ((actual) != (expected)) { \
102 ast_test_status_update(test, #actual ": expected [%ld]; actual [%ld]\n", (long int)(expected), (long int)(actual)); \
103 return AST_TEST_FAIL; \
104 } } while (0)

◆ MAKE_DEFAULT_CONFIG

#define MAKE_DEFAULT_CONFIG (   conf,
  impl 
)

Definition at line 161 of file test_abstract_jb.c.

161 { \
162 (conf)->flags = DEFAULT_CONFIG_FLAGS; \
163 strcpy((conf)->impl, (impl)->name); \
164 (conf)->max_size = DEFAULT_CONFIG_SIZE; \
165 (conf)->resync_threshold = DEFAULT_CONFIG_RESYNC_THRESHOLD; \
166 (conf)->target_extra = DEFAULT_CONFIG_TARGET_EXTRA; \
167 } while (0)
static const char name[]
Definition format_mp3.c:68
All configuration options for http media cache.
#define DEFAULT_CONFIG_FLAGS
#define DEFAULT_CONFIG_SIZE
#define DEFAULT_CONFIG_RESYNC_THRESHOLD
#define DEFAULT_CONFIG_TARGET_EXTRA

◆ OBTAIN_JITTERBUFFER_IMPL

#define OBTAIN_JITTERBUFFER_IMPL (   impl,
  ast_jb_type,
  literal_name 
)

Definition at line 147 of file test_abstract_jb.c.

147 { \
148 (impl) = ast_jb_get_impl((ast_jb_type)); \
149 if (!(impl)) { \
150 ast_test_status_update(test, "Error: no %s jitterbuffer defined\n", (literal_name)); \
151 return AST_TEST_FAIL; \
152 } \
153 if (strcmp((impl)->name, (literal_name))) { \
154 ast_test_status_update(test, "Error: requested %s jitterbuffer and received %s\n", (literal_name), (impl)->name); \
155 return AST_TEST_FAIL; \
156 } } while (0)
ast_jb_type
Definition abstract_jb.h:51
const struct ast_jb_impl * ast_jb_get_impl(enum ast_jb_type type)

◆ STRING_TEST

#define STRING_TEST (   actual,
  expected 
)
Value:
do { \
if (strcmp((actual), (expected))) { \
ast_test_status_update(test, #actual ": expected [%s]; actual [%s]\n", (expected), (actual)); \
return AST_TEST_FAIL; \
} } while (0)

Definition at line 127 of file test_abstract_jb.c.

127 { \
128 if (strcmp((actual), (expected))) { \
129 ast_test_status_update(test, #actual ": expected [%s]; actual [%s]\n", (expected), (actual)); \
130 return AST_TEST_FAIL; \
131 } } while (0)

◆ STRINGIFY_TESTNAME

#define STRINGIFY_TESTNAME (   test_name)    TEST_NAME2(test_name)

Definition at line 185 of file test_abstract_jb.c.

◆ test_create_nominal

#define test_create_nominal (   type_name,
  literal_type_name 
)

Definition at line 194 of file test_abstract_jb.c.

194 {\
195 RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
196 const struct ast_jb_impl *impl; \
197 struct ast_jb_conf conf; \
198\
199 switch (cmd) { \
200 case TEST_INIT: \
201 info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, create)); \
202 info->category = "/main/abstract_jb/"; \
203 info->summary = "Test nominal creation of a " literal_type_name " jitterbuffer"; \
204 info->description = \
205 "Tests nominal creation of a " literal_type_name " jitterbuffer using the " \
206 " jitterbuffer API."; \
207 return AST_TEST_NOT_RUN; \
208 case TEST_EXECUTE: \
209 break; \
210 } \
211 \
212 ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name, create))"...\n"); \
213 OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
214 MAKE_DEFAULT_CONFIG(&conf, impl); \
215 \
216 jb->jbobj = impl->create(&conf); \
217 jb->impl = impl; \
218 if (!jb->jbobj) { \
219 ast_test_status_update(test, "Error: Failed to adaptive jitterbuffer\n"); \
220 return AST_TEST_FAIL; \
221 } \
222 \
223 return AST_TEST_PASS; \
224}
General jitterbuffer configuration.
Definition abstract_jb.h:70
char impl[AST_JB_IMPL_NAME_SIZE]
Name of the jitterbuffer implementation to be used.
Definition abstract_jb.h:78
Jitterbuffer implementation struct.
General jitterbuffer state.
@ TEST_INIT
Definition test.h:200
@ TEST_EXECUTE
Definition test.h:201
@ AST_TEST_PASS
Definition test.h:195
@ AST_TEST_NOT_RUN
Definition test.h:194
#define STRINGIFY_TESTNAME(test_name)
static struct ast_jb default_jb
static void dispose_jitterbuffer(struct ast_jb *jb)
#define TEST_NAME(type_name, specifier)

◆ TEST_NAME

#define TEST_NAME (   type_name,
  specifier 
)    type_name ## _ ## specifier

Definition at line 182 of file test_abstract_jb.c.

◆ TEST_NAME2

#define TEST_NAME2 (   test_name)    #test_name

Definition at line 184 of file test_abstract_jb.c.

◆ test_put

#define test_put (   type_name,
  literal_type_name 
)

Definition at line 292 of file test_abstract_jb.c.

292 {\
293 RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
294 const struct ast_jb_impl *impl; \
295 struct ast_jb_conf conf; \
296 struct ast_frame *expected_frame = NULL; \
297 struct ast_frame *actual_frame = NULL; \
298 int res; \
299 long next; \
300 int i; \
301\
302 switch (cmd) { \
303 case TEST_INIT: \
304 info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put)); \
305 info->category = "/main/abstract_jb/"; \
306 info->summary = "Test putting frames onto a " literal_type_name " jitterbuffer"; \
307 info->description = \
308 "This tests putting multiple frames into a " literal_type_name " jitterbuffer"; \
309 return AST_TEST_NOT_RUN; \
310 case TEST_EXECUTE: \
311 break; \
312 } \
313\
314 ast_test_status_update(test, "Executing "STRINGIFY_TESTNAME(TEST_NAME(type_name, put))"...\n"); \
315 OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
316 MAKE_DEFAULT_CONFIG(&conf, impl); \
317 jb->jbobj = impl->create(&conf); \
318 jb->impl = impl; \
319\
320 expected_frame = create_test_frame(1000, 0); \
321 res = jb->impl->put_first(jb->jbobj, \
322 expected_frame, \
323 1100); \
324 if (res != AST_JB_IMPL_OK) { \
325 ast_test_status_update(test, "Error: On first frame, got %d back from put_first (expected %d)\n", \
326 res, AST_JB_IMPL_OK); \
327 ast_frame_dtor(expected_frame); \
328 return AST_TEST_FAIL; \
329 } \
330 for (i = 1; i < 10; i++) { \
331 expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
332 res = jb->impl->put(jb->jbobj, \
333 expected_frame, \
334 1100 + i * DEFAULT_FRAME_MS); \
335 if (res != AST_JB_IMPL_OK) { \
336 ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
337 i, res, AST_JB_IMPL_OK); \
338 ast_frame_dtor(expected_frame); \
339 return AST_TEST_FAIL; \
340 } \
341 } \
342\
343 for (i = 0; i < 10; i++) { \
344 expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
345 next = jb->impl->next(jb->jbobj); \
346 res = jb->impl->get(jb->jbobj, &actual_frame, next, DEFAULT_FRAME_MS); \
347 if (res != AST_JB_IMPL_OK) { \
348 ast_test_status_update(test, "Error: failed to retrieve frame %i at time %ld\n", \
349 i, next); \
350 ast_frame_dtor(expected_frame); \
351 return AST_TEST_FAIL; \
352 } \
353 VERIFY_FRAME(actual_frame, expected_frame); \
354 ast_frame_dtor(expected_frame); \
355 ast_frame_dtor(actual_frame); \
356 } \
357 return AST_TEST_PASS; \
358}
@ AST_JB_IMPL_OK
Definition abstract_jb.h:58
#define NULL
Definition resample.c:96
Data structure associated with a single frame of data.
struct ast_frame * next
jb_create_impl create
static struct ast_frame * create_test_frame(long timestamp, int seqno)
#define DEFAULT_FRAME_MS

◆ test_put_first

#define test_put_first (   type_name,
  literal_type_name 
)

Definition at line 233 of file test_abstract_jb.c.

233 {\
234 RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
235 const struct ast_jb_impl *impl; \
236 struct ast_jb_conf conf; \
237 RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
238 RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
239 int res; \
240\
241 switch (cmd) { \
242 case TEST_INIT: \
243 info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put_first)); \
244 info->category = "/main/abstract_jb/"; \
245 info->summary = "Test putting a frame into a " literal_type_name " jitterbuffer"; \
246 info->description = \
247 "This tests putting a single frame into a " literal_type_name " jitterbuffer " \
248 "when the jitterbuffer is empty and verifying that it is indeed " \
249 "the first frame on the jitterbuffer"; \
250 return AST_TEST_NOT_RUN; \
251 case TEST_EXECUTE: \
252 break; \
253 } \
254\
255 ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name, create))"...\n"); \
256 OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
257 MAKE_DEFAULT_CONFIG(&conf, impl); \
258 jb->jbobj = impl->create(&conf); \
259 jb->impl = impl; \
260 if (!jb->jbobj) { \
261 ast_test_status_update(test, "Error: Failed to adaptive jitterbuffer\n"); \
262 return AST_TEST_FAIL; \
263 } \
264\
265 expected_frame = create_test_frame(1000, 0); \
266 res = jb->impl->put_first(jb->jbobj, \
267 expected_frame, \
268 1100); \
269 if (res != AST_JB_IMPL_OK) { \
270 ast_test_status_update(test, "Error: Got %d back from put_first (expected %d)\n", \
271 res, AST_JB_IMPL_OK); \
272 return AST_TEST_FAIL; \
273 } \
274\
275 res = jb->impl->remove(jb->jbobj, &actual_frame); \
276 if (!actual_frame || res != AST_JB_IMPL_OK) { \
277 ast_test_status_update(test, "Error: failed to retrieve first frame\n"); \
278 return AST_TEST_FAIL; \
279 } \
280 expected_frame = create_test_frame(1000, 0); \
281 VERIFY_FRAME(actual_frame, expected_frame); \
282 return AST_TEST_PASS; \
283}
void ast_frame_dtor(struct ast_frame *frame)
NULL-safe wrapper for ast_frfree, good for RAII_VAR.
Definition main/frame.c:187

◆ test_put_out_of_order

#define test_put_out_of_order (   type_name,
  literal_type_name,
  synch_limit 
)

Definition at line 436 of file test_abstract_jb.c.

436 {\
437 RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
438 const struct ast_jb_impl *impl; \
439 struct ast_jb_conf conf; \
440 struct ast_frame *expected_frame = NULL; \
441 struct ast_frame *actual_frame = NULL; \
442 int res; \
443 long next; \
444 int i; \
445\
446 switch (cmd) { \
447 case TEST_INIT: \
448 info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put_out_of_order)); \
449 info->category = "/main/abstract_jb/"; \
450 info->summary = "Test putting out of order frames onto a " literal_type_name " jitterbuffer"; \
451 info->description = \
452 "This tests putting multiple frames into a " literal_type_name " jitterbuffer " \
453 "that arrive out of order. Every 3rd frame is put in out of order."; \
454 return AST_TEST_NOT_RUN; \
455 case TEST_EXECUTE: \
456 break; \
457 } \
458\
459 ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name, put_out_of_order)) "...\n"); \
460 OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
461 MAKE_DEFAULT_CONFIG(&conf, impl); \
462 conf.resync_threshold = (synch_limit); \
463 jb->jbobj = impl->create(&conf); \
464 jb->impl = impl; \
465\
466 expected_frame = create_test_frame(1000, 0); \
467 res = jb->impl->put_first(jb->jbobj, expected_frame, 1100); \
468 if (res != AST_JB_IMPL_OK) { \
469 ast_test_status_update(test, "Error: On first frame, got %d back from put_first (expected %d)\n", \
470 res, AST_JB_IMPL_OK); \
471 ast_frame_dtor(expected_frame); \
472 return AST_TEST_FAIL; \
473 } \
474 for (i = 1; i <= 10; i++) { \
475 if (i % 3 == 1 && i != 10) { \
476 expected_frame = create_test_frame(1000 + ((i + 1) * DEFAULT_FRAME_MS), 0); \
477 } else if (i % 3 == 2) { \
478 expected_frame = create_test_frame(1000 + ((i - 1) * DEFAULT_FRAME_MS), 0); \
479 } else { \
480 expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
481 } \
482 res = jb->impl->put(jb->jbobj, \
483 expected_frame, \
484 1100 + i * DEFAULT_FRAME_MS); \
485 if (res != AST_JB_IMPL_OK) { \
486 ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
487 i, res, AST_JB_IMPL_OK); \
488 ast_frame_dtor(expected_frame); \
489 return AST_TEST_FAIL; \
490 } \
491 } \
492\
493 for (i = 0; i <= 10; i++) { \
494 expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
495 next = jb->impl->next(jb->jbobj); \
496 res = jb->impl->get(jb->jbobj, &actual_frame, next, DEFAULT_FRAME_MS); \
497 if (res != AST_JB_IMPL_OK) { \
498 ast_test_status_update(test, "Error: failed to retrieve frame at %ld\n", \
499 next); \
500 ast_frame_dtor(expected_frame); \
501 return AST_TEST_FAIL; \
502 } \
503 VERIFY_FRAME(actual_frame, expected_frame); \
504 ast_frame_dtor(expected_frame); \
505 ast_frame_dtor(actual_frame); \
506 expected_frame = NULL; \
507 } \
508\
509 return AST_TEST_PASS; \
510}

◆ test_put_overflow

#define test_put_overflow (   type_name,
  literal_type_name,
  overflow_limit 
)

Definition at line 368 of file test_abstract_jb.c.

368 {\
369 RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
370 const struct ast_jb_impl *impl; \
371 struct ast_jb_conf conf; \
372 RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
373 int res; \
374 int i; \
375\
376 switch (cmd) { \
377 case TEST_INIT: \
378 info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put_overflow)); \
379 info->category = "/main/abstract_jb/"; \
380 info->summary = "Test putting frames onto a " literal_type_name " jitterbuffer " \
381 "that ends up overflowing the maximum allowed slots in the buffer"; \
382 info->description = \
383 "This tests putting multiple frames into a " literal_type_name " jitterbuffer " \
384 "until the jitterbuffer overflows"; \
385 return AST_TEST_NOT_RUN; \
386 case TEST_EXECUTE: \
387 break; \
388 } \
389\
390 ast_test_status_update(test, "Executing "STRINGIFY_TESTNAME(TEST_NAME(type_name, put_overflow))"...\n"); \
391 OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
392 MAKE_DEFAULT_CONFIG(&conf, impl); \
393 jb->jbobj = impl->create(&conf); \
394 jb->impl = impl; \
395\
396 expected_frame = create_test_frame(1000, 0); \
397 jb->impl->put_first(jb->jbobj, expected_frame, 1100); \
398 for (i = 1; i <= (overflow_limit); i++) { \
399 expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
400 res = jb->impl->put(jb->jbobj, \
401 expected_frame, \
402 1100 + i * DEFAULT_FRAME_MS); \
403 if (res != AST_JB_IMPL_OK) { \
404 ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
405 i, res, AST_JB_IMPL_OK); \
406 return AST_TEST_FAIL; \
407 } \
408 } \
409\
410 for (i = (overflow_limit)+1; i < (overflow_limit) + 5; i++) { \
411 expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
412 res = jb->impl->put(jb->jbobj, \
413 expected_frame, \
414 1100 + i * DEFAULT_FRAME_MS); \
415 if (res != AST_JB_IMPL_DROP) { \
416 expected_frame = NULL; \
417 ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
418 i, res, AST_JB_IMPL_DROP); \
419 return AST_TEST_FAIL; \
420 } \
421 ast_frfree(expected_frame); \
422 expected_frame = NULL;\
423 } \
424\
425 return AST_TEST_PASS; \
426}
@ AST_JB_IMPL_DROP
Definition abstract_jb.h:59

◆ UINT_TEST

#define UINT_TEST (   actual,
  expected 
)
Value:
do { \
if ((actual) != (expected)) { \
ast_test_status_update(test, #actual ": expected [%u]; actual [%u]\n", (expected), (actual)); \
return AST_TEST_FAIL; \
} } while (0)

Definition at line 118 of file test_abstract_jb.c.

118 { \
119 if ((actual) != (expected)) { \
120 ast_test_status_update(test, #actual ": expected [%u]; actual [%u]\n", (expected), (actual)); \
121 return AST_TEST_FAIL; \
122 } } while (0)

◆ VERIFY_FRAME

#define VERIFY_FRAME (   actual,
  expected 
)

Definition at line 136 of file test_abstract_jb.c.

136 { \
137 UINT_TEST((actual)->frametype, (expected)->frametype); \
138 INT_TEST((actual)->seqno, (expected)->seqno); \
139 LONG_INT_TEST((actual)->ts, (expected)->ts); \
140 LONG_INT_TEST((actual)->len, (expected)->len); \
141 STRING_TEST((actual)->src, (expected)->src); \
142} while (0)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 567 of file test_abstract_jb.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 567 of file test_abstract_jb.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 567 of file test_abstract_jb.c.

◆ create_test_frame()

static struct ast_frame * create_test_frame ( long  timestamp,
int  seqno 
)
static

Definition at line 82 of file test_abstract_jb.c.

84{
85 struct ast_frame f = {0};
86
89 f.src = "TEST";
90 f.ts = timestamp;
92 f.seqno = seqno;
93
94 return ast_frisolate(&f);
95}
struct ast_format * ast_format_slin
Built-in cached signed linear 8kHz format.
#define ast_frisolate(fr)
Makes a frame independent of any static storage.
struct ast_format * format
struct ast_frame_subclass subclass
enum ast_frame_type frametype

References ast_format_slin, AST_FRAME_VOICE, ast_frisolate, DEFAULT_FRAME_MS, ast_frame_subclass::format, ast_frame::frametype, ast_frame::len, ast_frame::seqno, ast_frame::src, ast_frame::subclass, and ast_frame::ts.

◆ dispose_jitterbuffer()

static void dispose_jitterbuffer ( struct ast_jb jb)
static

Definition at line 60 of file test_abstract_jb.c.

61{
62 if (!jb || !jb->impl || !jb->jbobj) {
63 return;
64 }
65
66 jb->impl->empty_and_reset(jb->jbobj);
67
68 jb->impl->destroy(jb->jbobj);
69 jb->impl = NULL;
70 jb->jbobj = NULL;
71}
jb_destroy_impl destroy
jb_empty_and_reset_impl empty_and_reset
void * jbobj
Jitterbuffer object, passed to the implementation.
const struct ast_jb_impl * impl
Jitterbuffer implementation to be used.

References ast_jb_impl::destroy, ast_jb_impl::empty_and_reset, ast_jb::impl, ast_jb::jbobj, and NULL.

◆ load_module()

static int load_module ( void  )
static

Definition at line 550 of file test_abstract_jb.c.

551{
556 AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_out_of_order));
557
562 AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_out_of_order));
563
565}
@ AST_JB_ADAPTIVE
Definition abstract_jb.h:53
@ AST_JB_FIXED
Definition abstract_jb.h:52
@ AST_MODULE_LOAD_SUCCESS
Definition module.h:70
#define AST_TEST_REGISTER(cb)
Definition test.h:127

References AST_JB_ADAPTIVE, AST_JB_FIXED, AST_MODULE_LOAD_SUCCESS, AST_TEST_REGISTER, and TEST_NAME.

◆ test_create_nominal()

test_create_nominal ( test_put_first AST_JB_ADAPTIVE,
test_put_first "adaptive" 
)

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Abstract JitterBuffer API Tests" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 567 of file test_abstract_jb.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 567 of file test_abstract_jb.c.

◆ default_jb

struct ast_jb default_jb
static
Initial value:
= {
.impl = NULL,
.jbobj = NULL
}

Definition at line 173 of file test_abstract_jb.c.

173 {
174 .impl = NULL,
175 .jbobj = NULL
176};