test_abstract_jb.c 18 KB

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