File: pdb.h

package info (click to toggle)
rat 4.2.22-2.2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,896 kB
  • ctags: 3,717
  • sloc: ansic: 36,542; tcl: 2,740; sh: 2,675; makefile: 295
file content (99 lines) | stat: -rw-r--r-- 3,774 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * FILE:    pdb.h
 * PROGRAM: RAT
 * AUTHOR:  O.Hodson
 *
 * Copyright (c) 1999-2001 University College London
 * All rights reserved.
 *
 * These functions provide a means of maintaining persistent
 * information on conference participants that is not contained in the
 * RTCP database.  Entries are stored in a binary table, identified with
 * a unique 32 bit unsigned identifer (probably the same as SSRC).
 *
 * $Id: pdb.h,v 1.28 2002/03/15 17:57:18 ucacoxh Exp $
 */

#ifndef __PERSIST_DB_H__
#define __PERSIST_DB_H__

/* RAT specific includes for entries in pdb_entry_t */
#include "channel_types.h"
#include "codec_types.h"
#include "ts.h"
#include "render_3D.h"

typedef struct s_pdb pdb_t;
 
typedef struct {
        uint32_t        ssrc;                        /* Unique Id */
        u_char          first_mix:1;
        struct s_render_3D_dbentry  *render_3D_data; /* Participant 3d state */
        double          gain;                        /* Participant gain */
	u_char	        mute:1;                      /* source muted */
	uint16_t        units_per_packet;
        uint16_t        inter_pkt_gap;               /* expected time between pkt arrivals */
        timestamp_t            frame_dur;
        u_char          enc;
        char*           enc_fmt;
        int             enc_fmt_len;
	uint32_t        sample_rate;
        uint32_t        last_ts;
        uint32_t        last_seq;
        timestamp_t            last_arr;                    /* timestamp_t representation of last_ts */

        /* Playout info */
        timestamp_t            jitter;
        timestamp_t            transit;
        timestamp_t            last_transit;
        timestamp_t            last_last_transit;
        timestamp_t            avg_transit;
        cc_id_t         channel_coder_id;            /* channel_coder of last received packet    */
	timestamp_t            next_mix;                    /* Used to check mixing                     */
	timestamp_t            playout;                     /* Playout delay for this talkspurt         */
        ts_sequencer    seq;                         /* Mapper from RTP time rep to rat time rep */
        uint32_t        spike_events;                /* Number of spike events                   */
        uint32_t        spike_toged;                 /* Number of packets dropped in spike mode  */
        double          last_rtt;
        double          avg_rtt;

        /* Display Info */
        timestamp_t            last_ui_update;              /* Used for periodic update of packet counts, etc */

        /* Packet info */
        uint32_t        received;
        uint32_t        duplicates;
        uint32_t        misordered;
        uint32_t        jit_toged;                   /* Packets discarded because late ("Thrown on ground") */

	uint32_t	magic;	/* For debugging */
} pdb_entry_t;

/* Functions for creating and destroying persistent database.  Return
 * TRUE on success and fill in p accordingly, FALSE on failure.  */

int pdb_create  (pdb_t **p);
int pdb_destroy (pdb_t **p);

/* pdb_get_{first,next}_id attempt to get keys from database.  Return
 * TRUE on succes and fill in id.  FALSE on failure.  */

int pdb_get_first_id (pdb_t *p, uint32_t *id);

int pdb_get_next_id  (pdb_t *p, uint32_t cur_id, uint32_t *next_id);

/* Functions for manipulating persistent database items. id is key in
 * database and must be unique. */

int     pdb_item_get     (pdb_t *p, uint32_t id, pdb_entry_t **item);

int     pdb_item_create  (pdb_t *p, 
                          uint16_t freq, 
                          uint32_t id);

int     pdb_item_destroy (pdb_t *p, uint32_t id);
void	pdb_item_validate(pdb_entry_t *item);

uint32_t pdb_item_count   (pdb_t *p);

#endif /* __PERSIST_DB_H__ */