FS-7861, FS-7862: [mod_conference] fix crash and other issues caused by multi canvas feature

This commit is contained in:
Brian West 2015-07-21 15:43:06 -05:00
parent 8b10cd3d00
commit 02539c6c4f
6 changed files with 110 additions and 25 deletions

View File

@ -261,6 +261,37 @@
<param name="video-fps" value="15"/>
</profile>
<profile name="test_res_id">
<param name="domain" value="$${domain}"/>
<param name="rate" value="48000"/>
<param name="channels" value="2"/>
<param name="interval" value="20"/>
<param name="energy-level" value="200"/>
<param name="muted-sound" value="conference/conf-muted.wav"/>
<param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
<param name="alone-sound" value="conference/conf-alone.wav"/>
<!--<param name="moh-sound" value="local_stream://video"/> -->
<param name="enter-sound" value="tone_stream://%(200,0,500,600,700)"/>
<param name="exit-sound" value="tone_stream://%(500,0,300,200,100,50,25)"/>
<param name="kicked-sound" value="conference/conf-kicked.wav"/>
<param name="locked-sound" value="conference/conf-locked.wav"/>
<param name="is-locked-sound" value="conference/conf-is-locked.wav"/>
<param name="is-unlocked-sound" value="conference/conf-is-unlocked.wav"/>
<param name="pin-sound" value="conference/conf-pin.wav"/>
<param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/>
<param name="caller-id-name" value="$${outbound_caller_name}"/>
<param name="caller-id-number" value="$${outbound_caller_id}"/>
<param name="comfort-noise" value="false"/>
<param name="conference-flags" value="video-floor-only|rfc-4579|livearray-sync|minimize-video-encoding"/>
<param name="video-mode" value="mux"/>
<param name="video-layout-name" value="test_res_id"/>
<param name="video-canvas-size" value="1920x1080"/>
<param name="video-canvas-bgcolor" value="#333333"/>
<param name="video-layout-bgcolor" value="#000000"/>
<param name="video-codec-bandwidth" value="3mb"/>
<param name="video-fps" value="15"/>
</profile>
<profile name="video-mcu-stereo-multi-canvas">
<param name="domain" value="$${domain}"/>
<param name="rate" value="48000"/>

View File

@ -12,6 +12,10 @@
<image x="0" y="90" scale="180"/>
<image x="180" y="90" scale="180"/>
</layout>
<layout name="test_res_id" auto-3d-position="true">
<image x="0" y="90" scale="180" reservation_id="left"/>
<image x="180" y="90" scale="180" reservation_id="right"/>
</layout>
<layout name="2x2" auto-3d-position="true">
<image x="0" y="0" scale="180"/>
<image x="180" y="0" scale="180"/>

View File

@ -88,4 +88,10 @@
</condition>
</extension>
<extension name="conf">
<condition field="destination_number" expression="^6079$">
<action application="conference" data="6079@test_res_id"/>
</condition>
</extension>

View File

