mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user