test_abstract_jb.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 2012, Matt Jordan
  5. *
  6. * Matt Jordan <mjordan@digium.com>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. /*!
  19. * \file
  20. * \brief Abstract Jitterbuffer Tests
  21. *
  22. * \author \verbatim Matt Jordan <mjordan@digium.com> \endverbatim
  23. *
  24. * Tests the abstract jitter buffer API. This tests both adaptive and fixed
  25. * jitter buffers. Functions defined in abstract_jb that are not part of the
  26. * abstract jitter buffer API are not tested by this unit test.
  27. *
  28. * \ingroup tests
  29. */
  30. /*** MODULEINFO
  31. <depend>TEST_FRAMEWORK</depend>
  32. <support_level>core</support_level>
  33. ***/
  34. #include "asterisk.h"
  35. ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
  36. #include "asterisk/utils.h"
  37. #include "asterisk/module.h"
  38. #include "asterisk/test.h"
  39. #include "asterisk/abstract_jb.h"
  40. #include "asterisk/frame.h"
  41. #define DEFAULT_FRAME_MS 160
  42. #define DEFAULT_CONFIG_FLAGS 0
  43. #define DEFAULT_CONFIG_SIZE (DEFAULT_FRAME_MS) * 10
  44. #define DEFAULT_CONFIG_RESYNC_THRESHOLD (DEFAULT_FRAME_MS) * 2
  45. #define DEFAULT_CONFIG_TARGET_EXTRA -1
  46. /*!
  47. * \internal
  48. * \brief Destructor for a jitter buffer
  49. *
  50. * \param jb The jitter buffer to destroy
  51. *
  52. * \note This will destroy all frames still in the jitter buffer
  53. */
  54. static void dispose_jitterbuffer(struct ast_jb *jb)
  55. {
  56. if (!jb || !jb->impl || !jb->jbobj) {
  57. return;
  58. }
  59. jb->impl->empty_and_reset(jb->jbobj);
  60. jb->impl->destroy(jb->jbobj);
  61. jb->impl = NULL;
  62. jb->jbobj = NULL;
  63. }
  64. /*!
  65. * \internal
  66. * \brief Create a test frame
  67. *
  68. * \param timestamp the time in ms of the frame
  69. * \param seqno the frame's sequence number
  70. *
  71. * \returns a malloc'd frame
  72. */
  73. static struct ast_frame *create_test_frame(long timestamp,
  74. int seqno)
  75. {
  76. struct ast_frame f = {0};
  77. f.subclass.format.id = AST_FORMAT_SLINEAR;
  78. f.frametype = AST_FRAME_VOICE;
  79. f.src = "TEST";
  80. f.ts = timestamp;
  81. f.len = DEFAULT_FRAME_MS;
  82. f.seqno = seqno;
  83. return ast_frisolate(&f);
  84. }
  85. /*! \internal
  86. * \brief Test two numeric (long int) values.
  87. */
  88. #define LONG_INT_TEST(actual, expected) do { \
  89. if ((actual) != (expected)) { \
  90. ast_test_status_update(test, #actual ": expected [%ld]; actual [%ld]\n", (long int)(expected), (long int)(actual)); \
  91. return AST_TEST_FAIL; \
  92. } } while (0)
  93. /*! \internal
  94. * \brief Test two numeric (int) values.
  95. */
  96. #define INT_TEST(actual, expected) do { \
  97. if ((actual) != (expected)) { \
  98. ast_test_status_update(test, #actual ": expected [%d]; actual [%d]\n", (expected), (actual)); \
  99. return AST_TEST_FAIL; \
  100. } } while (0)
  101. /*! \internal
  102. * \brief Test two numeric (unsigned int) values.
  103. */
  104. #define UINT_TEST(actual, expected) do { \
  105. if ((actual) != (expected)) { \
  106. ast_test_status_update(test, #actual ": expected [%u]; actual [%u]\n", (expected), (actual)); \
  107. return AST_TEST_FAIL; \
  108. } } while (0)
  109. /*! \internal
  110. * \brief Test two string values
  111. */
  112. #define STRING_TEST(actual, expected) do { \
  113. if (strcmp((actual), (expected))) { \
  114. ast_test_status_update(test, #actual ": expected [%s]; actual [%s]\n", (expected), (actual)); \
  115. return AST_TEST_FAIL; \
  116. } } while (0)
  117. /*! \internal
  118. * \brief Verify that two frames have the same properties
  119. */
  120. #define VERIFY_FRAME(actual, expected) do { \
  121. UINT_TEST((actual)->frametype, (expected)->frametype); \
  122. INT_TEST((actual)->seqno, (expected)->seqno); \
  123. LONG_INT_TEST((actual)->ts, (expected)->ts); \
  124. LONG_INT_TEST((actual)->len, (expected)->len); \
  125. STRING_TEST((actual)->src, (expected)->src); \
  126. } while (0)
  127. /*! \internal
  128. * \brief Get the implementation for a jitter buffer
  129. */
  130. #define OBTAIN_JITTERBUFFER_IMPL(impl, ast_jb_type, literal_name) do { \
  131. (impl) = ast_jb_get_impl((ast_jb_type)); \
  132. if (!(impl)) { \
  133. ast_test_status_update(test, "Error: no %s jitterbuffer defined\n", (literal_name)); \
  134. return AST_TEST_FAIL; \
  135. } \
  136. if (strcmp((impl)->name, (literal_name))) { \
  137. ast_test_status_update(test, "Error: requested %s jitterbuffer and received %s\n", (literal_name), (impl)->name); \
  138. return AST_TEST_FAIL; \
  139. } } while (0)
  140. /*! \internal
  141. * \brief Make a jitter buffer configuration object with default values
  142. */
  143. #define MAKE_DEFAULT_CONFIG(conf, impl) do { \
  144. (conf)->flags = DEFAULT_CONFIG_FLAGS; \
  145. strcpy((conf)->impl, (impl)->name); \
  146. (conf)->max_size = DEFAULT_CONFIG_SIZE; \
  147. (conf)->resync_threshold = DEFAULT_CONFIG_RESYNC_THRESHOLD; \
  148. (conf)->target_extra = DEFAULT_CONFIG_TARGET_EXTRA; \
  149. } while (0)
  150. /*!
  151. * \internal
  152. * \brief A container object for the jitter buffers, used for all tests
  153. */
  154. static struct ast_jb default_jb = {
  155. .impl = NULL,
  156. .jbobj = NULL
  157. };
  158. /*!
  159. * \internal
  160. * \brief Construct a test name
  161. */
  162. #define TEST_NAME(type_name, specifier) type_name ## _ ## specifier
  163. #define TEST_NAME2(test_name) #test_name
  164. #define STRINGIFY_TESTNAME(test_name) TEST_NAME2(test_name)
  165. /*!
  166. * \internal
  167. * \brief Test nominal construction of a jitter buffer
  168. *
  169. * \param type_name The enum type of the jitter buffer to create
  170. * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
  171. */
  172. #define test_create_nominal(type_name, literal_type_name) AST_TEST_DEFINE(TEST_NAME(type_name, create)) {\
  173. RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
  174. const struct ast_jb_impl *impl; \
  175. struct ast_jb_conf conf; \
  176. \
  177. switch (cmd) { \
  178. case TEST_INIT: \
  179. info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, create)); \
  180. info->category = "/main/abstract_jb/"; \
  181. info->summary = "Test nominal creation of a " literal_type_name " jitterbuffer"; \
  182. info->description = \
  183. "Tests nominal creation of a " literal_type_name " jitterbuffer using the " \
  184. " jitterbuffer API."; \
  185. return AST_TEST_NOT_RUN; \
  186. case TEST_EXECUTE: \
  187. break; \
  188. } \
  189. \
  190. ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name, create))"...\n"); \
  191. OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
  192. MAKE_DEFAULT_CONFIG(&conf, impl); \
  193. \
  194. jb->jbobj = impl->create(&conf); \
  195. jb->impl = impl; \
  196. if (!jb->jbobj) { \
  197. ast_test_status_update(test, "Error: Failed to adaptive jitterbuffer\n"); \
  198. return AST_TEST_FAIL; \
  199. } \
  200. \
  201. return AST_TEST_PASS; \
  202. }
  203. /*!
  204. * \internal
  205. * \brief Test putting the initial frame into a jitter buffer
  206. *
  207. * \param type_name The enum type of the jitter buffer to create
  208. * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
  209. */
  210. #define test_put_first(type_name, literal_type_name) AST_TEST_DEFINE(TEST_NAME(type_name, put_first)) {\
  211. RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
  212. const struct ast_jb_impl *impl; \
  213. struct ast_jb_conf conf; \
  214. RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
  215. RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
  216. int res; \
  217. \
  218. switch (cmd) { \
  219. case TEST_INIT: \
  220. info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put_first)); \
  221. info->category = "/main/abstract_jb/"; \
  222. info->summary = "Test putting a frame into a " literal_type_name " jitterbuffer"; \
  223. info->description = \
  224. "This tests putting a single frame into a " literal_type_name " jitterbuffer " \
  225. "when the jitterbuffer is empty and verifying that it is indeed " \
  226. "the first frame on the jitterbufffer"; \
  227. return AST_TEST_NOT_RUN; \
  228. case TEST_EXECUTE: \
  229. break; \
  230. } \
  231. \
  232. ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name, create))"...\n"); \
  233. OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
  234. MAKE_DEFAULT_CONFIG(&conf, impl); \
  235. jb->jbobj = impl->create(&conf); \
  236. jb->impl = impl; \
  237. if (!jb->jbobj) { \
  238. ast_test_status_update(test, "Error: Failed to adaptive jitterbuffer\n"); \
  239. return AST_TEST_FAIL; \
  240. } \
  241. \
  242. expected_frame = create_test_frame(1000, 0); \
  243. res = jb->impl->put_first(jb->jbobj, \
  244. expected_frame, \
  245. 1100); \
  246. if (res != AST_JB_IMPL_OK) { \
  247. ast_test_status_update(test, "Error: Got %d back from put_first (expected %d)\n", \
  248. res, AST_JB_IMPL_OK); \
  249. return AST_TEST_FAIL; \
  250. } \
  251. \
  252. res = jb->impl->remove(jb->jbobj, &actual_frame); \
  253. if (!actual_frame || res != AST_JB_IMPL_OK) { \
  254. ast_test_status_update(test, "Error: failed to retrieve first frame\n"); \
  255. return AST_TEST_FAIL; \
  256. } \
  257. expected_frame = create_test_frame(1000, 0); \
  258. VERIFY_FRAME(actual_frame, expected_frame); \
  259. return AST_TEST_PASS; \
  260. }
  261. /*!
  262. * \internal
  263. * \brief Test putting a voice frames into a jitter buffer
  264. *
  265. * \param type_name The enum type of the jitter buffer to create
  266. * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
  267. */
  268. #define test_put(type_name, literal_type_name) AST_TEST_DEFINE(TEST_NAME(type_name, put)) {\
  269. RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
  270. const struct ast_jb_impl *impl; \
  271. struct ast_jb_conf conf; \
  272. RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
  273. RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
  274. int res; \
  275. long next; \
  276. int i; \
  277. \
  278. switch (cmd) { \
  279. case TEST_INIT: \
  280. info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put)); \
  281. info->category = "/main/abstract_jb/"; \
  282. info->summary = "Test putting frames onto a " literal_type_name " jitterbuffer"; \
  283. info->description = \
  284. "This tests putting multiple frames into a " literal_type_name " jitterbuffer"; \
  285. return AST_TEST_NOT_RUN; \
  286. case TEST_EXECUTE: \
  287. break; \
  288. } \
  289. \
  290. ast_test_status_update(test, "Executing "STRINGIFY_TESTNAME(TEST_NAME(type_name, put))"...\n"); \
  291. OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
  292. MAKE_DEFAULT_CONFIG(&conf, impl); \
  293. jb->jbobj = impl->create(&conf); \
  294. jb->impl = impl; \
  295. \
  296. expected_frame = create_test_frame(1000, 0); \
  297. jb->impl->put_first(jb->jbobj, expected_frame, 1100); \
  298. for (i = 1; i < 10; i++) { \
  299. expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
  300. res = jb->impl->put(jb->jbobj, \
  301. expected_frame, \
  302. 1100 + i * DEFAULT_FRAME_MS); \
  303. if (res != AST_JB_IMPL_OK) { \
  304. ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
  305. i, res, AST_JB_IMPL_OK); \
  306. return AST_TEST_FAIL; \
  307. } \
  308. } \
  309. \
  310. for (i = 0; i < 10; i++) { \
  311. expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
  312. next = jb->impl->next(jb->jbobj); \
  313. res = jb->impl->get(jb->jbobj, &actual_frame, next, DEFAULT_FRAME_MS); \
  314. if (res != AST_JB_IMPL_OK) { \
  315. ast_test_status_update(test, "Error: failed to retrieve frame %i at time %ld\n", \
  316. i, next); \
  317. return AST_TEST_FAIL; \
  318. } \
  319. VERIFY_FRAME(actual_frame, expected_frame); \
  320. ast_frfree(expected_frame); \
  321. expected_frame = NULL; \
  322. } \
  323. return AST_TEST_PASS; \
  324. }
  325. /*!
  326. * \internal
  327. * \brief Test overflowing the limits of a jitter buffer
  328. *
  329. * \param type_name The enum type of the jitter buffer to create
  330. * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
  331. * \param overflow_limit The number of frames at which we expect the buffer to overflow
  332. */
  333. #define test_put_overflow(type_name, literal_type_name, overflow_limit) AST_TEST_DEFINE(TEST_NAME(type_name, put_overflow)) {\
  334. RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
  335. const struct ast_jb_impl *impl; \
  336. struct ast_jb_conf conf; \
  337. RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
  338. int res; \
  339. int i; \
  340. \
  341. switch (cmd) { \
  342. case TEST_INIT: \
  343. info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put_overflow)); \
  344. info->category = "/main/abstract_jb/"; \
  345. info->summary = "Test putting frames onto a " literal_type_name " jitterbuffer " \
  346. "that ends up overflowing the maximum allowed slots in the buffer"; \
  347. info->description = \
  348. "This tests putting multiple frames into a " literal_type_name " jitterbuffer " \
  349. "until the jitterbuffer overflows"; \
  350. return AST_TEST_NOT_RUN; \
  351. case TEST_EXECUTE: \
  352. break; \
  353. } \
  354. \
  355. ast_test_status_update(test, "Executing "STRINGIFY_TESTNAME(TEST_NAME(type_name, put_overflow))"...\n"); \
  356. OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
  357. MAKE_DEFAULT_CONFIG(&conf, impl); \
  358. jb->jbobj = impl->create(&conf); \
  359. jb->impl = impl; \
  360. \
  361. expected_frame = create_test_frame(1000, 0); \
  362. jb->impl->put_first(jb->jbobj, expected_frame, 1100); \
  363. for (i = 1; i <= (overflow_limit); i++) { \
  364. expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
  365. res = jb->impl->put(jb->jbobj, \
  366. expected_frame, \
  367. 1100 + i * DEFAULT_FRAME_MS); \
  368. if (res != AST_JB_IMPL_OK) { \
  369. ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
  370. i, res, AST_JB_IMPL_OK); \
  371. return AST_TEST_FAIL; \
  372. } \
  373. } \
  374. \
  375. for (i = (overflow_limit)+1; i < (overflow_limit) + 5; i++) { \
  376. expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
  377. res = jb->impl->put(jb->jbobj, \
  378. expected_frame, \
  379. 1100 + i * DEFAULT_FRAME_MS); \
  380. if (res != AST_JB_IMPL_DROP) { \
  381. expected_frame = NULL; \
  382. ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
  383. i, res, AST_JB_IMPL_DROP); \
  384. return AST_TEST_FAIL; \
  385. } \
  386. ast_frfree(expected_frame); \
  387. expected_frame = NULL;\
  388. } \
  389. \
  390. return AST_TEST_PASS; \
  391. }
  392. /*!
  393. * \internal
  394. * \brief Test putting voice frames into a jitter buffer out of order
  395. *
  396. * \param type_name The enum type of the jitter buffer to create
  397. * \param literal_type_name The literal name of the type - "fixed" or "adaptive"
  398. * \param synch_limit The synchronization limit for this particular type of jitter buffer
  399. */
  400. #define test_put_out_of_order(type_name, literal_type_name, synch_limit) AST_TEST_DEFINE(TEST_NAME(type_name, put_out_of_order)) {\
  401. RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
  402. const struct ast_jb_impl *impl; \
  403. struct ast_jb_conf conf; \
  404. RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
  405. RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
  406. int res; \
  407. long next; \
  408. int i; \
  409. \
  410. switch (cmd) { \
  411. case TEST_INIT: \
  412. info->name = STRINGIFY_TESTNAME(TEST_NAME(type_name, put_out_of_order)); \
  413. info->category = "/main/abstract_jb/"; \
  414. info->summary = "Test putting out of order frames onto a " literal_type_name " jitterbuffer"; \
  415. info->description = \
  416. "This tests putting multiple frames into a " literal_type_name " jitterbuffer " \
  417. "that arrive out of order. Every 3rd frame is put in out of order."; \
  418. return AST_TEST_NOT_RUN; \
  419. case TEST_EXECUTE: \
  420. break; \
  421. } \
  422. \
  423. ast_test_status_update(test, "Executing " STRINGIFY_TESTNAME(TEST_NAME(type_name, put_out_of_order)) "...\n"); \
  424. OBTAIN_JITTERBUFFER_IMPL(impl, (type_name), (literal_type_name)); \
  425. MAKE_DEFAULT_CONFIG(&conf, impl); \
  426. conf.resync_threshold = (synch_limit); \
  427. jb->jbobj = impl->create(&conf); \
  428. jb->impl = impl; \
  429. \
  430. expected_frame = create_test_frame(1000, 0); \
  431. jb->impl->put_first(jb->jbobj, expected_frame, 1100); \
  432. for (i = 1; i <= 10; i++) { \
  433. if (i % 3 == 1 && i != 10) { \
  434. expected_frame = create_test_frame(1000 + ((i + 1) * DEFAULT_FRAME_MS), 0); \
  435. } else if (i % 3 == 2) { \
  436. expected_frame = create_test_frame(1000 + ((i - 1) * DEFAULT_FRAME_MS), 0); \
  437. } else { \
  438. expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
  439. } \
  440. res = jb->impl->put(jb->jbobj, \
  441. expected_frame, \
  442. 1100 + i * DEFAULT_FRAME_MS); \
  443. if (res != AST_JB_IMPL_OK) { \
  444. ast_test_status_update(test, "Error: On frame %d, got %d back from put (expected %d)\n", \
  445. i, res, AST_JB_IMPL_OK); \
  446. return AST_TEST_FAIL; \
  447. } \
  448. } \
  449. \
  450. for (i = 0; i <= 10; i++) { \
  451. expected_frame = create_test_frame(1000 + i * DEFAULT_FRAME_MS, 0); \
  452. next = jb->impl->next(jb->jbobj); \
  453. res = jb->impl->get(jb->jbobj, &actual_frame, next, DEFAULT_FRAME_MS); \
  454. if (res != AST_JB_IMPL_OK) { \
  455. ast_test_status_update(test, "Error: failed to retrieve frame at %ld\n", \
  456. next); \
  457. return AST_TEST_FAIL; \
  458. } \
  459. VERIFY_FRAME(actual_frame, expected_frame); \
  460. ast_frfree(expected_frame); \
  461. expected_frame = NULL; \
  462. } \
  463. \
  464. return AST_TEST_PASS; \
  465. }
  466. test_create_nominal(AST_JB_ADAPTIVE, "adaptive")
  467. test_put_first(AST_JB_ADAPTIVE, "adaptive")
  468. test_put(AST_JB_ADAPTIVE, "adaptive")
  469. test_put_overflow(AST_JB_ADAPTIVE, "adaptive", 10)
  470. test_put_out_of_order(AST_JB_ADAPTIVE, "adaptive", DEFAULT_FRAME_MS * 2)
  471. test_create_nominal(AST_JB_FIXED, "fixed")
  472. test_put_first(AST_JB_FIXED, "fixed")
  473. test_put(AST_JB_FIXED, "fixed")
  474. test_put_overflow(AST_JB_FIXED, "fixed", 12)
  475. test_put_out_of_order(AST_JB_FIXED, "fixed", DEFAULT_CONFIG_RESYNC_THRESHOLD)
  476. static int unload_module(void)
  477. {
  478. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, create));
  479. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_first));
  480. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put));
  481. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_overflow));
  482. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_out_of_order));
  483. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, create));
  484. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_first));
  485. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put));
  486. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_overflow));
  487. AST_TEST_UNREGISTER(TEST_NAME(AST_JB_FIXED, put_out_of_order));
  488. return 0;
  489. }
  490. static int load_module(void)
  491. {
  492. AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, create));
  493. AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_first));
  494. AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put));
  495. AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_overflow));
  496. AST_TEST_REGISTER(TEST_NAME(AST_JB_ADAPTIVE, put_out_of_order));
  497. AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, create));
  498. AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_first));
  499. AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put));
  500. AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_overflow));
  501. AST_TEST_REGISTER(TEST_NAME(AST_JB_FIXED, put_out_of_order));
  502. return AST_MODULE_LOAD_SUCCESS;
  503. }
  504. AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Abstract JitterBuffer API Tests");