mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-22 11:53:16 +00:00
FS-7656 not quite reporting when it was video or not
This commit is contained in:
parent
a81a896690
commit
696496c252
@ -101,6 +101,7 @@ struct local_stream_source {
|
|||||||
int32_t chime_max_counter;
|
int32_t chime_max_counter;
|
||||||
switch_file_handle_t chime_fh;
|
switch_file_handle_t chime_fh;
|
||||||
switch_queue_t *video_q;
|
switch_queue_t *video_q;
|
||||||
|
int has_video;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct local_stream_source local_stream_source_t;
|
typedef struct local_stream_source local_stream_source_t;
|
||||||
@ -230,7 +231,6 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
while (RUNNING && !source->stopped) {
|
while (RUNNING && !source->stopped) {
|
||||||
int is_open;
|
int is_open;
|
||||||
switch_file_handle_t *use_fh = &fh;
|
switch_file_handle_t *use_fh = &fh;
|
||||||
int has_video = 0;
|
|
||||||
|
|
||||||
switch_core_timer_next(&timer);
|
switch_core_timer_next(&timer);
|
||||||
olen = source->samples;
|
olen = source->samples;
|
||||||
@ -282,17 +282,14 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
has_video = 0;
|
|
||||||
|
|
||||||
if (is_open) {
|
if (is_open) {
|
||||||
|
|
||||||
if (switch_core_file_has_video(use_fh)) {
|
if (switch_core_file_has_video(use_fh)) {
|
||||||
switch_frame_t vid_frame = { 0 };
|
switch_frame_t vid_frame = { 0 };
|
||||||
|
|
||||||
has_video = 1;
|
|
||||||
|
|
||||||
if (switch_core_file_read_video(use_fh, &vid_frame, SVR_FLUSH) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_file_read_video(use_fh, &vid_frame, SVR_FLUSH) == SWITCH_STATUS_SUCCESS) {
|
||||||
if (vid_frame.img) {
|
if (vid_frame.img) {
|
||||||
|
source->has_video = 1;
|
||||||
switch_queue_push(source->video_q, vid_frame.img);
|
switch_queue_push(source->video_q, vid_frame.img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,7 +343,8 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
|
|
||||||
switch_mutex_lock(source->mutex);
|
switch_mutex_lock(source->mutex);
|
||||||
for (cp = source->context_list; cp && RUNNING; cp = cp->next) {
|
for (cp = source->context_list; cp && RUNNING; cp = cp->next) {
|
||||||
if (has_video) {
|
|
||||||
|
if (source->has_video) {
|
||||||
switch_set_flag(cp->handle, SWITCH_FILE_FLAG_VIDEO);
|
switch_set_flag(cp->handle, SWITCH_FILE_FLAG_VIDEO);
|
||||||
} else {
|
} else {
|
||||||
switch_clear_flag(cp->handle, SWITCH_FILE_FLAG_VIDEO);
|
switch_clear_flag(cp->handle, SWITCH_FILE_FLAG_VIDEO);
|
||||||
@ -579,6 +577,10 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && !source->has_video) {
|
||||||
|
switch_clear_flag(handle, SWITCH_FILE_FLAG_VIDEO);
|
||||||
|
}
|
||||||
|
|
||||||
context->source = source;
|
context->source = source;
|
||||||
context->file = handle->file;
|
context->file = handle->file;
|
||||||
context->func = handle->func;
|
context->func = handle->func;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user