summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-07-17 17:59:32 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-07-17 17:59:32 -0500
commit594c7a50af49947fa31ad843ab20481dbc5ddd6e (patch)
treedbd56da054079a2c0f9de4e70876db0b8686149d /main
parent647f539e1569ad27c46352e58be9447e21c23923 (diff)
parent7f09fd2c2f1501aeccc7737be4dd0e52fd656913 (diff)
Merge "bridge/core_unreal: Fix SFU bugs with forwarding frames."
Diffstat (limited to 'main')
-rw-r--r--main/bridge_channel.c30
-rw-r--r--main/channel.c5
-rw-r--r--main/core_unreal.c13
3 files changed, 31 insertions, 17 deletions
diff --git a/main/bridge_channel.c b/main/bridge_channel.c
index e8ab8a898..2e943000c 100644
--- a/main/bridge_channel.c
+++ b/main/bridge_channel.c
@@ -998,21 +998,6 @@ int ast_bridge_channel_queue_frame(struct ast_bridge_channel *bridge_channel, st
return 0;
}
- if (ast_channel_is_multistream(bridge_channel->chan) &&
- (fr->frametype == AST_FRAME_IMAGE || fr->frametype == AST_FRAME_TEXT ||
- fr->frametype == AST_FRAME_VIDEO || fr->frametype == AST_FRAME_VOICE)) {
- /* Media frames need to be mapped to an appropriate write stream */
- dup->stream_num = AST_VECTOR_GET(
- &bridge_channel->stream_map.to_bridge, fr->stream_num);
- if (dup->stream_num == -1) {
- ast_bridge_channel_unlock(bridge_channel);
- bridge_frame_free(dup);
- return 0;
- }
- } else {
- dup->stream_num = -1;
- }
-
AST_LIST_INSERT_TAIL(&bridge_channel->wr_queue, dup, frame_list);
if (ast_alertpipe_write(bridge_channel->alert_pipe)) {
ast_log(LOG_ERROR, "We couldn't write alert pipe for %p(%s)... something is VERY wrong\n",
@@ -2455,15 +2440,26 @@ static void bridge_handle_trip(struct ast_bridge_channel *bridge_channel)
}
if (bridge_channel->features->mute) {
- frame = ast_read_noaudio(bridge_channel->chan);
+ frame = ast_read_stream_noaudio(bridge_channel->chan);
} else {
- frame = ast_read(bridge_channel->chan);
+ frame = ast_read_stream(bridge_channel->chan);
}
if (!frame) {
ast_bridge_channel_kick(bridge_channel, 0);
return;
}
+
+ if (ast_channel_is_multistream(bridge_channel->chan) &&
+ (frame->frametype == AST_FRAME_IMAGE || frame->frametype == AST_FRAME_TEXT ||
+ frame->frametype == AST_FRAME_VIDEO || frame->frametype == AST_FRAME_VOICE)) {
+ /* Media frames need to be mapped to an appropriate write stream */
+ frame->stream_num = AST_VECTOR_GET(
+ &bridge_channel->stream_map.to_bridge, frame->stream_num);
+ } else {
+ frame->stream_num = -1;
+ }
+
switch (frame->frametype) {
case AST_FRAME_CONTROL:
switch (frame->subclass.integer) {
diff --git a/main/channel.c b/main/channel.c
index 811826f1c..23bb74f08 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -4180,6 +4180,11 @@ struct ast_frame *ast_read_noaudio(struct ast_channel *chan)
return __ast_read(chan, 1, 1);
}
+struct ast_frame *ast_read_stream_noaudio(struct ast_channel *chan)
+{
+ return __ast_read(chan, 1, 0);
+}
+
int ast_indicate(struct ast_channel *chan, int condition)
{
return ast_indicate_data(chan, condition, NULL, 0);
diff --git a/main/core_unreal.c b/main/core_unreal.c
index 5da740877..3db6a4dbd 100644
--- a/main/core_unreal.c
+++ b/main/core_unreal.c
@@ -323,6 +323,19 @@ int ast_unreal_write(struct ast_channel *ast, struct ast_frame *f)
return -1;
}
+ /* If we are told to write a frame with a type that has no corresponding
+ * stream on the channel then drop it.
+ */
+ if (f->frametype == AST_FRAME_VOICE) {
+ if (!ast_channel_get_default_stream(ast, AST_MEDIA_TYPE_AUDIO)) {
+ return 0;
+ }
+ } else if (f->frametype == AST_FRAME_VIDEO) {
+ if (!ast_channel_get_default_stream(ast, AST_MEDIA_TYPE_VIDEO)) {
+ return 0;
+ }
+ }
+
/* Just queue for delivery to the other side */
ao2_ref(p, 1);
ao2_lock(p);