stream: Rename creates/destroys to allocs/frees

To be consistent with sdp implementation.

Change-Id: I714e300939b4188f58ca66ce9d1e84b287009500
changes/74/4974/3
George Joseph 8 years ago
parent a9c15a0e4c
commit f8f513d363

@ -84,7 +84,7 @@ enum ast_stream_state {
* *
* \since 15 * \since 15
*/ */
struct ast_stream *ast_stream_create(const char *name, enum ast_media_type type); struct ast_stream *ast_stream_alloc(const char *name, enum ast_media_type type);
/*! /*!
* \brief Destroy a media stream representation * \brief Destroy a media stream representation
@ -93,7 +93,7 @@ struct ast_stream *ast_stream_create(const char *name, enum ast_media_type type)
* *
* \since 15 * \since 15
*/ */
void ast_stream_destroy(struct ast_stream *stream); void ast_stream_free(struct ast_stream *stream);
/*! /*!
* \brief Create a deep clone of an existing stream * \brief Create a deep clone of an existing stream
@ -209,7 +209,7 @@ int ast_stream_get_position(const struct ast_stream *stream);
* *
* \since 15 * \since 15
*/ */
struct ast_stream_topology *ast_stream_topology_create(void); struct ast_stream_topology *ast_stream_topology_alloc(void);
/*! /*!
* \brief Create a deep clone of an existing stream topology * \brief Create a deep clone of an existing stream topology
@ -233,7 +233,7 @@ struct ast_stream_topology *ast_stream_topology_clone(
* *
* \since 15 * \since 15
*/ */
void ast_stream_topology_destroy(struct ast_stream_topology *topology); void ast_stream_topology_free(struct ast_stream_topology *topology);
/*! /*!
* \brief Append a stream to the topology * \brief Append a stream to the topology

@ -888,7 +888,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
return ast_channel_unref(tmp); return ast_channel_unref(tmp);
} }
if (!(topology = ast_stream_topology_create())) { if (!(topology = ast_stream_topology_alloc())) {
return ast_channel_unref(tmp); return ast_channel_unref(tmp);
} }
ast_channel_internal_set_stream_topology(tmp, topology); ast_channel_internal_set_stream_topology(tmp, topology);

@ -848,7 +848,7 @@ static void channel_set_default_streams(struct ast_channel *chan)
void ast_channel_internal_set_stream_topology(struct ast_channel *chan, void ast_channel_internal_set_stream_topology(struct ast_channel *chan,
struct ast_stream_topology *topology) struct ast_stream_topology *topology)
{ {
ast_stream_topology_destroy(chan->stream_topology); ast_stream_topology_free(chan->stream_topology);
chan->stream_topology = topology; chan->stream_topology = topology;
channel_set_default_streams(chan); channel_set_default_streams(chan);
} }
@ -871,7 +871,7 @@ void ast_channel_nativeformats_set(struct ast_channel *chan,
struct ast_stream_topology *new_topology; struct ast_stream_topology *new_topology;
if (!value) { if (!value) {
new_topology = ast_stream_topology_create(); new_topology = ast_stream_topology_alloc();
} else { } else {
new_topology = ast_stream_topology_create_from_format_cap(value); new_topology = ast_stream_topology_create_from_format_cap(value);
} }
@ -1804,7 +1804,7 @@ struct ast_stream_topology *ast_channel_set_stream_topology(struct ast_channel *
* it even if its empty. * it even if its empty.
*/ */
if (!topology) { if (!topology) {
new_topology = ast_stream_topology_create(); new_topology = ast_stream_topology_alloc();
} else { } else {
new_topology = topology; new_topology = topology;
} }

@ -69,7 +69,7 @@ struct ast_stream_topology {
AST_VECTOR(, struct ast_stream *) streams; AST_VECTOR(, struct ast_stream *) streams;
}; };
struct ast_stream *ast_stream_create(const char *name, enum ast_media_type type) struct ast_stream *ast_stream_alloc(const char *name, enum ast_media_type type)
{ {
struct ast_stream *stream; struct ast_stream *stream;
@ -108,7 +108,7 @@ struct ast_stream *ast_stream_clone(const struct ast_stream *stream)
return new_stream; return new_stream;
} }
void ast_stream_destroy(struct ast_stream *stream) void ast_stream_free(struct ast_stream *stream)
{ {
if (!stream) { if (!stream) {
return; return;
@ -176,7 +176,7 @@ int ast_stream_get_position(const struct ast_stream *stream)
} }
#define TOPOLOGY_INITIAL_STREAM_COUNT 2 #define TOPOLOGY_INITIAL_STREAM_COUNT 2
struct ast_stream_topology *ast_stream_topology_create(void) struct ast_stream_topology *ast_stream_topology_alloc(void)
{ {
struct ast_stream_topology *topology; struct ast_stream_topology *topology;
@ -201,7 +201,7 @@ struct ast_stream_topology *ast_stream_topology_clone(
ast_assert(topology != NULL); ast_assert(topology != NULL);
new_topology = ast_stream_topology_create(); new_topology = ast_stream_topology_alloc();
if (!new_topology) { if (!new_topology) {
return NULL; return NULL;
} }
@ -211,8 +211,8 @@ struct ast_stream_topology *ast_stream_topology_clone(
ast_stream_clone(AST_VECTOR_GET(&topology->streams, i)); ast_stream_clone(AST_VECTOR_GET(&topology->streams, i));
if (!stream || AST_VECTOR_APPEND(&new_topology->streams, stream)) { if (!stream || AST_VECTOR_APPEND(&new_topology->streams, stream)) {
ast_stream_destroy(stream); ast_stream_free(stream);
ast_stream_topology_destroy(new_topology); ast_stream_topology_free(new_topology);
return NULL; return NULL;
} }
} }
@ -220,13 +220,13 @@ struct ast_stream_topology *ast_stream_topology_clone(
return new_topology; return new_topology;
} }
void ast_stream_topology_destroy(struct ast_stream_topology *topology) void ast_stream_topology_free(struct ast_stream_topology *topology)
{ {
if (!topology) { if (!topology) {
return; return;
} }
AST_VECTOR_CALLBACK_VOID(&topology->streams, ast_stream_destroy); AST_VECTOR_CALLBACK_VOID(&topology->streams, ast_stream_free);
AST_VECTOR_FREE(&topology->streams); AST_VECTOR_FREE(&topology->streams);
ast_free(topology); ast_free(topology);
} }
@ -272,7 +272,7 @@ int ast_stream_topology_set_stream(struct ast_stream_topology *topology,
if (position < AST_VECTOR_SIZE(&topology->streams)) { if (position < AST_VECTOR_SIZE(&topology->streams)) {
existing_stream = AST_VECTOR_GET(&topology->streams, position); existing_stream = AST_VECTOR_GET(&topology->streams, position);
ast_stream_destroy(existing_stream); ast_stream_free(existing_stream);
} }
stream->position = position; stream->position = position;
@ -293,7 +293,7 @@ struct ast_stream_topology *ast_stream_topology_create_from_format_cap(
ast_assert(cap != NULL); ast_assert(cap != NULL);
topology = ast_stream_topology_create(); topology = ast_stream_topology_alloc();
if (!topology) { if (!topology) {
return NULL; return NULL;
} }
@ -308,29 +308,29 @@ struct ast_stream_topology *ast_stream_topology_create_from_format_cap(
new_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT); new_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
if (!new_cap) { if (!new_cap) {
ast_stream_topology_destroy(topology); ast_stream_topology_free(topology);
return NULL; return NULL;
} }
ast_format_cap_set_framing(new_cap, ast_format_cap_get_framing(cap)); ast_format_cap_set_framing(new_cap, ast_format_cap_get_framing(cap));
if (ast_format_cap_append_from_cap(new_cap, cap, type)) { if (ast_format_cap_append_from_cap(new_cap, cap, type)) {
ao2_cleanup(new_cap); ao2_cleanup(new_cap);
ast_stream_topology_destroy(topology); ast_stream_topology_free(topology);
return NULL; return NULL;
} }
stream = ast_stream_create(ast_codec_media_type2str(type), type); stream = ast_stream_alloc(ast_codec_media_type2str(type), type);
if (!stream) { if (!stream) {
ao2_cleanup(new_cap); ao2_cleanup(new_cap);
ast_stream_topology_destroy(topology); ast_stream_topology_free(topology);
return NULL; return NULL;
} }
/* We're transferring the initial ref so no bump needed */ /* We're transferring the initial ref so no bump needed */
stream->formats = new_cap; stream->formats = new_cap;
stream->state = AST_STREAM_STATE_SENDRECV; stream->state = AST_STREAM_STATE_SENDRECV;
if (ast_stream_topology_append_stream(topology, stream) == -1) { if (ast_stream_topology_append_stream(topology, stream) == -1) {
ast_stream_destroy(stream); ast_stream_free(stream);
ast_stream_topology_destroy(topology); ast_stream_topology_free(topology);
return NULL; return NULL;
} }
} }

@ -41,7 +41,7 @@
AST_TEST_DEFINE(stream_create) AST_TEST_DEFINE(stream_create)
{ {
RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy); RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_free);
switch (cmd) { switch (cmd) {
case TEST_INIT: case TEST_INIT:
@ -55,7 +55,7 @@ AST_TEST_DEFINE(stream_create)
break; break;
} }
stream = ast_stream_create("test", AST_MEDIA_TYPE_AUDIO); stream = ast_stream_alloc("test", AST_MEDIA_TYPE_AUDIO);
if (!stream) { if (!stream) {
ast_test_status_update(test, "Failed to create media stream given proper arguments\n"); ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -81,7 +81,7 @@ AST_TEST_DEFINE(stream_create)
AST_TEST_DEFINE(stream_create_no_name) AST_TEST_DEFINE(stream_create_no_name)
{ {
RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy); RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_free);
switch (cmd) { switch (cmd) {
case TEST_INIT: case TEST_INIT:
@ -95,7 +95,7 @@ AST_TEST_DEFINE(stream_create_no_name)
break; break;
} }
stream = ast_stream_create(NULL, AST_MEDIA_TYPE_AUDIO); stream = ast_stream_alloc(NULL, AST_MEDIA_TYPE_AUDIO);
if (!stream) { if (!stream) {
ast_test_status_update(test, "Failed to create media stream given proper arguments\n"); ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -106,7 +106,7 @@ AST_TEST_DEFINE(stream_create_no_name)
AST_TEST_DEFINE(stream_set_type) AST_TEST_DEFINE(stream_set_type)
{ {
RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy); RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_free);
switch (cmd) { switch (cmd) {
case TEST_INIT: case TEST_INIT:
@ -120,7 +120,7 @@ AST_TEST_DEFINE(stream_set_type)
break; break;
} }
stream = ast_stream_create("test", AST_MEDIA_TYPE_AUDIO); stream = ast_stream_alloc("test", AST_MEDIA_TYPE_AUDIO);
if (!stream) { if (!stream) {
ast_test_status_update(test, "Failed to create media stream given proper arguments\n"); ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -143,7 +143,7 @@ AST_TEST_DEFINE(stream_set_type)
AST_TEST_DEFINE(stream_set_formats) AST_TEST_DEFINE(stream_set_formats)
{ {
RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy); RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_free);
RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup); RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
switch (cmd) { switch (cmd) {
@ -164,7 +164,7 @@ AST_TEST_DEFINE(stream_set_formats)
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
stream = ast_stream_create("test", AST_MEDIA_TYPE_AUDIO); stream = ast_stream_alloc("test", AST_MEDIA_TYPE_AUDIO);
if (!stream) { if (!stream) {
ast_test_status_update(test, "Failed to create media stream given proper arguments\n"); ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -189,7 +189,7 @@ AST_TEST_DEFINE(stream_set_formats)
AST_TEST_DEFINE(stream_set_state) AST_TEST_DEFINE(stream_set_state)
{ {
RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_destroy); RAII_VAR(struct ast_stream *, stream, NULL, ast_stream_free);
switch (cmd) { switch (cmd) {
case TEST_INIT: case TEST_INIT:
@ -203,7 +203,7 @@ AST_TEST_DEFINE(stream_set_state)
break; break;
} }
stream = ast_stream_create("test", AST_MEDIA_TYPE_AUDIO); stream = ast_stream_alloc("test", AST_MEDIA_TYPE_AUDIO);
if (!stream) { if (!stream) {
ast_test_status_update(test, "Failed to create media stream given proper arguments\n"); ast_test_status_update(test, "Failed to create media stream given proper arguments\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -226,7 +226,7 @@ AST_TEST_DEFINE(stream_set_state)
AST_TEST_DEFINE(stream_topology_create) AST_TEST_DEFINE(stream_topology_create)
{ {
RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_free);
switch (cmd) { switch (cmd) {
case TEST_INIT: case TEST_INIT:
@ -240,7 +240,7 @@ AST_TEST_DEFINE(stream_topology_create)
break; break;
} }
topology = ast_stream_topology_create(); topology = ast_stream_topology_alloc();
if (!topology) { if (!topology) {
ast_test_status_update(test, "Failed to create media stream topology\n"); ast_test_status_update(test, "Failed to create media stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -251,8 +251,8 @@ AST_TEST_DEFINE(stream_topology_create)
AST_TEST_DEFINE(stream_topology_clone) AST_TEST_DEFINE(stream_topology_clone)
{ {
RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_free);
RAII_VAR(struct ast_stream_topology *, cloned, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, cloned, NULL, ast_stream_topology_free);
struct ast_stream *audio_stream, *video_stream; struct ast_stream *audio_stream, *video_stream;
switch (cmd) { switch (cmd) {
@ -267,13 +267,13 @@ AST_TEST_DEFINE(stream_topology_clone)
break; break;
} }
topology = ast_stream_topology_create(); topology = ast_stream_topology_alloc();
if (!topology) { if (!topology) {
ast_test_status_update(test, "Failed to create media stream topology\n"); ast_test_status_update(test, "Failed to create media stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
audio_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO); audio_stream = ast_stream_alloc("audio", AST_MEDIA_TYPE_AUDIO);
if (!audio_stream) { if (!audio_stream) {
ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -281,11 +281,11 @@ AST_TEST_DEFINE(stream_topology_clone)
if (ast_stream_topology_append_stream(topology, audio_stream) == -1) { if (ast_stream_topology_append_stream(topology, audio_stream) == -1) {
ast_test_status_update(test, "Failed to append valid audio stream to stream topology\n"); ast_test_status_update(test, "Failed to append valid audio stream to stream topology\n");
ast_stream_destroy(audio_stream); ast_stream_free(audio_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
video_stream = ast_stream_create("video", AST_MEDIA_TYPE_VIDEO); video_stream = ast_stream_alloc("video", AST_MEDIA_TYPE_VIDEO);
if (!video_stream) { if (!video_stream) {
ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -293,7 +293,7 @@ AST_TEST_DEFINE(stream_topology_clone)
if (ast_stream_topology_append_stream(topology, video_stream) == -1) { if (ast_stream_topology_append_stream(topology, video_stream) == -1) {
ast_test_status_update(test, "Failed to append valid video stream to stream topology\n"); ast_test_status_update(test, "Failed to append valid video stream to stream topology\n");
ast_stream_destroy(video_stream); ast_stream_free(video_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
@ -323,7 +323,7 @@ AST_TEST_DEFINE(stream_topology_clone)
AST_TEST_DEFINE(stream_topology_append_stream) AST_TEST_DEFINE(stream_topology_append_stream)
{ {
RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_free);
struct ast_stream *audio_stream, *video_stream; struct ast_stream *audio_stream, *video_stream;
int position; int position;
@ -339,13 +339,13 @@ AST_TEST_DEFINE(stream_topology_append_stream)
break; break;
} }
topology = ast_stream_topology_create(); topology = ast_stream_topology_alloc();
if (!topology) { if (!topology) {
ast_test_status_update(test, "Failed to create media stream topology\n"); ast_test_status_update(test, "Failed to create media stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
audio_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO); audio_stream = ast_stream_alloc("audio", AST_MEDIA_TYPE_AUDIO);
if (!audio_stream) { if (!audio_stream) {
ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -354,7 +354,7 @@ AST_TEST_DEFINE(stream_topology_append_stream)
position = ast_stream_topology_append_stream(topology, audio_stream); position = ast_stream_topology_append_stream(topology, audio_stream);
if (position == -1) { if (position == -1) {
ast_test_status_update(test, "Failed to append valid audio stream to stream topology\n"); ast_test_status_update(test, "Failed to append valid audio stream to stream topology\n");
ast_stream_destroy(audio_stream); ast_stream_free(audio_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} else if (position != 0) { } else if (position != 0) {
ast_test_status_update(test, "Appended audio stream to stream topology but position is '%d' instead of 0\n", ast_test_status_update(test, "Appended audio stream to stream topology but position is '%d' instead of 0\n",
@ -379,7 +379,7 @@ AST_TEST_DEFINE(stream_topology_append_stream)
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
video_stream = ast_stream_create("video", AST_MEDIA_TYPE_VIDEO); video_stream = ast_stream_alloc("video", AST_MEDIA_TYPE_VIDEO);
if (!video_stream) { if (!video_stream) {
ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -388,7 +388,7 @@ AST_TEST_DEFINE(stream_topology_append_stream)
position = ast_stream_topology_append_stream(topology, video_stream); position = ast_stream_topology_append_stream(topology, video_stream);
if (position == -1) { if (position == -1) {
ast_test_status_update(test, "Failed to append valid video stream to stream topology\n"); ast_test_status_update(test, "Failed to append valid video stream to stream topology\n");
ast_stream_destroy(video_stream); ast_stream_free(video_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} else if (position != 1) { } else if (position != 1) {
ast_test_status_update(test, "Appended video stream to stream topology but position is '%d' instead of 1\n", ast_test_status_update(test, "Appended video stream to stream topology but position is '%d' instead of 1\n",
@ -418,7 +418,7 @@ AST_TEST_DEFINE(stream_topology_append_stream)
AST_TEST_DEFINE(stream_topology_set_stream) AST_TEST_DEFINE(stream_topology_set_stream)
{ {
RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_free);
struct ast_stream *audio_stream, *video_stream; struct ast_stream *audio_stream, *video_stream;
switch (cmd) { switch (cmd) {
@ -433,13 +433,13 @@ AST_TEST_DEFINE(stream_topology_set_stream)
break; break;
} }
topology = ast_stream_topology_create(); topology = ast_stream_topology_alloc();
if (!topology) { if (!topology) {
ast_test_status_update(test, "Failed to create media stream topology\n"); ast_test_status_update(test, "Failed to create media stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
audio_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO); audio_stream = ast_stream_alloc("audio", AST_MEDIA_TYPE_AUDIO);
if (!audio_stream) { if (!audio_stream) {
ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -447,7 +447,7 @@ AST_TEST_DEFINE(stream_topology_set_stream)
if (ast_stream_topology_set_stream(topology, 0, audio_stream)) { if (ast_stream_topology_set_stream(topology, 0, audio_stream)) {
ast_test_status_update(test, "Failed to set an audio stream to a position where it is permitted\n"); ast_test_status_update(test, "Failed to set an audio stream to a position where it is permitted\n");
ast_stream_destroy(audio_stream); ast_stream_free(audio_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
@ -468,7 +468,7 @@ AST_TEST_DEFINE(stream_topology_set_stream)
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
video_stream = ast_stream_create("video", AST_MEDIA_TYPE_VIDEO); video_stream = ast_stream_alloc("video", AST_MEDIA_TYPE_VIDEO);
if (!video_stream) { if (!video_stream) {
ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -476,7 +476,7 @@ AST_TEST_DEFINE(stream_topology_set_stream)
if (ast_stream_topology_set_stream(topology, 0, video_stream)) { if (ast_stream_topology_set_stream(topology, 0, video_stream)) {
ast_test_status_update(test, "Failed to set a video stream to a position where it is permitted\n"); ast_test_status_update(test, "Failed to set a video stream to a position where it is permitted\n");
ast_stream_destroy(video_stream); ast_stream_free(video_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
@ -497,7 +497,7 @@ AST_TEST_DEFINE(stream_topology_set_stream)
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
audio_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO); audio_stream = ast_stream_alloc("audio", AST_MEDIA_TYPE_AUDIO);
if (!audio_stream) { if (!audio_stream) {
ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -505,7 +505,7 @@ AST_TEST_DEFINE(stream_topology_set_stream)
if (ast_stream_topology_set_stream(topology, 1, audio_stream)) { if (ast_stream_topology_set_stream(topology, 1, audio_stream)) {
ast_test_status_update(test, "Failed to set an audio stream to a position where it is permitted\n"); ast_test_status_update(test, "Failed to set an audio stream to a position where it is permitted\n");
ast_stream_destroy(audio_stream); ast_stream_free(audio_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
@ -531,7 +531,7 @@ AST_TEST_DEFINE(stream_topology_set_stream)
AST_TEST_DEFINE(stream_topology_create_from_format_cap) AST_TEST_DEFINE(stream_topology_create_from_format_cap)
{ {
RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_free);
RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup); RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
switch (cmd) { switch (cmd) {
@ -580,7 +580,7 @@ AST_TEST_DEFINE(stream_topology_create_from_format_cap)
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
ast_stream_topology_destroy(topology); ast_stream_topology_free(topology);
topology = NULL; topology = NULL;
ast_format_cap_append(caps, ast_format_h264, 0); ast_format_cap_append(caps, ast_format_h264, 0);
@ -614,7 +614,7 @@ AST_TEST_DEFINE(stream_topology_create_from_format_cap)
AST_TEST_DEFINE(stream_topology_get_first_stream_by_type) AST_TEST_DEFINE(stream_topology_get_first_stream_by_type)
{ {
RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_free);
struct ast_stream *first_stream, *second_stream, *third_stream, *fourth_stream; struct ast_stream *first_stream, *second_stream, *third_stream, *fourth_stream;
switch (cmd) { switch (cmd) {
@ -629,13 +629,13 @@ AST_TEST_DEFINE(stream_topology_get_first_stream_by_type)
break; break;
} }
topology = ast_stream_topology_create(); topology = ast_stream_topology_alloc();
if (!topology) { if (!topology) {
ast_test_status_update(test, "Failed to create media stream topology\n"); ast_test_status_update(test, "Failed to create media stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
first_stream = ast_stream_create("audio", AST_MEDIA_TYPE_AUDIO); first_stream = ast_stream_alloc("audio", AST_MEDIA_TYPE_AUDIO);
if (!first_stream) { if (!first_stream) {
ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create an audio stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -643,11 +643,11 @@ AST_TEST_DEFINE(stream_topology_get_first_stream_by_type)
if (ast_stream_topology_append_stream(topology, first_stream) == -1) { if (ast_stream_topology_append_stream(topology, first_stream) == -1) {
ast_test_status_update(test, "Failed to append a perfectly good stream to a topology\n"); ast_test_status_update(test, "Failed to append a perfectly good stream to a topology\n");
ast_stream_destroy(first_stream); ast_stream_free(first_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
second_stream = ast_stream_create("audio2", AST_MEDIA_TYPE_AUDIO); second_stream = ast_stream_alloc("audio2", AST_MEDIA_TYPE_AUDIO);
if (!second_stream) { if (!second_stream) {
ast_test_status_update(test, "Failed to create a second audio stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create a second audio stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -655,11 +655,11 @@ AST_TEST_DEFINE(stream_topology_get_first_stream_by_type)
if (ast_stream_topology_append_stream(topology, second_stream) == -1) { if (ast_stream_topology_append_stream(topology, second_stream) == -1) {
ast_test_status_update(test, "Failed to append a perfectly good stream to a topology\n"); ast_test_status_update(test, "Failed to append a perfectly good stream to a topology\n");
ast_stream_destroy(second_stream); ast_stream_free(second_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
third_stream = ast_stream_create("video", AST_MEDIA_TYPE_VIDEO); third_stream = ast_stream_alloc("video", AST_MEDIA_TYPE_VIDEO);
if (!third_stream) { if (!third_stream) {
ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create a video stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -667,11 +667,11 @@ AST_TEST_DEFINE(stream_topology_get_first_stream_by_type)
if (ast_stream_topology_append_stream(topology, third_stream) == -1) { if (ast_stream_topology_append_stream(topology, third_stream) == -1) {
ast_test_status_update(test, "Failed to append a perfectly good stream to a topology\n"); ast_test_status_update(test, "Failed to append a perfectly good stream to a topology\n");
ast_stream_destroy(third_stream); ast_stream_free(third_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
fourth_stream = ast_stream_create("video2", AST_MEDIA_TYPE_VIDEO); fourth_stream = ast_stream_alloc("video2", AST_MEDIA_TYPE_VIDEO);
if (!fourth_stream) { if (!fourth_stream) {
ast_test_status_update(test, "Failed to create a second video stream for testing stream topology\n"); ast_test_status_update(test, "Failed to create a second video stream for testing stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;
@ -679,7 +679,7 @@ AST_TEST_DEFINE(stream_topology_get_first_stream_by_type)
if (ast_stream_topology_append_stream(topology, fourth_stream) == -1) { if (ast_stream_topology_append_stream(topology, fourth_stream) == -1) {
ast_test_status_update(test, "Failed to append a perfectly good stream to a topology\n"); ast_test_status_update(test, "Failed to append a perfectly good stream to a topology\n");
ast_stream_destroy(fourth_stream); ast_stream_free(fourth_stream);
return AST_TEST_FAIL; return AST_TEST_FAIL;
} }
@ -701,7 +701,7 @@ static const struct ast_channel_tech mock_channel_tech = {
AST_TEST_DEFINE(stream_topology_create_from_channel_nativeformats) AST_TEST_DEFINE(stream_topology_create_from_channel_nativeformats)
{ {
RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_free);
RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup); RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
struct ast_channel *mock_channel; struct ast_channel *mock_channel;
enum ast_test_result_state res = AST_TEST_FAIL; enum ast_test_result_state res = AST_TEST_FAIL;
@ -810,7 +810,7 @@ static const struct ast_channel_tech mock_stream_channel_tech = {
AST_TEST_DEFINE(stream_topology_channel_set) AST_TEST_DEFINE(stream_topology_channel_set)
{ {
RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_destroy); RAII_VAR(struct ast_stream_topology *, topology, NULL, ast_stream_topology_free);
struct ast_channel *mock_channel; struct ast_channel *mock_channel;
enum ast_test_result_state res = AST_TEST_PASS; enum ast_test_result_state res = AST_TEST_PASS;
@ -826,7 +826,7 @@ AST_TEST_DEFINE(stream_topology_channel_set)
break; break;
} }
topology = ast_stream_topology_create(); topology = ast_stream_topology_alloc();
if (!topology) { if (!topology) {
ast_test_status_update(test, "Failed to create media stream topology\n"); ast_test_status_update(test, "Failed to create media stream topology\n");
return AST_TEST_FAIL; return AST_TEST_FAIL;

Loading…
Cancel
Save