FS-8240 finishing touches
This commit is contained in:
parent
cc00d1d098
commit
b990e30a93
|
@ -1809,10 +1809,14 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
|
||||||
int fps = (int)ceil(handle->mm.fps);
|
int fps = (int)ceil(handle->mm.fps);
|
||||||
int min_qsize = context->read_fps;
|
int min_qsize = context->read_fps;
|
||||||
|
|
||||||
if (fps < min_qsize) {
|
if (fps && fps < min_qsize) {
|
||||||
min_qsize = fps;
|
min_qsize = fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!min_qsize) {
|
||||||
|
min_qsize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!context->file_read_thread_running) {
|
if (!context->file_read_thread_running) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1821,6 +1825,10 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
|
||||||
return SWITCH_STATUS_BREAK;
|
return SWITCH_STATUS_BREAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switch_queue_size(context->eh.video_queue) < min_qsize / 2) {
|
||||||
|
return SWITCH_STATUS_BREAK;
|
||||||
|
}
|
||||||
|
|
||||||
while((flags & SVR_FLUSH) && switch_queue_size(context->eh.video_queue) > min_qsize) {
|
while((flags & SVR_FLUSH) && switch_queue_size(context->eh.video_queue) > min_qsize) {
|
||||||
if (switch_queue_trypop(context->eh.video_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_trypop(context->eh.video_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_image_t *img = (switch_image_t *) pop;
|
switch_image_t *img = (switch_image_t *) pop;
|
||||||
|
|
|
@ -70,6 +70,7 @@ struct local_stream_context {
|
||||||
int last_h;
|
int last_h;
|
||||||
int serno;
|
int serno;
|
||||||
int pop_count;
|
int pop_count;
|
||||||
|
int video_sync;
|
||||||
switch_image_t *banner_img;
|
switch_image_t *banner_img;
|
||||||
switch_time_t banner_timeout;
|
switch_time_t banner_timeout;
|
||||||
struct local_stream_context *next;
|
struct local_stream_context *next;
|
||||||
|
@ -160,6 +161,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
||||||
switch_memory_pool_t *temp_pool = NULL;
|
switch_memory_pool_t *temp_pool = NULL;
|
||||||
uint32_t dir_count = 0, do_shuffle = 0;
|
uint32_t dir_count = 0, do_shuffle = 0;
|
||||||
char *p;
|
char *p;
|
||||||
|
int old_total = 0;
|
||||||
|
|
||||||
switch_mutex_lock(globals.mutex);
|
switch_mutex_lock(globals.mutex);
|
||||||
THREADS++;
|
THREADS++;
|
||||||
|
@ -362,6 +364,16 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
||||||
|
|
||||||
is_open = switch_test_flag(use_fh, SWITCH_FILE_OPEN);
|
is_open = switch_test_flag(use_fh, SWITCH_FILE_OPEN);
|
||||||
|
|
||||||
|
if (is_open && source->total != old_total && source->total == 1) {
|
||||||
|
if (switch_core_file_has_video(&fh)) {
|
||||||
|
flush_video_queue(source->video_q);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_buffer_zero(audio_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
old_total = source->total;
|
||||||
|
|
||||||
if (source->hup) {
|
if (source->hup) {
|
||||||
source->hup = 0;
|
source->hup = 0;
|
||||||
if (is_open) {
|
if (is_open) {
|
||||||
|
@ -453,6 +465,8 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source->prebuf = source->samples * 2 * source->channels * 10;
|
||||||
|
|
||||||
if (!is_open || used >= source->prebuf || (source->total && used > source->samples * 2 * source->channels)) {
|
if (!is_open || used >= source->prebuf || (source->total && used > source->samples * 2 * source->channels)) {
|
||||||
void *pop;
|
void *pop;
|
||||||
|
|
||||||
|
@ -760,6 +774,8 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
|
||||||
local_stream_context_t *context = handle->private_info;
|
local_stream_context_t *context = handle->private_info;
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
switch_time_t now;
|
switch_time_t now;
|
||||||
|
int fps = (int)ceil(handle->mm.fps);
|
||||||
|
int min_qsize = fps;
|
||||||
|
|
||||||
if (!(context->ready && context->source->ready)) {
|
if (!(context->ready && context->source->ready)) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
|
@ -798,7 +814,9 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
|
||||||
return SWITCH_STATUS_BREAK;
|
return SWITCH_STATUS_BREAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(context->ready && context->source->ready && (flags & SVR_FLUSH) && switch_queue_size(context->video_q) > 1) {
|
context->video_sync = 1;
|
||||||
|
|
||||||
|
while(context->ready && context->source->ready && (flags & SVR_FLUSH) && switch_queue_size(context->video_q) > min_qsize) {
|
||||||
if (switch_queue_trypop(context->video_q, &pop) == SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_trypop(context->video_q, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_image_t *img = (switch_image_t *) pop;
|
switch_image_t *img = (switch_image_t *) pop;
|
||||||
switch_img_free(&img);
|
switch_img_free(&img);
|
||||||
|
|
Loading…
Reference in New Issue