Browse Source

MT#55283 refactor is_codec_touched()

... in terms of a new is_codec_touched_rate()

Change-Id: Icd47d76cff87a4f513cc17de8f535a332c674c86
pull/1665/head
Richard Fuchs 3 years ago
parent
commit
334efd408d
1 changed files with 11 additions and 6 deletions
  1. +11
    -6
      daemon/codec.c

+ 11
- 6
daemon/codec.c View File

@ -4545,17 +4545,22 @@ static void codec_touched(struct codec_store *cs, struct rtp_payload_type *pt) {
g_hash_table_replace(cs->tracker->touched, GUINT_TO_POINTER(pt->clock_rate), (void *) 0x1);
#endif
}
static bool is_codec_touched(struct codec_store *cs, struct rtp_payload_type *pt) {
static bool is_codec_touched_rate(struct codec_tracker *tracker, unsigned int clock_rate) {
#ifdef WITH_TRANSCODING
if (!cs || !cs->tracker || !cs->tracker->touched)
if (!tracker || !tracker->touched)
return false;
if (cs->tracker->all_touched)
if (tracker->all_touched)
return true;
return g_hash_table_lookup(cs->tracker->touched, GINT_TO_POINTER(pt->clock_rate)) ? true : false;
return g_hash_table_lookup(tracker->touched, GUINT_TO_POINTER(clock_rate)) ? true : false;
#else
return false;
#endif
}
static bool is_codec_touched(struct codec_store *cs, struct rtp_payload_type *pt) {
if (!cs)
return false;
return is_codec_touched_rate(cs->tracker, pt->clock_rate);
}
#ifdef WITH_TRANSCODING
static int ptr_cmp(const void *a, const void *b) {
if (a < b)
@ -4611,7 +4616,7 @@ void codec_tracker_update(struct codec_store *cs) {
}
// ignore if we haven't touched anything with that clock rate
if (!sct->all_touched && !g_hash_table_lookup(sct->touched, GUINT_TO_POINTER(clockrate)))
if (!is_codec_touched_rate(sct, clockrate))
continue;
ilogs(codec, LOG_DEBUG, "Adding supplemental codec " STR_FORMAT " for clock rate %u", STR_FMT(supp_codec), clockrate);
@ -4636,7 +4641,7 @@ void codec_tracker_update(struct codec_store *cs) {
to_remove = g_list_delete_link(to_remove, to_remove);
// ignore if we haven't touched anything with that clock rate
if (!sct->all_touched && !g_hash_table_lookup(sct->touched, GUINT_TO_POINTER(clockrate)))
if (!is_codec_touched_rate(sct, clockrate))
continue;
GQueue *entries = g_hash_table_lookup(supp_clockrates, GUINT_TO_POINTER(clockrate));


Loading…
Cancel
Save