if ((x_layout_settings = switch_xml_child(cfg, "layout-settings"))) {
if ((x_layouts = switch_xml_child(x_layout_settings, "layouts"))) {
for (x_layout = switch_xml_child(x_layouts, "layout"); x_layout; x_layout = x_layout->next) {
- video_layout_t *vlayout;
+ video_layout_t *vlayout;
const char *val = NULL, *name = NULL;
if ((val = switch_xml_attr(x_layout, "name"))) {
if ((val = switch_xml_attr(x_image, "reservation_id"))) {
res_id = val;
}
-
+
if ((val = switch_xml_attr(x_image, "audio-position"))) {
audio_position = val;
}
-
-
+
if (x < 0 || y < 0 || scale < 0 || !name) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid image\n");
continue;
const char *name = switch_xml_attr(x_group, "name");
layout_group_t *lg;
video_layout_node_t *last_vlnode = NULL;
-
+
x_layout = switch_xml_child(x_group, "layout");
if (!name || !x_group || !x_layout) {
lg = switch_core_alloc(conference->pool, sizeof(*lg));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding layout group %s\n", name);
switch_core_hash_insert(conference->layout_group_hash, name, lg);
-
+
while(x_layout) {
const char *nname = x_layout->txt;
video_layout_t *vlayout;
if (!member->session) abort();
switch_mutex_lock(member->conference->canvas->mutex);
-
+
channel = switch_core_session_get_channel(member->session);
res_id = switch_channel_get_variable(channel, "video_reservation_id");
-
+
layer = &member->conference->canvas->layers[idx];
if (!conference->canvas) return;
conference->canvas->layout_floor_id = -1;
-
+
for (i = 0; i < vlayout->layers; i++) {
mcu_layer_t *layer = &conference->canvas->layers[i];
layer->idx = i;
if (layer->geometry.floor) {
- conference->canvas->layout_floor_id = i;
+ conference->canvas->layout_floor_id = i;
}
- /* if we ever decided to reload layers config on demand the pointer assignment below will lead to segs but we
+ /* if we ever decided to reload layers config on demand the pointer assignment below will lead to segs but we
only load them once forever per conference so these pointers are valid for the life of the conference */
layer->geometry.res_id = vlayout->images[i].res_id;
layer->geometry.audio_position = vlayout->images[i].audio_position;
}
- if (conference->canvas->layout_floor_id > -1 &&
+ if (conference->canvas->layout_floor_id > -1 &&
conference->video_floor_holder && (member = conference_member_get(conference, conference->video_floor_holder))) {
attach_video_layer(member, conference->canvas->layout_floor_id);
switch_thread_rwlock_unlock(member->rwlock);
switch_codec_t codec;
switch_frame_t frame;
uint8_t *packet;
-} codec_set_t;
+} codec_set_t;
static void write_canvas_image_to_codec_group(conference_obj_t *conference, codec_set_t *codec_set,
int codec_index, uint32_t timestamp, switch_bool_t need_refresh, switch_bool_t need_keyframe)
-
+
{
conference_member_t *imember;
switch_frame_t write_frame = { 0 }, *frame = NULL;
frame = &write_frame;
frame->img = codec_set->frame.img;
frame->packet = codec_set->frame.packet;
-
+
switch_clear_flag(frame, SFF_SAME_IMAGE);
frame->m = 0;
frame->timestamp = timestamp;
switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
continue;
}
-
+
if (need_refresh) {
switch_core_session_request_video_refresh(imember->session);
}
-
+
switch_core_session_write_encoded_video_frame(imember->session, frame, 0, 0);
switch_core_session_rwunlock(imember->session);
init_canvas(conference, vlayout);
switch_core_timer_init(&timer, "soft", 1, 90, conference->pool);
-
+
switch_mutex_lock(conference->canvas->cond_mutex);
while (globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT) && switch_test_flag(conference, CFLAG_VIDEO_MUXING)) {
break;
}
}
-
+
if (imember->video_codec_index < 0) {
write_codecs[i] = switch_core_alloc(conference->pool, sizeof(codec_set_t));
-
+
if (switch_core_codec_copy(check_codec, &write_codecs[i]->codec, conference->pool) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Setting up video write codec %s at slot %d\n", write_codecs[i]->codec.implementation->iananame, i);
-
+
imember->video_codec_index = i;
imember->video_codec_id = check_codec->implementation->codec_id;
used++;
switch_mutex_lock(conference->canvas->mutex);
- //printf("MEMBER %d layer_id %d canvas: %d/%d\n", imember->id, imember->video_layer_id,
+ //printf("MEMBER %d layer_id %d canvas: %d/%d\n", imember->id, imember->video_layer_id,
//conference->canvas->layers_used, conference->canvas->total_layers);
if (imember->video_layer_id > -1) {
if (remaining) goto top;
- if (used) {
+ if (used) {
switch_time_t now = switch_micro_time_now();
#ifdef TRACK_FPS
for (imember = conference->members; imember; imember = imember->next) {
switch_channel_t *ichannel = switch_core_session_get_channel(imember->session);
- if (!imember->session || !switch_channel_test_flag(ichannel, CF_VIDEO) ||
+ if (!imember->session || !switch_channel_test_flag(ichannel, CF_VIDEO) ||
switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
continue;
}
write_frame.buflen = write_frame.datalen;
write_frame.packetlen = SWITCH_RECOMMENDED_BUFFER_SIZE;
- switch_core_session_write_video_frame(imember->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
-
+ switch_core_session_write_video_frame(imember->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
+
if (imember->session) {
switch_core_session_rwunlock(imember->session);
}
for (i = 0; i < MCU_MAX_LAYERS; i++) {
layer = &conference->canvas->layers[i];
-
+
switch_img_free(&layer->cur_img);
switch_img_free(&layer->img);
}
}
switch_thread_rwlock_unlock(imember->rwlock);
imember = NULL;
- }
+ }
old_member = conference->video_floor_holder;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Dropping video floor %d\n", old_member);
if (member && conference->canvas && conference->canvas->layout_floor_id > -1) {
attach_video_layer(member, conference->canvas->layout_floor_id);
}
-
+
if (member) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Adding video floor %s\n",
switch_channel_get_name(member->channel));
switch_event_fire(&event);
}
}
-
+
find_video_floor(member, SWITCH_FALSE);
detach_video_layer(member);
if (((lg = switch_core_hash_find(conference->layout_group_hash, argv[3])))) {
vlayout = find_best_layout(conference, lg);
}
-
+
if (!vlayout) {
stream->write_function(stream, "Invalid group layout [%s]\n", argv[3]);
return SWITCH_STATUS_SUCCESS;
}
if (video_layout_name) {
-
if (!strncasecmp(video_layout_name, "group:", 6)) {
if (!switch_core_hash_find(conference->layout_group_hash, video_layout_name + 6)) {
video_layout_name = NULL;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid conference layout group settings\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid conference layout group settings\n");
} else {
video_layout_group = video_layout_name + 6;
}
} else if (!switch_core_hash_find(conference->layout_hash, video_layout_name)) {
video_layout_name = NULL;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid conference layout settings\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid conference layout settings\n");
}
}