static timestamp_t
playout_constraints_component(session_t *sp, pdb_entry_t *e)
/*****************************************************************************/
/* playout_variable component works out the variable components that RAT has */
/* in it's playout calculation.  It works returns the maximum of:            */
/* the interpacket gap, the cushion size, and the user requested limits on   */
/* the playout point.                                                        */
/*****************************************************************************/
{
        uint32_t var32, cushion;

        var32 = e->inter_pkt_gap / 2;

        cushion = cushion_get_size(sp->cushion);
	/* Cushion is measured in samples at device clock rate,
         * convert to source clock rate */
	cushion = cushion * e->sample_rate / ts_get_freq(sp->cur_ts);
	var32   = max(cushion, var32);
        
        if (sp->limit_playout) {
                uint32_t minv, maxv;
                minv  = sp->min_playout * e->sample_rate / 1000;
                maxv  = sp->max_playout * e->sample_rate / 1000;
                var32 = max(minv, var32);
                var32 = min(maxv, var32);
        }

        return ts_map32(e->sample_rate, var32);
} 
Beispiel #2
0
static void
process_create(session_t *sp, uint32_t ssrc)
{
	    if (log_fp != 0)
	    {
		struct timeval  tv;
		gettimeofday(&tv, 0);

		fprintf(log_fp, "%d.%06d %d create %x \n", (int) tv.tv_sec, (int) tv.tv_usec,
			(int) rtp_get_ssrc_count(sp->rtp_session[0]),
			(int) ssrc);
		fflush(log_fp);
	    }
    
	if (pdb_item_create(sp->pdb, (uint16_t)ts_get_freq(sp->cur_ts), ssrc) == FALSE) {
		debug_msg("Unable to create source 0x%08lx\n", ssrc);
	}
}