osmux: add OSMUX_MAX_CONCURRENT_CALLS which is 8

Instead of harcoding the number all around the code.
This commit is contained in:
Pablo Neira Ayuso 2012-08-06 20:20:57 +02:00
parent 72a0aae500
commit 7a01104b88
2 changed files with 8 additions and 6 deletions

View File

@ -47,10 +47,12 @@ struct osmux_in_handle {
char *data; /* internal data */
};
#define OSMUX_MAX_CONCURRENT_CALLS 8
/* one per OSmux circuit_id, ie. one per RTP flow. */
struct osmux_out_handle {
uint16_t rtp_seq[8];
uint32_t rtp_timestamp[8];
uint16_t rtp_seq[OSMUX_MAX_CONCURRENT_CALLS];
uint32_t rtp_timestamp[OSMUX_MAX_CONCURRENT_CALLS];
};
static inline uint8_t *osmux_get_payload(struct osmux_hdr *osmuxh)

View File

@ -385,7 +385,7 @@ void osmux_xfrm_input_init(struct osmux_in_handle *h)
batch->timer.cb = osmux_batch_timer_expired;
batch->timer.data = h;
for (i=0; i<8; i++)
for (i=0; i<OSMUX_MAX_CONCURRENT_CALLS; i++)
batch->ccid[i] = -1;
h->data = (void *)batch;
@ -475,7 +475,7 @@ void osmux_xfrm_input_register_ccid(struct osmux_in_handle *h, uint32_t ssrc)
struct osmux_batch *batch = (struct osmux_batch *)h->data;;
int i, found = 0;
for (i=0; i<8; i++) {
for (i=0; i<OSMUX_MAX_CONCURRENT_CALLS; i++) {
if (batch->ccid[i] == ssrc)
continue;
if (batch->ccid[i] < 0) {
@ -498,7 +498,7 @@ int osmux_xfrm_input_get_ccid(struct osmux_in_handle *h, uint32_t ssrc)
struct osmux_batch *batch = (struct osmux_batch *)h->data;;
int i, found = 0;
for (i=0; i<8; i++) {
for (i=0; i<OSMUX_MAX_CONCURRENT_CALLS; i++) {
if (batch->ccid[i] == ssrc) {
found = 1;
break;
@ -512,7 +512,7 @@ void osmux_xfrm_output_init(struct osmux_out_handle *h)
{
int i;
for (i=0; i<8; i++) {
for (i=0; i<OSMUX_MAX_CONCURRENT_CALLS; i++) {
h->rtp_seq[i] = (uint16_t)random();
h->rtp_timestamp[i] = (uint32_t)random();
}