diff options
-rw-r--r-- | apps/app_privacy.c | 1 | ||||
-rw-r--r-- | bridges/bridge_softmix.c | 39 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | main/bridge.c | 7 | ||||
-rw-r--r-- | main/bridge_channel.c | 27 | ||||
-rw-r--r-- | main/channel.c | 13 | ||||
-rw-r--r-- | res/res_http_post.c | 19 | ||||
-rw-r--r-- | res/res_pjsip_nat.c | 4 |
9 files changed, 76 insertions, 38 deletions
diff --git a/apps/app_privacy.c b/apps/app_privacy.c index a9afe0222..86aec0151 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -38,7 +38,6 @@ #include "asterisk/pbx.h" #include "asterisk/module.h" #include "asterisk/translate.h" -#include "asterisk/image.h" #include "asterisk/callerid.h" #include "asterisk/app.h" #include "asterisk/config.h" diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c index c5428a854..b35994895 100644 --- a/bridges/bridge_softmix.c +++ b/bridges/bridge_softmix.c @@ -577,13 +577,18 @@ static void sfu_topologies_on_join(struct ast_bridge_channel *joiner, struct ast struct ast_stream_topology *joiner_video = NULL; struct ast_stream_topology *existing_video = NULL; struct ast_bridge_channel *participant; + int res; joiner_video = ast_stream_topology_alloc(); if (!joiner_video) { return; } - if (append_source_streams(joiner_video, ast_channel_name(joiner->chan), ast_channel_get_stream_topology(joiner->chan))) { + ast_channel_lock(joiner->chan); + res = append_source_streams(joiner_video, ast_channel_name(joiner->chan), ast_channel_get_stream_topology(joiner->chan)); + ast_channel_unlock(joiner->chan); + + if (res) { goto cleanup; } @@ -596,13 +601,18 @@ static void sfu_topologies_on_join(struct ast_bridge_channel *joiner, struct ast if (participant == joiner) { continue; } - if (append_source_streams(existing_video, ast_channel_name(participant->chan), - ast_channel_get_stream_topology(participant->chan))) { + ast_channel_lock(participant->chan); + res = append_source_streams(existing_video, ast_channel_name(participant->chan), + ast_channel_get_stream_topology(participant->chan)); + ast_channel_unlock(participant->chan); + if (res) { goto cleanup; } } + ast_channel_lock(joiner->chan); joiner_topology = ast_stream_topology_clone(ast_channel_get_stream_topology(joiner->chan)); + ast_channel_unlock(joiner->chan); if (!joiner_topology) { goto cleanup; } @@ -617,7 +627,9 @@ static void sfu_topologies_on_join(struct ast_bridge_channel *joiner, struct ast if (participant == joiner) { continue; } + ast_channel_lock(participant->chan); participant_topology = ast_stream_topology_clone(ast_channel_get_stream_topology(participant->chan)); + ast_channel_unlock(participant->chan); if (!participant_topology) { goto cleanup; } @@ -753,12 +765,16 @@ static int sfu_topologies_on_leave(struct ast_bridge_channel *leaver, struct ast continue; } + ast_channel_lock(participant->chan); remove_destination_streams(participant_topology, ast_channel_name(leaver->chan), ast_channel_get_stream_topology(participant->chan)); + ast_channel_unlock(participant->chan); ast_channel_request_stream_topology_change(participant->chan, participant_topology, NULL); ast_stream_topology_free(participant_topology); } + ast_channel_lock(leaver->chan); remove_destination_streams(leaver_topology, "", ast_channel_get_stream_topology(leaver->chan)); + ast_channel_unlock(leaver->chan); ast_channel_request_stream_topology_change(leaver->chan, leaver_topology, NULL); ast_stream_topology_free(leaver_topology); @@ -1657,6 +1673,7 @@ static void map_source_to_destinations(const char *source_stream_name, const cha } ast_bridge_channel_lock(participant); + ast_channel_lock(participant->chan); topology = ast_channel_get_stream_topology(participant->chan); for (i = 0; i < ast_stream_topology_get_count(topology); ++i) { @@ -1668,6 +1685,7 @@ static void map_source_to_destinations(const char *source_stream_name, const cha break; } } + ast_channel_unlock(participant->chan); ast_bridge_channel_unlock(participant); } } @@ -1702,16 +1720,9 @@ static void softmix_bridge_stream_topology_changed(struct ast_bridge *bridge, st /* First traversal: re-initialize all of the participants' stream maps */ AST_LIST_TRAVERSE(&bridge->channels, participant, entry) { - int size; - ast_bridge_channel_lock(participant); - size = ast_stream_topology_get_count(ast_channel_get_stream_topology(participant->chan)); - - AST_VECTOR_FREE(&participant->stream_map.to_channel); - AST_VECTOR_FREE(&participant->stream_map.to_bridge); - - AST_VECTOR_INIT(&participant->stream_map.to_channel, size); - AST_VECTOR_INIT(&participant->stream_map.to_bridge, size); + AST_VECTOR_RESET(&participant->stream_map.to_channel, AST_VECTOR_ELEM_CLEANUP_NOOP); + AST_VECTOR_RESET(&participant->stream_map.to_bridge, AST_VECTOR_ELEM_CLEANUP_NOOP); ast_bridge_channel_unlock(participant); } @@ -1727,6 +1738,8 @@ static void softmix_bridge_stream_topology_changed(struct ast_bridge *bridge, st int i; struct ast_stream_topology *topology; + ast_channel_lock(participant->chan); + topology = ast_channel_get_stream_topology(participant->chan); for (i = 0; i < ast_stream_topology_get_count(topology); ++i) { @@ -1766,6 +1779,8 @@ static void softmix_bridge_stream_topology_changed(struct ast_bridge *bridge, st } ast_bridge_channel_unlock(participant); } + + ast_channel_unlock(participant->chan); } } @@ -34584,7 +34584,7 @@ fi fi fi -for ver in 2.0 2.2 2.4 2.6; do +for ver in 2.0 2.2 2.4 2.6 3.0; do if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then diff --git a/configure.ac b/configure.ac index 32b5fc09b..ccd6936dd 100644 --- a/configure.ac +++ b/configure.ac @@ -2558,7 +2558,7 @@ then fi fi -for ver in 2.0 2.2 2.4 2.6; do +for ver in 2.0 2.2 2.4 2.6 3.0; do AST_PKG_CONFIG_CHECK([GMIME], gmime-$ver) if test "$PBX_GMIME" = 1; then break; diff --git a/main/bridge.c b/main/bridge.c index a1a1a6f55..b732d5fc5 100644 --- a/main/bridge.c +++ b/main/bridge.c @@ -446,7 +446,12 @@ static void bridge_channel_complete_join(struct ast_bridge *bridge, struct ast_b * media types vector. This way all streams map to the same media type index for * a given channel. */ - ast_bridge_channel_stream_map(bridge_channel); + if (bridge_channel->bridge->technology->stream_topology_changed) { + bridge_channel->bridge->technology->stream_topology_changed( + bridge_channel->bridge, bridge_channel); + } else { + ast_bridge_channel_stream_map(bridge_channel); + } } /*! diff --git a/main/bridge_channel.c b/main/bridge_channel.c index 2e943000c..1427fd014 100644 --- a/main/bridge_channel.c +++ b/main/bridge_channel.c @@ -2344,16 +2344,23 @@ static void bridge_channel_handle_write(struct ast_bridge_channel *bridge_channe case AST_FRAME_NULL: break; default: - if (fr->stream_num > 0 && - (fr->stream_num >= (int)AST_VECTOR_SIZE(&bridge_channel->stream_map.to_channel) || - AST_VECTOR_GET(&bridge_channel->stream_map.to_channel, fr->stream_num) == -1)) { - /* Nowhere to write to, so drop it */ - break; - } + /* Assume that there is no mapped stream for this */ + num = -1; - /* Find what stream number to write to for the channel */ - num = fr->stream_num < 0 ? -1 : - AST_VECTOR_GET(&bridge_channel->stream_map.to_channel, fr->stream_num); + if (fr->stream_num > -1) { + ast_bridge_channel_lock(bridge_channel); + if (fr->stream_num < (int)AST_VECTOR_SIZE(&bridge_channel->stream_map.to_channel)) { + num = AST_VECTOR_GET(&bridge_channel->stream_map.to_channel, fr->stream_num); + } + ast_bridge_channel_unlock(bridge_channel); + + /* If there is no mapped stream after checking the mapping then there is nowhere + * to write this frame to, so drop it. + */ + if (num == -1) { + break; + } + } /* Write the frame to the channel. */ bridge_channel->activity = BRIDGE_CHANNEL_THREAD_SIMPLE; @@ -2983,7 +2990,9 @@ struct ast_bridge_channel *bridge_channel_internal_alloc(struct ast_bridge *brid void ast_bridge_channel_stream_map(struct ast_bridge_channel *bridge_channel) { + ast_channel_lock(bridge_channel->chan); ast_stream_topology_map(ast_channel_get_stream_topology(bridge_channel->chan), &bridge_channel->bridge->media_types, &bridge_channel->stream_map.to_bridge, &bridge_channel->stream_map.to_channel); + ast_channel_unlock(bridge_channel->chan); } diff --git a/main/channel.c b/main/channel.c index 66825559c..632d47247 100644 --- a/main/channel.c +++ b/main/channel.c @@ -6022,7 +6022,7 @@ static struct ast_channel *request_channel(const char *type, struct ast_format_c const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause) { struct chanlist *chan; - struct ast_channel *c; + struct ast_channel *c = NULL; int res; int foo; @@ -6063,9 +6063,6 @@ static struct ast_channel *request_channel(const char *type, struct ast_format_c c = chan->tech->requester_with_stream_topology(type, topology, assignedids, requestor, addr, cause); ast_stream_topology_free(tmp_converted_topology); - if (!c) { - return NULL; - } } else if (chan->tech->requester) { struct ast_format_cap *tmp_converted_cap = NULL; struct ast_format_cap *tmp_cap; @@ -6116,12 +6113,10 @@ static struct ast_channel *request_channel(const char *type, struct ast_format_c ao2_cleanup(tmp_converted_cap); c = chan->tech->requester(type, joint_cap, assignedids, requestor, addr, cause); + ao2_ref(joint_cap, -1); + } - if (!c) { - ao2_ref(joint_cap, -1); - return NULL; - } - } else { + if (!c) { return NULL; } diff --git a/res/res_http_post.c b/res/res_http_post.c index 3f0a58e36..9f5b1837a 100644 --- a/res/res_http_post.c +++ b/res/res_http_post.c @@ -55,6 +55,9 @@ #ifdef GMIME_TYPE_CONTENT_TYPE #define AST_GMIME_VER_24 #endif +#if GMIME_MAJOR_VERSION >= 3 +#define AST_GMIME_VER_30 +#endif /* just a little structure to hold callback info for gmime */ struct mime_cbinfo { @@ -84,7 +87,11 @@ static void post_raw(GMimePart *part, const char *post_dir, const char *fn) stream = g_mime_stream_fs_new(fd); +#ifdef AST_GMIME_VER_30 + content = g_mime_part_get_content(part); +#else content = g_mime_part_get_content_object(part); +#endif g_mime_data_wrapper_write_to_stream(content, stream); g_mime_stream_flush(stream); @@ -107,7 +114,11 @@ static GMimeMessage *parse_message(FILE *f) g_object_unref(stream); - message = g_mime_parser_construct_message(parser); + message = g_mime_parser_construct_message(parser +#ifdef AST_GMIME_VER_30 + , NULL +#endif + ); g_object_unref(parser); @@ -486,7 +497,11 @@ static int reload(void) static int load_module(void) { - g_mime_init(0); + g_mime_init( +#ifndef AST_GMIME_VER_30 + 0 +#endif + ); __ast_http_post_load(0); diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c index 7dfd5ec6d..45b0d7ce6 100644 --- a/res/res_pjsip_nat.c +++ b/res/res_pjsip_nat.c @@ -35,6 +35,7 @@ static void rewrite_uri(pjsip_rx_data *rdata, pjsip_sip_uri *uri) { pj_cstr(&uri->host, rdata->pkt_info.src_name); + uri->port = rdata->pkt_info.src_port; if (!strcasecmp("WSS", rdata->tp_info.transport->type_name)) { /* WSS is special, we don't want to overwrite the URI at all as it needs to be ws */ } else if (strcasecmp("udp", rdata->tp_info.transport->type_name)) { @@ -42,7 +43,6 @@ static void rewrite_uri(pjsip_rx_data *rdata, pjsip_sip_uri *uri) } else { uri->transport_param.slen = 0; } - uri->port = rdata->pkt_info.src_port; } static int rewrite_route_set(pjsip_rx_data *rdata, pjsip_dialog *dlg) @@ -165,7 +165,7 @@ static int find_transport_state_in_use(void *obj, void *arg, int flags) ((details->type == transport_state->type) && (transport_state->factory) && !pj_strcmp(&transport_state->factory->addr_name.host, &details->local_address) && transport_state->factory->addr_name.port == details->local_port))) { - return CMP_MATCH | CMP_STOP; + return CMP_MATCH; } return 0; |