Merge pull request #2232 from signalwire/coverity_1364946

[core] Coverity 1364946 Unchecked return value
This commit is contained in:
Andrey Volk 2023-09-11 14:06:48 +03:00 committed by GitHub
commit 792eee44d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -6732,6 +6732,7 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
float fps = 15.0f; float fps = 15.0f;
switch_image_t *last_frame = NULL; switch_image_t *last_frame = NULL;
int last_w = 0, last_h = 0, kps = 0; int last_w = 0, last_h = 0, kps = 0;
switch_status_t res;
if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
return NULL; return NULL;
@ -6739,10 +6740,12 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
if (!(smh = session->media_handle)) { if (!(smh = session->media_handle)) {
switch_core_session_rwunlock(session); switch_core_session_rwunlock(session);
return NULL; return NULL;
} }
switch_core_session_get_partner(session, &b_session); res = switch_core_session_get_partner(session, &b_session);
(void)res;
switch_channel_set_flag(session->channel, CF_VIDEO_WRITING); switch_channel_set_flag(session->channel, CF_VIDEO_WRITING);
@ -6763,7 +6766,6 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
fr.buflen = buflen - 12; fr.buflen = buflen - 12;
switch_core_media_gen_key_frame(session); switch_core_media_gen_key_frame(session);
if (smh->video_write_fh) { if (smh->video_write_fh) {
if (smh->video_write_fh->mm.fps) { if (smh->video_write_fh->mm.fps) {
fps = smh->video_write_fh->mm.fps; fps = smh->video_write_fh->mm.fps;
@ -6803,8 +6805,6 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
switch_channel_up_nosig(session->channel) && smh->video_write_fh && switch_test_flag(smh->video_write_fh, SWITCH_FILE_OPEN)) { switch_channel_up_nosig(session->channel) && smh->video_write_fh && switch_test_flag(smh->video_write_fh, SWITCH_FILE_OPEN)) {
switch_status_t wstatus = SWITCH_STATUS_FALSE; switch_status_t wstatus = SWITCH_STATUS_FALSE;
switch_core_timer_next(&timer); switch_core_timer_next(&timer);
switch_mutex_lock(v_engine->mh.file_write_mutex); switch_mutex_lock(v_engine->mh.file_write_mutex);
@ -6847,12 +6847,14 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
switch_set_flag_locked(smh->video_write_fh, SWITCH_FILE_FLAG_VIDEO_EOF); switch_set_flag_locked(smh->video_write_fh, SWITCH_FILE_FLAG_VIDEO_EOF);
} }
} }
switch_mutex_unlock(v_engine->mh.file_write_mutex); switch_mutex_unlock(v_engine->mh.file_write_mutex);
} }
if (last_frame) { if (last_frame) {
int x = 0; int x = 0;
switch_rgb_color_t bgcolor; switch_rgb_color_t bgcolor;
switch_color_set_rgb(&bgcolor, "#000000"); switch_color_set_rgb(&bgcolor, "#000000");
switch_img_fill(last_frame, 0, 0, last_frame->d_w, last_frame->d_h, &bgcolor); switch_img_fill(last_frame, 0, 0, last_frame->d_w, last_frame->d_h, &bgcolor);
fr.img = last_frame; fr.img = last_frame;
@ -6863,12 +6865,12 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
fr.flags = SFF_USE_VIDEO_TIMESTAMP|SFF_RAW_RTP|SFF_RAW_RTP_PARSE_FRAME; fr.flags = SFF_USE_VIDEO_TIMESTAMP|SFF_RAW_RTP|SFF_RAW_RTP_PARSE_FRAME;
switch_core_session_write_video_frame(session, &fr, SWITCH_IO_FLAG_FORCE, 0); switch_core_session_write_video_frame(session, &fr, SWITCH_IO_FLAG_FORCE, 0);
} }
switch_core_media_gen_key_frame(session); switch_core_media_gen_key_frame(session);
switch_core_session_request_video_refresh(session); switch_core_session_request_video_refresh(session);
switch_img_free(&last_frame); switch_img_free(&last_frame);
} }
switch_core_timer_destroy(&timer); switch_core_timer_destroy(&timer);
switch_core_session_rwunlock(session); switch_core_session_rwunlock(session);
@ -6878,7 +6880,6 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
switch_core_session_rwunlock(b_session); switch_core_session_rwunlock(b_session);
} }
v_engine->thread_write_lock = 0; v_engine->thread_write_lock = 0;
switch_mutex_unlock(smh->write_mutex[SWITCH_MEDIA_TYPE_VIDEO]); switch_mutex_unlock(smh->write_mutex[SWITCH_MEDIA_TYPE_VIDEO]);