diff options
author | Joshua Colp <jcolp@digium.com> | 2017-07-12 06:13:34 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-07-12 06:13:34 -0500 |
commit | 27aeca3594ae6618ffcafc8fe764fb0c9507ec14 (patch) | |
tree | 732126dea30d2da06693df332425b163cda36fcb /apps | |
parent | 8082f6cf7e96c2691740848a0df5752b2da575c3 (diff) | |
parent | e7d41050e0672a1cf670957dd0b13a7a1e2131ff (diff) |
Merge "app_stream_echo: misc bug fixes"
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_stream_echo.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/app_stream_echo.c b/apps/app_stream_echo.c index 79d15917b..9695dcc87 100644 --- a/apps/app_stream_echo.c +++ b/apps/app_stream_echo.c @@ -108,7 +108,6 @@ static int stream_echo_write(struct ast_channel *chan, struct ast_frame *frame, * we simply want to echo it back out onto the same stream number. */ num = ast_channel_is_multistream(chan) ? frame->stream_num : -1; - if (ast_write_stream(chan, num, frame)) { return stream_echo_write_error(chan, frame, num); } @@ -120,7 +119,8 @@ static int stream_echo_write(struct ast_channel *chan, struct ast_frame *frame, * Note, if the channel is not multi-stream capable then one_to_one will * always be true, so it is safe to also not check for that here too. */ - if (one_to_one || ast_format_get_type(frame->subclass.format) != type) { + if (one_to_one || !frame->subclass.format || + ast_format_get_type(frame->subclass.format) != type) { return 0; } @@ -141,7 +141,6 @@ static int stream_echo_write(struct ast_channel *chan, struct ast_frame *frame, for (i = 0; i < ast_stream_topology_get_count(topology); ++i) { struct ast_stream *stream = ast_stream_topology_get_stream(topology, i); - if (num != i && ast_stream_get_type(stream) == type) { if (ast_write_stream(chan, i, frame)) { return stream_echo_write_error(chan, frame, i); @@ -171,7 +170,7 @@ static int stream_echo_perform(struct ast_channel *chan, request_change = 0; } - f = ast_read(chan); + f = ast_read_stream(chan); if (!f) { return -1; } @@ -186,11 +185,13 @@ static int stream_echo_perform(struct ast_channel *chan, if (f->frametype == AST_FRAME_CONTROL) { if (f->subclass.integer == AST_CONTROL_VIDUPDATE && !update_sent) { - if (stream_echo_write(chan, f, one_to_one, type)) { + if (stream_echo_write(chan, f, type, one_to_one)) { ast_frfree(f); return -1; } update_sent = 1; + } else if (f->subclass.integer == AST_CONTROL_SRCCHANGE) { + update_sent = 0; } else if (f->subclass.integer == AST_CONTROL_STREAM_TOPOLOGY_CHANGED) { update_sent = 0; one_to_one = 0; /* Switch writing to one to many */ @@ -200,14 +201,14 @@ static int stream_echo_perform(struct ast_channel *chan, .frametype = AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_VIDUPDATE, }; - stream_echo_write(chan, &frame, one_to_one, type); + stream_echo_write(chan, &frame, type, one_to_one); update_sent = 1; } if (f->frametype != AST_FRAME_CONTROL && f->frametype != AST_FRAME_MODEM && f->frametype != AST_FRAME_NULL && - stream_echo_write(chan, f, one_to_one, type)) { + stream_echo_write(chan, f, type, one_to_one)) { ast_frfree(f); return -1; } |