[core,mod_conference] Fix memory leak on clearing down member call by changing way of flushing frame buffer
This commit is contained in:
parent
f9bb8940c2
commit
7dfb7d2292
|
@ -1480,6 +1480,7 @@ SWITCH_DECLARE(void) switch_http_parse_qs(switch_http_request_t *request, char *
|
|||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_free(switch_frame_buffer_t *fb, switch_frame_t **frameP);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_dup(switch_frame_buffer_t *fb, switch_frame_t *orig, switch_frame_t **clone);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_destroy(switch_frame_buffer_t **fbP);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_flush(switch_frame_buffer_t *fb);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_create(switch_frame_buffer_t **fbP, switch_size_t qlen);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_push(switch_frame_buffer_t *fb, void *ptr);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_trypush(switch_frame_buffer_t *fb, void *ptr);
|
||||
|
|
|
@ -2306,40 +2306,31 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
|
|||
|
||||
loops++;
|
||||
|
||||
if ((switch_size_t)pop != 1) {
|
||||
frame = (switch_frame_t *) pop;
|
||||
if (switch_test_flag(frame, SFF_ENCODED)) {
|
||||
switch_core_session_write_encoded_video_frame(member->session, frame, 0, 0);
|
||||
} else {
|
||||
switch_core_session_write_video_frame(member->session, frame, SWITCH_IO_FLAG_NONE, 0);
|
||||
}
|
||||
frame = (switch_frame_t *) pop;
|
||||
if (switch_test_flag(frame, SFF_ENCODED)) {
|
||||
switch_core_session_write_encoded_video_frame(member->session, frame, 0, 0);
|
||||
} else {
|
||||
switch_core_session_write_video_frame(member->session, frame, SWITCH_IO_FLAG_NONE, 0);
|
||||
}
|
||||
|
||||
if (!switch_test_flag(frame, SFF_ENCODED) || frame->m) {
|
||||
switch_time_t now = switch_time_now();
|
||||
if (!switch_test_flag(frame, SFF_ENCODED) || frame->m) {
|
||||
switch_time_t now = switch_time_now();
|
||||
|
||||
if (last) {
|
||||
int delta = (int)(now - last);
|
||||
if (delta > member->conference->video_fps.ms * 5000) {
|
||||
switch_core_session_request_video_refresh(member->session);
|
||||
}
|
||||
if (last) {
|
||||
int delta = (int)(now - last);
|
||||
if (delta > member->conference->video_fps.ms * 5000) {
|
||||
switch_core_session_request_video_refresh(member->session);
|
||||
}
|
||||
|
||||
last = now;
|
||||
}
|
||||
|
||||
switch_frame_buffer_free(member->fb, &frame);
|
||||
|
||||
last = now;
|
||||
}
|
||||
|
||||
switch_frame_buffer_free(member->fb, &frame);
|
||||
}
|
||||
}
|
||||
|
||||
while (switch_frame_buffer_trypop(member->fb, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
if (pop) {
|
||||
if ((switch_size_t)pop != 1) {
|
||||
frame = (switch_frame_t *) pop;
|
||||
switch_frame_buffer_free(member->fb, &frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch_frame_buffer_flush(member->fb);
|
||||
|
||||
switch_thread_rwlock_unlock(member->rwlock);
|
||||
|
||||
|
|
|
@ -290,11 +290,30 @@ SWITCH_DECLARE(int) switch_frame_buffer_size(switch_frame_buffer_t *fb)
|
|||
return switch_queue_size(fb->queue);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_flush(switch_frame_buffer_t *fb)
|
||||
{
|
||||
void *pop;
|
||||
switch_frame_t *frame;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
|
||||
if (fb) {
|
||||
while ((status = switch_frame_buffer_trypop(fb, &pop)) == SWITCH_STATUS_SUCCESS) {
|
||||
if (pop) {
|
||||
frame = (switch_frame_t *) pop;
|
||||
switch_frame_buffer_free(fb, &frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_buffer_destroy(switch_frame_buffer_t **fbP)
|
||||
{
|
||||
switch_frame_buffer_t *fb = *fbP;
|
||||
switch_memory_pool_t *pool;
|
||||
*fbP = NULL;
|
||||
switch_frame_buffer_flush(fb);
|
||||
pool = fb->pool;
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
|
||||
|
|
Loading…
Reference in New Issue