FS-7656 fix various edge cases with video and non video files mixed into a source, fix a typo bug in file_read_video and fix same bug in mod_vlc, add a new flag to file_read_video to check if the handle is has active video, make mod_conference move the video in and out of a layer when the stream has video or not

This commit is contained in:
Anthony Minessale committed 2015-06-19 00:57:02 -05:00
1 parent 434d39d450
commit 385a3b545c
7 files changed
+175 -65

No files matched your search

+4
View File
@@ -1578,6 +1578,10 @@ static switch_status_t av_file_read(switch_file_handle_t *handle, void *data, si
av_file_context_t *context = (av_file_context_t *)handle->private_info;
int size;
if ((flags & SVR_CHECK)) {
return SWITCH_STATUS_BREAK;
}
if (!context->has_audio && context->has_video && switch_queue_size(context->eh.video_queue) > 0) {
memset(data, 0, *len * handle->channels * 2);
return SWITCH_STATUS_SUCCESS;
@@ -1906,19 +1906,43 @@ static void check_flush(conference_member_t *member)
}
}
static void patch_fnode(conference_obj_t *conference, conference_file_node_t *fnode, switch_frame_t *write_frame)
static void patch_fnode(conference_obj_t *conference, conference_file_node_t *fnode)
{
if (fnode && fnode->layer_id > -1) {
mcu_layer_t *layer = &conference->canvas->layers[fnode->layer_id];
if (switch_core_file_read_video(&fnode->fh, write_frame, SVR_FLUSH) == SWITCH_STATUS_SUCCESS) {
switch_frame_t file_frame = { 0 };
switch_status_t status = switch_core_file_read_video(&fnode->fh, &file_frame, SVR_FLUSH);
if (status == SWITCH_STATUS_SUCCESS) {
switch_img_free(&layer->cur_img);
layer->cur_img = write_frame->img;
layer->cur_img = file_frame.img;
layer->tagged = 1;
} else if (status == SWITCH_STATUS_IGNORE) {
if (conference->canvas && fnode->layer_id > -1 ) {
canvas_del_fnode_layer(conference, fnode);
}
}
}
}
static void fnode_check_video(conference_obj_t *conference, conference_file_node_t *fnode) {
if (switch_core_file_has_video(&fnode->fh) && switch_core_file_read_video(&fnode->fh, NULL, SVR_CHECK) == SWITCH_STATUS_BREAK) {
int full_screen = 0;
if (fnode->fh.params) {
full_screen = switch_true(switch_event_get_header(fnode->fh.params, "full-screen"));
}
if (full_screen) {
conference->canvas->play_file = 1;
conference->playing_video_file = 1;
} else {
canvas_set_fnode_layer(conference, fnode, -1);
}
}
}
static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thread, void *obj)
{
conference_obj_t *conference = (conference_obj_t *) obj;
@@ -2275,12 +2299,20 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
switch_mutex_unlock(conference->member_mutex);
if (conference->async_fnode && conference->async_fnode->layer_id > -1) {
patch_fnode(conference, conference->async_fnode, &write_frame);
}
if (conference->async_fnode) {
if (conference->async_fnode->layer_id > -1) {
patch_fnode(conference, conference->async_fnode);
} else {
fnode_check_video(conference, conference->async_fnode);
}
}
if (conference->fnode && conference->fnode->layer_id > -1) {
patch_fnode(conference, conference->fnode, &write_frame);
if (conference->fnode) {
if (conference->fnode->layer_id > -1) {
patch_fnode(conference, conference->fnode);
} else {
fnode_check_video(conference, conference->fnode);
}
}
if (!conference->playing_video_file) {
@@ -4989,24 +5021,6 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
return SWITCH_STATUS_SUCCESS;
}
static void fnode_check_video(conference_obj_t *conference, conference_file_node_t *fnode) {
if (switch_core_file_has_video(&fnode->fh)) {
int full_screen = 0;
if (fnode->fh.params) {
full_screen = switch_true(switch_event_get_header(fnode->fh.params, "full-screen"));
}
if (full_screen) {
conference->canvas->play_file = 1;
conference->playing_video_file = 1;
} else {
canvas_set_fnode_layer(conference, fnode, -1);
}
}
}
static void conference_command_handler(switch_live_array_t *la, const char *cmd, const char *sessid, cJSON *jla, void *user_data)
{
}