SWITCH_ABC_TYPE_READ_PING,
SWITCH_ABC_TYPE_TAP_NATIVE_READ,
SWITCH_ABC_TYPE_TAP_NATIVE_WRITE,
- SWITCH_ABC_TYPE_CLOSE
+ SWITCH_ABC_TYPE_CLOSE,
+ SWITCH_ABC_TYPE_READ_VIDEO_PING
} switch_abc_type_t;
typedef struct {
goto done;
}
+ if (session->bugs) {
+ switch_media_bug_t *bp;
+ switch_bool_t ok = SWITCH_TRUE;
+ int prune = 0;
+ switch_thread_rwlock_rdlock(session->bug_rwlock);
+ for (bp = session->bugs; bp; bp = bp->next) {
+ if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
+ continue;
+ }
+
+ if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) {
+ continue;
+ }
+
+ if (switch_test_flag(bp, SMBF_PRUNE)) {
+ prune++;
+ continue;
+ }
+
+ if (bp->ready && switch_test_flag(bp, SMBF_READ_PING)) {
+ switch_mutex_lock(bp->read_mutex);
+ bp->ping_frame = *frame;
+ if (bp->callback) {
+ if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_VIDEO_PING) == SWITCH_FALSE
+ || (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL))) {
+ ok = SWITCH_FALSE;
+ }
+ }
+ bp->ping_frame = NULL;;
+ switch_mutex_unlock(bp->read_mutex);
+ }
+
+ if (ok == SWITCH_FALSE) {
+ switch_set_flag(bp, SMBF_PRUNE);
+ prune++;
+ }
+ }
+ switch_thread_rwlock_unlock(session->bug_rwlock);
+ if (prune) {
+ switch_core_media_bug_prune(session);
+ }
+ }
+
done:
return status;
*/
#include <switch.h>
+#include "private/switch_core_pvt.h"
#include <speex/speex_preprocess.h>
#include <speex/speex_echo.h>
}
}
break;
+ case SWITCH_ABC_TYPE_READ_VIDEO_PING:
+
+ if (rh->fh) {
+ switch_size_t len;
+
+ if (!bug->ping_frame) break;
+
+ len = bug->ping_frame->packetlen;
+
+ if (len && switch_core_file_write_video(rh->fh, bug->ping_frame->packet, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing video to %s\n", rh->file);
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+ return SWITCH_FALSE;
+ }
+ }
+ break;
case SWITCH_ABC_TYPE_WRITE:
default:
break;