FS-7500: add ability to insert a custom callback to the core video thread

the callback will be called on each loop on read video frame, or
the callback function call run it's own loop to take over the core
loop so it can read video from session by itself.

the callback function can -

return SWITCH_STATUS_SUCCESS to wait another loop
return SWITCH_STATUS_CONTINUE to continue use the default behaviour
return anything else will break the core video loop and end the
       core thread
This commit is contained in:
Seven Du
2014-08-23 16:54:50 +08:00
committed by Michael Jerris
parent 422a1f0419
commit 35ff4b5cda
5 changed files with 66 additions and 1 deletions

View File

@@ -4518,6 +4518,14 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
continue;
}
status = switch_core_session_video_thread_callback(session, read_frame);
if (status != SWITCH_STATUS_CONTINUE) {
if (status == SWITCH_STATUS_SUCCESS) continue;
break;
}
if (switch_channel_test_flag(channel, CF_VIDEO_ECHO)) {
switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
}