@ -488,11 +488,11 @@ switch_status_t conference_api_sub_unvmute(conference_member_t *member, switch_s
return SWITCH_STATUS_SUCCESS;
}
if (member->conference->canvas) {
switch_mutex_lock(member->conference->canvas->mutex);
layer = &member->conference->canvas->layers[member->video_layer_id];
layer = conference_video_get_layer_locked(member);
if (layer) {
conference_video_clear_layer(layer);
switch_mutex_unlock(member->conference->canvas->mutex);
conference_video_release_layer(&layer);
}
conference_utils_member_set_flag_locked(member, MFLAG_CAN_BE_SEEN);
@ -1419,14 +1419,13 @@ switch_status_t conference_api_sub_vid_mute_img(conference_member_t *member, swi
return SWITCH_STATUS_FALSE;
}
switch_mutex_lock(layer->canvas->mutex);
layer = conference_video_get_layer_locked(member);
if (member->video_layer_id == -1 || !layer->canvas) {
if (!layer) {
goto end;
}
member->video_mute_png = NULL;
layer = &layer->canvas->layers[member->video_layer_id];
if (text) {
switch_img_free(&layer->mute_img);
@ -1436,11 +1435,11 @@ switch_status_t conference_api_sub_vid_mute_img(conference_member_t *member, swi
member->video_mute_png = switch_core_strdup(member->pool, text);
}
end:
end:
stream->write_function(stream, "%s\n", member->video_mute_png ? member->video_mute_png : "_undef_");
switch_mutex_unlock(layer->canvas->mutex);
conference_video_release_layer(&layer);
return SWITCH_STATUS_SUCCESS;
@ -1459,16 +1458,12 @@ switch_status_t conference_api_sub_vid_logo_img(conference_member_t *member, swi
return SWITCH_STATUS_FALSE;
}
if (member->video_layer_id == -1 || !member->conference->canvas) {
layer = conference_video_get_layer_locked(member);
if (!layer) {
goto end;
}
layer = &member->conference->canvas->layers[member->video_layer_id];
switch_mutex_lock(layer->canvas->mutex);
if (strcasecmp(text, "clear")) {
member->video_logo = switch_core_strdup(member->pool, text);
}
@ -1479,7 +1474,7 @@ switch_status_t conference_api_sub_vid_logo_img(conference_member_t *member, swi
stream->write_function(stream, "+OK\n");
switch_mutex_unlock(layer->canvas->mutex);
conference_video_release_layer(&layer);
return SWITCH_STATUS_SUCCESS;
@ -1488,7 +1483,6 @@ switch_status_t conference_api_sub_vid_logo_img(conference_member_t *member, swi
switch_status_t conference_api_sub_vid_res_id(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
char *text = (char *) data;
//mcu_layer_t *layer = NULL;
if (member == NULL)
return SWITCH_STATUS_GENERR;
@ -1509,8 +1503,6 @@ switch_status_t conference_api_sub_vid_res_id(conference_member_t *member, switc
switch_mutex_lock(member->conference->canvas->mutex);
//layer = &member->conference->canvas->layers[member->video_layer_id];
if (!strcasecmp(text, "clear") || (member->video_reservation_id && !strcasecmp(text, member->video_reservation_id))) {
member->video_reservation_id = NULL;
stream->write_function(stream, "+OK reservation_id cleared\n");
@ -1542,9 +1534,9 @@ switch_status_t conference_api_sub_vid_banner(conference_member_t *member, switc
return SWITCH_STATUS_SUCCESS;
}
switch_mutex_lock(member->conference->mutex);
layer = conference_video_get_layer_locked(member);
if (member->video_layer_id == -1 || !member->conference->canvas) {
if (!layer) {
stream->write_function(stream, "Channel %s is not in a video layer\n", switch_channel_get_name(member->channel));
goto end;
}
@ -1554,8 +1546,6 @@ switch_status_t conference_api_sub_vid_banner(conference_member_t *member, switc
goto end;
}
layer = &member->conference->canvas->layers[member->video_layer_id];
member->video_banner_text = switch_core_strdup(member->pool, text);
conference_video_layer_set_banner(member, layer, NULL);
@ -1564,7 +1554,7 @@ switch_status_t conference_api_sub_vid_banner(conference_member_t *member, switc
end:
switch_mutex_unlock(member->conference->mutex);
conference_video_release_layer(&layer);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -521,6 +521,57 @@ void conference_video_check_used_layers(mcu_canvas_t *canvas)
}
}
mcu_layer_t *conference_video_get_layer_locked(conference_member_t *member)
{
mcu_layer_t *layer = NULL;
mcu_canvas_t *canvas = NULL;
if (!member || member->canvas_id < 0 || member->video_layer_id < 0) return NULL;
switch_mutex_lock(member->conference->canvas_mutex);
canvas = member->conference->canvases[member->canvas_id];
if (!canvas) {
goto end;
}
switch_mutex_lock(canvas->mutex);
layer = &canvas->layers[member->video_layer_id];
if (!layer) {
switch_mutex_unlock(canvas->mutex);
}
end:
if (!layer) {
switch_mutex_unlock(member->conference->canvas_mutex);
}
return layer;
}
void conference_video_release_layer(mcu_layer_t **layer)
{
mcu_canvas_t *canvas = NULL;
if (!layer || !*layer) return;
canvas = (*layer)->canvas;
if (!canvas) return;
switch_mutex_unlock(canvas->mutex);
switch_assert(canvas->conference);
switch_mutex_unlock(canvas->conference->canvas_mutex);
*layer = NULL;
}
void conference_video_detach_video_layer(conference_member_t *member)
{
mcu_layer_t *layer = NULL;

View File

@ -866,6 +866,9 @@ void conference_utils_clear_flag(conference_obj_t *conference, conference_flag_t
void conference_utils_clear_flag_locked(conference_obj_t *conference, conference_flag_t flag);
switch_status_t conference_loop_dmachine_dispatcher(switch_ivr_dmachine_match_t *match);
mcu_layer_t *conference_video_get_layer_locked(conference_member_t *member);
void conference_video_release_layer(mcu_layer_t **layer);
int conference_member_setup_media(conference_member_t *member, conference_obj_t *conference);
al_handle_t *conference_al_create(switch_memory_pool_t *pool);