convert ssrc tracking functions to inline

pull/114/head
Richard Fuchs 10 years ago
parent 76f3893464
commit c3c6d37c7d

@ -572,32 +572,3 @@ void crypto_dump_keys(struct crypto_context *in, struct crypto_context *out) {
ilog(LOG_DEBUG, "SRTP keys, outgoing:");
dump_key(out);
}
struct rtp_ssrc_entry *find_ssrc(u_int32_t ssrc, GHashTable *ht) {
return g_hash_table_lookup(ht, &ssrc);
}
void add_ssrc_entry(struct rtp_ssrc_entry *ent, GHashTable *ht) {
g_hash_table_insert(ht, &ent->ssrc, ent);
}
struct rtp_ssrc_entry *create_ssrc_entry(u_int32_t ssrc, u_int64_t index) {
struct rtp_ssrc_entry *ent;
ent = g_slice_alloc(sizeof(struct rtp_ssrc_entry));
ent->ssrc = ssrc;
ent->index = index;
return ent;
}
void free_ssrc_table(GHashTable **ht) {
if (!*ht)
return;
g_hash_table_destroy(*ht);
*ht = NULL;
}
static void free_ssrc_entry(void *p) {
g_slice_free1(sizeof(struct rtp_ssrc_entry), p);
}
GHashTable *create_ssrc_table(void) {
return g_hash_table_new_full(uint32_hash, uint32_eq, free_ssrc_entry, NULL);
}

@ -7,6 +7,7 @@
#include <glib.h>
#include "compat.h"
#include "str.h"
#include "aux.h"
@ -105,11 +106,11 @@ const struct crypto_suite *crypto_find_suite(const str *);
int crypto_gen_session_key(struct crypto_context *, str *, unsigned char, int);
void crypto_dump_keys(struct crypto_context *in, struct crypto_context *out);
struct rtp_ssrc_entry *find_ssrc(u_int32_t, GHashTable *);
void add_ssrc_entry(struct rtp_ssrc_entry *, GHashTable *);
struct rtp_ssrc_entry *create_ssrc_entry(u_int32_t, u_int64_t);
void free_ssrc_table(GHashTable **);
GHashTable *create_ssrc_table(void);
INLINE struct rtp_ssrc_entry *find_ssrc(u_int32_t, GHashTable *);
INLINE void add_ssrc_entry(struct rtp_ssrc_entry *, GHashTable *);
INLINE struct rtp_ssrc_entry *create_ssrc_entry(u_int32_t, u_int64_t);
INLINE void free_ssrc_table(GHashTable **);
INLINE GHashTable *create_ssrc_table(void);
INLINE int crypto_encrypt_rtp(struct crypto_context *c, struct rtp_header *rtp,
@ -198,4 +199,31 @@ INLINE int crypto_params_cmp(const struct crypto_params *a, const struct crypto_
INLINE struct rtp_ssrc_entry *find_ssrc(u_int32_t ssrc, GHashTable *ht) {
return g_hash_table_lookup(ht, &ssrc);
}
INLINE void add_ssrc_entry(struct rtp_ssrc_entry *ent, GHashTable *ht) {
g_hash_table_insert(ht, &ent->ssrc, ent);
}
INLINE struct rtp_ssrc_entry *create_ssrc_entry(u_int32_t ssrc, u_int64_t index) {
struct rtp_ssrc_entry *ent;
ent = g_slice_alloc(sizeof(struct rtp_ssrc_entry));
ent->ssrc = ssrc;
ent->index = index;
return ent;
}
INLINE void free_ssrc_table(GHashTable **ht) {
if (!*ht)
return;
g_hash_table_destroy(*ht);
*ht = NULL;
}
INLINE void free_ssrc_entry(void *p) {
g_slice_free1(sizeof(struct rtp_ssrc_entry), p);
}
INLINE GHashTable *create_ssrc_table(void) {
return g_hash_table_new_full(uint32_hash, uint32_eq, free_ssrc_entry, NULL);
}
#endif

Loading…
Cancel
Save