[Asterisk-code-review] app stream echo: misc bug fixes (asterisk[master])
Joshua Colp
asteriskteam at digium.com
Wed Jul 12 06:13:34 CDT 2017
Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5935 )
Change subject: app_stream_echo: misc bug fixes
......................................................................
app_stream_echo: misc bug fixes
Fixed the following bugs:
* calls to stream_echo_write had the last two parameters swapped
* ast_read should have been ast_read_stream
* added a null check on the frame's subclass format
This also resets the update_sent flag upon receiving SRRCHANGE control frame.
This will then force a video update.
ASTERISK-26997
Change-Id: I6ad7c8253559b800800433c52339e7f5aa583566
---
M apps/app_stream_echo.c
1 file changed, 8 insertions(+), 7 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, approved
diff --git a/apps/app_stream_echo.c b/apps/app_stream_echo.c
index 79d1591..9695dcc 100644
--- a/apps/app_stream_echo.c
+++ b/apps/app_stream_echo.c
@@ -108,7 +108,6 @@
* 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 @@
* 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 @@
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 @@
request_change = 0;
}
- f = ast_read(chan);
+ f = ast_read_stream(chan);
if (!f) {
return -1;
}
@@ -186,11 +185,13 @@
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 @@
.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;
}
--
To view, visit https://gerrit.asterisk.org/5935
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6ad7c8253559b800800433c52339e7f5aa583566
Gerrit-Change-Number: 5935
Gerrit-PatchSet: 3
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170712/bd5cd454/attachment.html>
More information about the asterisk-code-review
mailing list