FS-9498 #resolve [Try to make video writing thread more efficient]
This commit is contained in:
parent
fd724a7b97
commit
43c10074fb
|
@ -1516,8 +1516,9 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
|
||||||
conference_member_t *member = (conference_member_t *) obj;
|
conference_member_t *member = (conference_member_t *) obj;
|
||||||
void *pop;
|
void *pop;
|
||||||
switch_frame_t *frame;
|
switch_frame_t *frame;
|
||||||
int loops = 0;
|
int loops = 0, patched = 0;
|
||||||
switch_time_t last = 0;
|
switch_time_t last = 0;
|
||||||
|
switch_status_t pop_status;
|
||||||
|
|
||||||
if (switch_thread_rwlock_tryrdlock(member->rwlock) != SWITCH_STATUS_SUCCESS) {
|
if (switch_thread_rwlock_tryrdlock(member->rwlock) != SWITCH_STATUS_SUCCESS) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1526,7 +1527,13 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
|
||||||
//switch_core_autobind_cpu();
|
//switch_core_autobind_cpu();
|
||||||
|
|
||||||
while(conference_utils_member_test_flag(member, MFLAG_RUNNING)) {
|
while(conference_utils_member_test_flag(member, MFLAG_RUNNING)) {
|
||||||
if (switch_queue_pop(member->mux_out_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
if (patched) {
|
||||||
|
pop_status = switch_queue_trypop(member->mux_out_queue, &pop);
|
||||||
|
} else {
|
||||||
|
pop_status = switch_queue_pop(member->mux_out_queue, &pop);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pop_status == SWITCH_STATUS_SUCCESS) {
|
||||||
mcu_layer_t *layer = NULL;
|
mcu_layer_t *layer = NULL;
|
||||||
mcu_canvas_t *canvas = NULL;
|
mcu_canvas_t *canvas = NULL;
|
||||||
|
|
||||||
|
@ -1569,6 +1576,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
|
||||||
|
|
||||||
canvas = NULL;
|
canvas = NULL;
|
||||||
layer = NULL;
|
layer = NULL;
|
||||||
|
patched = 0;
|
||||||
|
|
||||||
switch_mutex_lock(member->conference->canvas_mutex);
|
switch_mutex_lock(member->conference->canvas_mutex);
|
||||||
if (member->video_layer_id > -1 && member->canvas_id > -1) {
|
if (member->video_layer_id > -1 && member->canvas_id > -1) {
|
||||||
|
@ -1578,14 +1586,13 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
|
||||||
if (layer->need_patch && switch_thread_rwlock_tryrdlock(canvas->video_rwlock) == SWITCH_STATUS_SUCCESS) {
|
if (layer->need_patch && switch_thread_rwlock_tryrdlock(canvas->video_rwlock) == SWITCH_STATUS_SUCCESS) {
|
||||||
if (layer->need_patch) {
|
if (layer->need_patch) {
|
||||||
conference_video_scale_and_patch(layer, NULL, SWITCH_FALSE);
|
conference_video_scale_and_patch(layer, NULL, SWITCH_FALSE);
|
||||||
|
patched++;
|
||||||
layer->need_patch = 0;
|
layer->need_patch = 0;
|
||||||
}
|
}
|
||||||
switch_thread_rwlock_unlock(canvas->video_rwlock);
|
switch_thread_rwlock_unlock(canvas->video_rwlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(member->conference->canvas_mutex);
|
switch_mutex_unlock(member->conference->canvas_mutex);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1143,7 +1143,7 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
|
||||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, %d\n", context->no_key_frame);
|
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, %d\n", context->no_key_frame);
|
||||||
if (context->no_key_frame > 50) {
|
if (context->no_key_frame > 50) {
|
||||||
if ((is_keyframe = is_start)) {
|
if ((is_keyframe = is_start)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, treating start as key. frames=%d\n", context->no_key_frame);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "no keyframe, treating start as key. frames=%d\n", context->no_key_frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue