/* Timeout to check for idle senders/members */ UT_STATIC void rtcp_member_timeout_cb (const vqec_event_t * const evptr, int32_t fd, int16_t event, void *arg) { struct timeval tv; rtp_session_t *p_sess = NULL; uint32_t interval = 0; if (!arg) { rtcp_tmevt_log_err("%s %s", __FUNCTION__, s_arg_is_null); /*sa_ignore {nothing to be done if stop fails} IGNORE_RETURN (1) */ vqec_event_stop(evptr); return; } p_sess = (rtp_session_t *)arg; /* check for idle senders */ MCALL(p_sess, rtp_session_timeout_slist); /* check for idle members */ MCALL(p_sess, rtp_session_timeout_glist); /* restart the timer */ timerclear(&tv); interval = MCALL(p_sess, rtcp_report_interval, p_sess->we_sent, TRUE /* jitter the interval */); tv = TIME_GET_R(timeval,TIME_MK_R(usec, (int64_t)interval)) ; /*sa_ignore {no recourse if start fails} IGNORE_RETURN (1) */ vqec_event_start(evptr, &tv); }
/** Just returns a point, offset by the position of the door. Moves * with its parent building, if it has one. */ mapping exit_shape() { switch( MCALL(query_dir()) ) { case "west": case "east": return SHAPE_OFFSET( SHAPE_BOX(1,4), MCALL(query_coord()) + MAKE_C(4096, 4096-1, 32) ); case "north": case "south": return SHAPE_OFFSET( SHAPE_BOX(5,1), MCALL(query_coord()) + MAKE_C(4096-2, 4096, 32) ); } }
/**--------------------------------------------------------------------------- * Internal implementation of RTCP packet processing. * * @param[in] rtp_session Pointer to a repair or primary session. * @param[in] pak_src_addr IP source address of the RTCP packet. * @param[in] pak_src_port UDP source port of the RTCP packet. * @param[in] pak_buff Contents of the RTCP packet. * @param[in] pak_buff_len Length of the RTCP packet. * @param[in] recv_time Time at which packet is received. *---------------------------------------------------------------------------*/ static void rtcp_event_handler_internal_process_pak (rtp_session_t *rtp_session, struct in_addr pak_src_addr, uint16_t pak_src_port, char *pak_buff, int32_t pak_buff_len, struct timeval *recv_time) { abs_time_t t; rtp_envelope_t addrs; addrs.src_addr = pak_src_addr.s_addr; addrs.src_port = pak_src_port; addrs.dst_addr = 0; addrs.dst_port = 0; t = timeval_to_abs_time(*recv_time); MCALL((rtp_session_t *)rtp_session, rtcp_recv_packet, t, FALSE, /* messages are NOT from "receive only" members */ &addrs, pak_buff, pak_buff_len); VQEC_DEBUG(VQEC_DEBUG_RTCP, "received rtcp packet srcadd = 0x%x, src_port = %d, ts = %llu\n", ntohl(pak_src_addr.s_addr), ntohs(pak_src_port), t.usec); }
/* * This callback is executed when the time to send the next * receiver report is reached. */ UT_STATIC void rtcp_receive_report_timeout_cb (const vqec_event_t * const evptr, int32_t fd, int16_t event, void *arg) { rtp_session_t *p_sess = NULL; rtp_member_t *local_member = NULL; uint64_t time; struct timeval tv; if (!arg) { rtcp_tmevt_log_err("%s %s", __FUNCTION__, s_arg_is_null); /* ignore return {nothing to be done if stop fails} */ (void)vqec_event_stop(evptr); return; } p_sess = (rtp_session_t *)arg; local_member = p_sess->rtp_local_source; if (!local_member) { rtcp_tmevt_log_err("%s %s", __FUNCTION__, s_src_is_null); /* ignore return nothing to be done if stop fails */ (void)vqec_event_stop(evptr); return; } /* Update the timestamps */ time = TIME_GET_A(msec, get_sys_time()); local_member->rtp_timestamp = (uint32_t)time; local_member->ntp_timestamp = abs_time_to_ntp(msec_to_abs_time(time)); MCALL(p_sess, rtp_update_stats, TRUE); MCALL(p_sess, rtp_session_timeout_transmit_report); timerclear(&tv); rel_time_t diff = TIME_SUB_A_A(p_sess->next_send_ts, msec_to_abs_time(time)); /* If the rel-time delta is -ive [lagging behind] use 0. */ if (TIME_CMP_R(lt, diff, REL_TIME_0)) { diff = REL_TIME_0; } tv = TIME_GET_R(timeval, diff); /* ignore return no recourse if start fails*/ (void)vqec_event_start(evptr, &tv); }
/** Draw the exit. This adds the capability of drawing a closed (+) door. */ void on_paint( object painter ) { int p; mapping draw_shape = MCALL(exit_shape()); if( !draw_shape ) return; foreach( p : draw_shape ) painter->paint( CX(p)-4096, CY(p)-4096, query_dir()=="up"?'<':'>', 0x0F, LAYER_ROUGH ); }
/** Draw the exit. If you are writing your own exit type, you * should override this function */ void on_paint( object painter ) { int p = MCALL( query_coord() ); int x = MCALL(query_x()), y = MCALL(query_y()); switch( MCALL(query_dir()) ) { case "north": if( query_closed() ) { painter->paint_row( x-1, y-4, "___", 0x80, LAYER_INVALID ); painter->paint_shape( x-2, y-3, "//|\\\\\n|||||\n|||||", 0x70, LAYER_INVALID ); painter->paint_row( x-2, y, query_locked() ? "xxxxx" : "+++++", 0x8f, LAYER_INVALID ); } else { painter->paint_row( x-1, y-4, "___", 0x80, LAYER_INVALID ); painter->paint_shape( x-2, y-3, "/ \\\n| |\n| |", 0x70, LAYER_INVALID ); painter->paint_row( x-2, y, ".....", 0x8f, LAYER_INVALID ); } break; case "south": if( query_closed() ) { painter->paint_row( x-1, y+1, "___", 0x80, LAYER_INVALID ); painter->paint_row( x-2, y, query_locked() ? "xxxxx" : "+++++", 0x8f, LAYER_INVALID ); painter->paint_shape( x-2, y+2, "//|\\\\\n|||||\n|||||", 0x70, LAYER_INVALID ); } else { painter->paint_row( x-1, y+1, "___", 0x80, LAYER_INVALID ); painter->paint_row( x-2, y, ".....", 0x8f, LAYER_INVALID ); painter->paint_shape( x-2, y+2, "/ \\\n| |\n| |", 0x70, LAYER_INVALID ); } break; case "east": painter->paint_shape( x + 1, y - 2, "||\n||\n||\n||\n||\n||", 0x70, LAYER_INVALID ); if( query_closed() ) painter->paint_shape( x, y - 1, query_locked() ? "x\nx\nx\nx" : "+\n+\n+\n+", 0x8f, LAYER_INVALID ); else painter->paint_shape( x, y - 1, ".\n.\n.\n.", 0x8f, LAYER_INVALID ); break; case "west": painter->paint_shape( x - 2, y - 2, "||\n||\n||\n||\n||\n||", 0x70, LAYER_INVALID ); if( query_closed() ) painter->paint_shape( x, y - 1, query_locked() ? "x\nx\nx\nx" : "+\n+\n+\n+", 0x8f, LAYER_INVALID ); else painter->paint_shape( x, y - 1, ".\n.\n.\n.", 0x8f, LAYER_INVALID ); break; } }
/** Destroy sink object. @param[in] sink pointer of sink to destroy. */ void vqec_sink_destroy (vqec_sink_t * sink) { if (!sink) { return; } MCALL(sink, vqec_sink_flush); #ifdef HAVE_SCHED_JITTER_HISTOGRAM zone_release(s_inp_delay_hist_pool, sink->inp_delay_hist); zone_release(s_reader_hist_pool, sink->reader_jitter_hist); #endif /* HAVE_SCHED_JITTER_HISTOGRAM */ zone_release(s_vqec_sink_pool, sink); }
mapping query_shape() { return SHAPE_OFFSET(MCALL(exit_shape()), SMAKE_C(-query_x(), -query_y(), -query_z())); }
string query_specific() { QBODY( "specific", "the " + MCALL(query_dir()) + " gate" ); }
/** Erk, conflict between desc & twoway here! This is ugly. */ string query_name() { return "exit_" + MCALL(query_dir()); }