stream: Add stream topology to channel
[asterisk/asterisk.git] / tests / test_stream.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2017, Digium, Inc.
5  *
6  * Joshua Colp <jcolp@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 /*!
20  * \file
21  * \brief Media Stream API Unit Tests
22  *
23  * \author Joshua Colp <jcolp@digium.com>
24  *
25  */
26
27 /*** MODULEINFO
28         <depend>TEST_FRAMEWORK</depend>
29         <support_level>core</support_level>
30  ***/
31
32 #include "asterisk.h"
33
34 #include "asterisk/test.h"
35 #include "asterisk/module.h"
36 #include "asterisk/stream.h"
37 #include "asterisk/format.h"
38 #include "asterisk/format_cap.h"
39 #include "asterisk/format_cache.h"
40
41 AST_TEST_DEFINE(stream_create)
42 {
43         RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy);
44
45         switch (cmd) {
46         case TEST_INIT:
47                 info->name = "stream_create";
48                 info->category = "/main/stream/";
49                 info->summary = "stream create unit test";
50                 info->description =
51                         "Test that creating a stream results in a stream with the expected values";
52                 return AST_TEST_NOT_RUN;
53         case TEST_EXECUTE:
54                 break;
55         }
56
57         stream = ast_stream_create("test", AST_MEDIA_TYPE_AUDIO);
58         if (!stream) {
59                 ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
60                 return AST_TEST_FAIL;
61         }
62
63         if (ast_stream_get_state(stream) != AST_STREAM_STATE_INACTIVE) {
64                 ast_test_status_update(test, "Newly created stream does not have expected inactive stream state\n");
65                 return AST_TEST_FAIL;
66         }
67
68         if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO) {
69                 ast_test_status_update(test, "Newly created stream does not have expected audio media type\n");
70                 return AST_TEST_FAIL;
71         }
72
73         if (strcmp(ast_stream_get_name(stream), "test")) {
74                 ast_test_status_update(test, "Newly created stream does not have expected name of test\n");
75                 return AST_TEST_FAIL;
76         }
77
78         return AST_TEST_PASS;
79 }
80
81 AST_TEST_DEFINE(stream_create_no_name)
82 {
83         RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy);
84
85         switch (cmd) {
86         case TEST_INIT:
87                 info->name = "stream_create_no_name";
88                 info->category = "/main/stream/";
89                 info->summary = "stream create (without a name) unit test";
90                 info->description =
91                         "Test that creating a stream with no name works";
92                 return AST_TEST_NOT_RUN;
93         case TEST_EXECUTE:
94                 break;
95         }
96
97         stream = ast_stream_create(NULL, AST_MEDIA_TYPE_AUDIO);
98         if (!stream) {
99                 ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
100                 return AST_TEST_FAIL;
101         }
102
103         return AST_TEST_PASS;
104 }
105
106 AST_TEST_DEFINE(stream_set_type)
107 {
108         RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy);
109
110         switch (cmd) {
111         case TEST_INIT:
112                 info->name = "stream_set_type";
113                 info->category = "/main/stream/";
114                 info->summary = "stream type setting unit test";
115                 info->description =
116                         "Test that changing the type of a stream works";
117                 return AST_TEST_NOT_RUN;
118         case TEST_EXECUTE:
119                 break;
120         }
121
122         stream = ast_stream_create("test", AST_MEDIA_TYPE_AUDIO);
123         if (!stream) {
124                 ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
125                 return AST_TEST_FAIL;
126         }
127
128         if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO) {
129                 ast_test_status_update(test, "Newly created stream does not have expected audio media type\n");
130                 return AST_TEST_FAIL;
131         }
132
133         ast_stream_set_type(stream, AST_MEDIA_TYPE_VIDEO);
134
135         if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_VIDEO) {
136                 ast_test_status_update(test, "Changed stream does not have expected video media type\n");
137                 return AST_TEST_FAIL;
138         }
139
140         return AST_TEST_PASS;
141 }
142
143 AST_TEST_DEFINE(stream_set_formats)
144 {
145         RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy);
146         RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
147
148         switch (cmd) {
149         case TEST_INIT:
150                 info->name = "stream_set_formats";
151                 info->category = "/main/stream/";
152                 info->summary = "stream formats setting unit test";
153                 info->description =
154                         "Test that changing the formats of a stream works";
155                 return AST_TEST_NOT_RUN;
156         case TEST_EXECUTE:
157                 break;
158         }
159
160         caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
161         if (!caps) {
162                 ast_test_status_update(test, "Failed to create a format capabilities structure for testing\n");
163                 return AST_TEST_FAIL;
164         }
165
166         stream = ast_stream_create("test", AST_MEDIA_TYPE_AUDIO);
167         if (!stream) {
168                 ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
169                 return AST_TEST_FAIL;
170         }
171
172         ast_stream_set_formats(stream, caps);
173
174         if (ast_stream_get_formats(stream) != caps) {
175                 ast_test_status_update(test, "Changed stream does not have expected formats\n");
176                 return AST_TEST_FAIL;
177         }
178
179         ast_stream_set_formats(stream, NULL);
180
181         if (ast_stream_get_formats(stream)) {
182                 ast_test_status_update(test, "Retrieved formats from stream despite removing them\n");
183                 return AST_TEST_FAIL;
184         }
185
186         return AST_TEST_PASS;
187 }
188
189 AST_TEST_DEFINE(stream_set_state)
190 {
191         RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy);
192
193         switch (cmd) {
194         case TEST_INIT:
195                 info->name = "stream_set_state";
196                 info->category = "/main/stream/";
197                 info->summary = "stream state setting unit test";
198                 info->description =
199                         "Test that changing the state of a stream works";
200                 return AST_TEST_NOT_RUN;
201         case TEST_EXECUTE:
202                 break;
203         }
204
205         stream = ast_stream_create("test", AST_MEDIA_TYPE_AUDIO);
206         if (!stream) {
207                 ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
208                 return AST_TEST_FAIL;
209         }
210
211         if (ast_stream_get_state(stream) != AST_STREAM_STATE_INACTIVE) {
212                 ast_test_status_update(test, "Newly created stream does not have expected inactive stream state\n");
213                 return AST_TEST_FAIL;
214         }
215
216         ast_stream_set_state(stream, AST_STREAM_STATE_SENDRECV);
217
218         if (ast_stream_get_state(stream) != AST_STREAM_STATE_SENDRECV) {
219                 ast_test_status_update(test, "Changed stream does not have expected sendrecv state\n");
220                 return AST_TEST_FAIL;
221         }
222
223         return AST_TEST_PASS;
224 }
225
226 AST_TEST_DEFINE(stream_topology_create)
227 {
228         RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy);
229
230         switch (cmd) {
231         case TEST_INIT:
232                 info->name = "stream_topology_create";
233                 info->category = "/main/stream/";
234                 info->summary = "stream topology creation unit test";
235                 info->description =
236                         "Test that creating a stream topology works";
237                 return AST_TEST_NOT_RUN;
238         case TEST_EXECUTE:
239                 break;
240         }
241
242         topology = ast_stream_topology_create();
243         if (!topology) {
244                 ast_test_status_update(test, "Failed to create media stream topology\n");
245                 return AST_TEST_FAIL;
246         }
247
248         return AST_TEST_PASS;
249 }
250
251 AST_TEST_DEFINE(stream_topology_clone)
252 {
253         RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy);
254         RAII_VAR(struct ast_stream_topology *, cloned, NULL, ast_stream_topology_destroy);
255         struct ast_stream *audio_stream, *video_stream;
256
257         switch (cmd) {
258         case TEST_INIT:
259                 info->name = "stream_topology_clone";
260                 info->category = "/main/stream/";
261                 info->summary = "stream topology cloning unit test";
262                 info->description =
263                         "Test that cloning a stream topology results in a clone with the same contents";
264                 return AST_TEST_NOT_RUN;
265         case TEST_EXECUTE:
266                 break;
267         }
268
269         topology = ast_stream_topology_create();
270         if (!topology) {
271                 ast_test_status_update(test, "Failed to create media stream topology\n");
272                 return AST_TEST_FAIL;
273         }
274
275         audio_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO);
276         if (!audio_stream) {
277                 ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
278                 return AST_TEST_FAIL;
279         }
280
281         if (ast_stream_topology_append_stream(topology, audio_stream) == -1) {
282                 ast_test_status_update(test, "Failed to append valid audio stream to stream topology\n");
283                 ast_stream_destroy(audio_stream);
284                 return AST_TEST_FAIL;
285         }
286
287         video_stream = ast_stream_create("video", AST_MEDIA_TYPE_VIDEO);
288         if (!video_stream) {
289                 ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n");
290                 return AST_TEST_FAIL;
291         }
292
293         if (ast_stream_topology_append_stream(topology, video_stream) == -1) {
294                 ast_test_status_update(test, "Failed to append valid video stream to stream topology\n");
295                 ast_stream_destroy(video_stream);
296                 return AST_TEST_FAIL;
297         }
298
299         cloned = ast_stream_topology_clone(topology);
300         if (!cloned) {
301                 ast_test_status_update(test, "Failed to clone a perfectly good stream topology\n");
302                 return AST_TEST_FAIL;
303         }
304
305         if (ast_stream_topology_get_count(cloned) != ast_stream_topology_get_count(topology)) {
306                 ast_test_status_update(test, "Cloned stream topology does not contain same number of streams as original\n");
307                 return AST_TEST_FAIL;
308         }
309
310         if (ast_stream_get_type(ast_stream_topology_get_stream(cloned, 0)) != ast_stream_get_type(ast_stream_topology_get_stream(topology, 0))) {
311                 ast_test_status_update(test, "Cloned audio stream does not contain same type as original\n");
312                 return AST_TEST_FAIL;
313         }
314
315         if (ast_stream_get_type(ast_stream_topology_get_stream(cloned, 1)) != ast_stream_get_type(ast_stream_topology_get_stream(topology, 1))) {
316                 ast_test_status_update(test, "Cloned video stream does not contain same type as original\n");
317                 return AST_TEST_FAIL;
318         }
319
320         return AST_TEST_PASS;
321 }
322
323 AST_TEST_DEFINE(stream_topology_append_stream)
324 {
325         RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy);
326         struct ast_stream *audio_stream, *video_stream;
327         int position;
328
329         switch (cmd) {
330         case TEST_INIT:
331                 info->name = "stream_topology_append_stream";
332                 info->category = "/main/stream/";
333                 info->summary = "stream topology stream appending unit test";
334                 info->description =
335                         "Test that appending streams to a stream topology works";
336                 return AST_TEST_NOT_RUN;
337         case TEST_EXECUTE:
338                 break;
339         }
340
341         topology = ast_stream_topology_create();
342         if (!topology) {
343                 ast_test_status_update(test, "Failed to create media stream topology\n");
344                 return AST_TEST_FAIL;
345         }
346
347         audio_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO);
348         if (!audio_stream) {
349                 ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
350                 return AST_TEST_FAIL;
351         }
352
353         position = ast_stream_topology_append_stream(topology, audio_stream);
354         if (position == -1) {
355                 ast_test_status_update(test, "Failed to append valid audio stream to stream topology\n");
356                 ast_stream_destroy(audio_stream);
357                 return AST_TEST_FAIL;
358         } else if (position != 0) {
359                 ast_test_status_update(test, "Appended audio stream to stream topology but position is '%d' instead of 0\n",
360                         position);
361                 return AST_TEST_FAIL;
362         }
363
364         if (ast_stream_topology_get_count(topology) != 1) {
365                 ast_test_status_update(test, "Appended an audio stream to the stream topology but stream count is '%d' on it, not 1\n",
366                         ast_stream_topology_get_count(topology));
367                 return AST_TEST_FAIL;
368         }
369
370         if (ast_stream_topology_get_stream(topology, 0) != audio_stream) {
371                 ast_test_status_update(test, "Appended an audio stream to the stream topology but returned stream doesn't match\n");
372                 return AST_TEST_FAIL;
373         }
374
375         if (ast_stream_get_position(audio_stream) != 0) {
376                 ast_test_status_update(test, "Appended audio stream says it is at position '%d' instead of 0\n",
377                         ast_stream_get_position(audio_stream));
378                 return AST_TEST_FAIL;
379         }
380
381         video_stream = ast_stream_create("video", AST_MEDIA_TYPE_VIDEO);
382         if (!video_stream) {
383                 ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n");
384                 return AST_TEST_FAIL;
385         }
386
387         position = ast_stream_topology_append_stream(topology, video_stream);
388         if (position == -1) {
389                 ast_test_status_update(test, "Failed to append valid video stream to stream topology\n");
390                 ast_stream_destroy(video_stream);
391                 return AST_TEST_FAIL;
392         } else if (position != 1) {
393                 ast_test_status_update(test, "Appended video stream to stream topology but position is '%d' instead of 1\n",
394                         position);
395                 return AST_TEST_FAIL;
396         }
397
398         if (ast_stream_topology_get_count(topology) != 2) {
399                 ast_test_status_update(test, "Appended a video stream to the stream topology but stream count is '%d' on it, not 2\n",
400                         ast_stream_topology_get_count(topology));
401                 return AST_TEST_FAIL;
402         }
403
404         if (ast_stream_topology_get_stream(topology, 1) != video_stream) {
405                 ast_test_status_update(test, "Appended a video stream to the stream topology but returned stream doesn't match\n");
406                 return AST_TEST_FAIL;
407         }
408
409         if (ast_stream_get_position(video_stream) != 1) {
410                 ast_test_status_update(test, "Appended video stream says it is at position '%d' instead of 1\n",
411                         ast_stream_get_position(video_stream));
412                 return AST_TEST_FAIL;
413         }
414
415         return AST_TEST_PASS;
416 }
417
418 AST_TEST_DEFINE(stream_topology_set_stream)
419 {
420         RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy);
421         struct ast_stream *audio_stream, *video_stream;
422
423         switch (cmd) {
424         case TEST_INIT:
425                 info->name = "stream_topology_set_stream";
426                 info->category = "/main/stream/";
427                 info->summary = "stream topology stream setting unit test";
428                 info->description =
429                         "Test that setting streams at a specific position in a topology works";
430                 return AST_TEST_NOT_RUN;
431         case TEST_EXECUTE:
432                 break;
433         }
434
435         topology = ast_stream_topology_create();
436         if (!topology) {
437                 ast_test_status_update(test, "Failed to create media stream topology\n");
438                 return AST_TEST_FAIL;
439         }
440
441         audio_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO);
442         if (!audio_stream) {
443                 ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
444                 return AST_TEST_FAIL;
445         }
446
447         if (ast_stream_topology_set_stream(topology, 0, audio_stream)) {
448                 ast_test_status_update(test, "Failed to set an audio stream to a position where it is permitted\n");
449                 ast_stream_destroy(audio_stream);
450                 return AST_TEST_FAIL;
451         }
452
453         if (ast_stream_topology_get_count(topology) != 1) {
454                 ast_test_status_update(test, "Set an audio stream on the stream topology but stream count is '%d' on it, not 1\n",
455                         ast_stream_topology_get_count(topology));
456                 return AST_TEST_FAIL;
457         }
458
459         if (ast_stream_topology_get_stream(topology, 0) != audio_stream) {
460                 ast_test_status_update(test, "Set an audio stream on the stream topology but returned stream doesn't match\n");
461                 return AST_TEST_FAIL;
462         }
463
464         if (ast_stream_get_position(audio_stream) != 0) {
465                 ast_test_status_update(test, "Set audio stream says it is at position '%d' instead of 0\n",
466                         ast_stream_get_position(audio_stream));
467                 return AST_TEST_FAIL;
468         }
469
470         video_stream = ast_stream_create("video", AST_MEDIA_TYPE_VIDEO);
471         if (!video_stream) {
472                 ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n");
473                 return AST_TEST_FAIL;
474         }
475
476         if (ast_stream_topology_set_stream(topology, 0, video_stream)) {
477                 ast_test_status_update(test, "Failed to set a video stream to a position where it is permitted\n");
478                 ast_stream_destroy(video_stream);
479                 return AST_TEST_FAIL;
480         }
481
482         if (ast_stream_topology_get_count(topology) != 1) {
483                 ast_test_status_update(test, "Set a video stream on the stream topology but stream count is '%d' on it, not 1\n",
484                         ast_stream_topology_get_count(topology));
485                 return AST_TEST_FAIL;
486         }
487
488         if (ast_stream_topology_get_stream(topology, 0) != video_stream) {
489                 ast_test_status_update(test, "Set a video stream on the stream topology but returned stream doesn't match\n");
490                 return AST_TEST_FAIL;
491         }
492
493         if (ast_stream_get_position(video_stream) != 0) {
494                 ast_test_status_update(test, "Set video stream says it is at position '%d' instead of 0\n",
495                         ast_stream_get_position(video_stream));
496                 return AST_TEST_FAIL;
497         }
498
499         audio_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO);
500         if (!audio_stream) {
501                 ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
502                 return AST_TEST_FAIL;
503         }
504
505         if (ast_stream_topology_set_stream(topology, 1, audio_stream)) {
506                 ast_test_status_update(test, "Failed to set an audio stream to a position where it is permitted\n");
507                 ast_stream_destroy(audio_stream);
508                 return AST_TEST_FAIL;
509         }
510
511         if (ast_stream_topology_get_count(topology) != 2) {
512                 ast_test_status_update(test, "Set an audio stream on the stream topology but stream count is '%d' on it, not 2\n",
513                         ast_stream_topology_get_count(topology));
514                 return AST_TEST_FAIL;
515         }
516
517         if (ast_stream_topology_get_stream(topology, 1) != audio_stream) {
518                 ast_test_status_update(test, "Set an audio stream on the stream topology but returned stream doesn't match\n");
519                 return AST_TEST_FAIL;
520         }
521
522         if (ast_stream_get_position(audio_stream) != 1) {
523                 ast_test_status_update(test, "Set audio stream says it is at position '%d' instead of 1\n",
524                         ast_stream_get_position(audio_stream));
525                 return AST_TEST_FAIL;
526         }
527
528         return AST_TEST_PASS;
529 }
530
531 AST_TEST_DEFINE(stream_topology_create_from_format_cap)
532 {
533         RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy);
534         RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
535
536         switch (cmd) {
537         case TEST_INIT:
538                 info->name = "stream_topology_create_from_format_cap";
539                 info->category = "/main/stream/";
540                 info->summary = "stream topology creation from format capabilities unit test";
541                 info->description =
542                         "Test that creating a stream topology from format capabilities results in the expected streams";
543                 return AST_TEST_NOT_RUN;
544         case TEST_EXECUTE:
545                 break;
546         }
547
548         caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
549         if (!caps) {
550                 ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
551                 return AST_TEST_FAIL;
552         }
553
554         if (ast_format_cap_append(caps, ast_format_ulaw, 0)) {
555                 ast_test_status_update(test, "Failed to append a ulaw format to capabilities for stream topology creation\n");
556                 return AST_TEST_FAIL;
557         }
558
559         if (ast_format_cap_append(caps, ast_format_alaw, 0)) {
560                 ast_test_status_update(test, "Failed to append an alaw format to capabilities for stream topology creation\n");
561                 return AST_TEST_FAIL;
562         }
563
564         topology = ast_stream_topology_create_from_format_cap(caps);
565         if (!topology) {
566                 ast_test_status_update(test, "Failed to create a stream topology using a perfectly good format capabilities\n");
567                 return AST_TEST_FAIL;
568         }
569
570         if (ast_stream_topology_get_count(topology) != 1) {
571                 ast_test_status_update(test, "Expected a stream topology with 1 stream but it has %d streams\n",
572                         ast_stream_topology_get_count(topology));
573                 return AST_TEST_FAIL;
574         }
575
576         if (ast_stream_get_type(ast_stream_topology_get_stream(topology, 0)) != AST_MEDIA_TYPE_AUDIO) {
577                 ast_test_status_update(test, "Produced stream topology has a single stream of type %s instead of audio\n",
578                         ast_codec_media_type2str(ast_stream_get_type(ast_stream_topology_get_stream(topology, 0))));
579                 return AST_TEST_FAIL;
580         }
581
582         ast_stream_topology_destroy(topology);
583         topology = NULL;
584
585         ast_format_cap_append(caps, ast_format_h264, 0);
586
587         topology = ast_stream_topology_create_from_format_cap(caps);
588         if (!topology) {
589                 ast_test_status_update(test, "Failed to create a stream topology using a perfectly good format capabilities\n");
590                 return AST_TEST_FAIL;
591         }
592
593         if (ast_stream_topology_get_count(topology) != 2) {
594                 ast_test_status_update(test, "Expected a stream topology with 2 streams but it has %d streams\n",
595                         ast_stream_topology_get_count(topology));
596                 return AST_TEST_FAIL;
597         }
598
599         if (ast_stream_get_type(ast_stream_topology_get_stream(topology, 0)) != AST_MEDIA_TYPE_AUDIO) {
600                 ast_test_status_update(test, "Produced stream topology has a first stream of type %s instead of audio\n",
601                         ast_codec_media_type2str(ast_stream_get_type(ast_stream_topology_get_stream(topology, 0))));
602                 return AST_TEST_FAIL;
603         }
604
605         if (ast_stream_get_type(ast_stream_topology_get_stream(topology, 1)) != AST_MEDIA_TYPE_VIDEO) {
606                 ast_test_status_update(test, "Produced stream topology has a second stream of type %s instead of video\n",
607                         ast_codec_media_type2str(ast_stream_get_type(ast_stream_topology_get_stream(topology, 1))));
608                 return AST_TEST_FAIL;
609         }
610
611         return AST_TEST_PASS;
612 }
613
614 static int unload_module(void)
615 {
616         AST_TEST_UNREGISTER(stream_create);
617         AST_TEST_UNREGISTER(stream_create_no_name);
618         AST_TEST_UNREGISTER(stream_set_type);
619         AST_TEST_UNREGISTER(stream_set_formats);
620         AST_TEST_UNREGISTER(stream_set_state);
621         AST_TEST_UNREGISTER(stream_topology_create);
622         AST_TEST_UNREGISTER(stream_topology_clone);
623         AST_TEST_UNREGISTER(stream_topology_clone);
624         AST_TEST_UNREGISTER(stream_topology_append_stream);
625         AST_TEST_UNREGISTER(stream_topology_set_stream);
626         AST_TEST_UNREGISTER(stream_topology_create_from_format_cap);
627         return 0;
628 }
629
630 static int load_module(void)
631 {
632         AST_TEST_REGISTER(stream_create);
633         AST_TEST_REGISTER(stream_create_no_name);
634         AST_TEST_REGISTER(stream_set_type);
635         AST_TEST_REGISTER(stream_set_formats);
636         AST_TEST_REGISTER(stream_set_state);
637         AST_TEST_REGISTER(stream_topology_create);
638         AST_TEST_REGISTER(stream_topology_clone);
639         AST_TEST_REGISTER(stream_topology_append_stream);
640         AST_TEST_REGISTER(stream_topology_set_stream);
641         AST_TEST_REGISTER(stream_topology_create_from_format_cap);
642         return AST_MODULE_LOAD_SUCCESS;
643 }
644
645 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Media Stream API test module");