Browse Source

MT#56471 extend get_ssrc to return created y/n

Change-Id: I365d26921a01505c51134fd3986a70115a8cbf48
pull/1627/head
Richard Fuchs 3 years ago
parent
commit
61f41522e0
2 changed files with 9 additions and 6 deletions
  1. +5
    -5
      daemon/ssrc.c
  2. +4
    -1
      include/ssrc.h

+ 5
- 5
daemon/ssrc.c View File

@ -120,7 +120,7 @@ static int ssrc_time_cmp(const void *aa, const void *bb, void *pp) {
}
// returns a new reference
void *get_ssrc(uint32_t ssrc, struct ssrc_hash *ht /* , int *created */) {
void *get_ssrc_full(uint32_t ssrc, struct ssrc_hash *ht, bool *created) {
struct ssrc_entry *ent;
if (!ht)
@ -129,8 +129,8 @@ void *get_ssrc(uint32_t ssrc, struct ssrc_hash *ht /* , int *created */) {
restart:
ent = find_ssrc(ssrc, ht);
if (G_LIKELY(ent)) {
// if (created)
// *created = 0;
if (created)
*created = false;
return ent;
}
@ -172,8 +172,8 @@ restart:
add_ssrc_entry(ssrc, ent, ht);
g_atomic_pointer_set(&ht->cache, ent);
rwlock_unlock_w(&ht->lock);
// if (created)
// *created = 1;
if (created)
*created = true;
return ent;
}


+ 4
- 1
include/ssrc.h View File

@ -213,7 +213,10 @@ struct ssrc_hash *create_ssrc_hash_full_fast(ssrc_create_func_t, void *uptr); //
struct ssrc_hash *create_ssrc_hash_call(void);
void *get_ssrc(uint32_t, struct ssrc_hash * /* , int *created */); // creates new entry if not found
void *get_ssrc_full(uint32_t, struct ssrc_hash *, bool *created); // creates new entry if not found
INLINE void *get_ssrc(uint32_t ssrc, struct ssrc_hash *ht) {
return get_ssrc_full(ssrc, ht, NULL);
}
struct ssrc_ctx *get_ssrc_ctx(uint32_t, struct ssrc_hash *, enum ssrc_dir, void *ref); // creates new entry if not found


Loading…
Cancel
Save