Merge pull request #1764 in FS/freeswitch from ~DRAGOS_OANCEA/freeswitch-dragos:FS-11955 to master

* commit '1f4dbe50e6c29ed8b04b0af428bc49352f37664e':
  FS-11955: JB: add stats for received packets that have been NACKed previously (video)
This commit is contained in:
Mike Jerris
2019-07-25 12:50:19 -05:00
3 changed files with 26 additions and 0 deletions
+18
View File
@@ -110,6 +110,8 @@ struct switch_jb_s {
uint32_t packet_count;
uint32_t max_packet_len;
uint32_t period_len;
uint32_t nack_saved_the_day;
uint32_t nack_didnt_save_the_day;
};
@@ -975,6 +977,15 @@ SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb)
jb->last_target_ts = 0;
}
SWITCH_DECLARE(uint32_t) switch_jb_get_nack_success(switch_jb_t *jb)
{
uint32_t nack_recovered; /*count*/
switch_mutex_lock(jb->mutex);
nack_recovered = jb->nack_saved_the_day + jb->nack_didnt_save_the_day;
switch_mutex_unlock(jb->mutex);
return nack_recovered;
}
SWITCH_DECLARE(switch_status_t) switch_jb_peek_frame(switch_jb_t *jb, uint32_t ts, uint16_t seq, int peek, switch_frame_t *frame)
{
switch_jb_node_t *node = NULL;
@@ -1095,6 +1106,11 @@ SWITCH_DECLARE(switch_status_t) switch_jb_destroy(switch_jb_t **jbp)
switch_jb_t *jb = *jbp;
*jbp = NULL;
if (jb->type == SJB_VIDEO && !switch_test_flag(jb, SJB_QUEUE_ONLY)) {
jb_debug(jb, 3, "Stats: NACK saved the day: %u\n", jb->nack_saved_the_day);
jb_debug(jb, 3, "Stats: NACK was late: %u\n", jb->nack_didnt_save_the_day);
jb_debug(jb, 3, "Stats: Hash entrycount: missing_seq_hash %u\n", switch_hashtable_count(jb->missing_seq_hash));
}
if (jb->type == SJB_VIDEO) {
switch_core_inthash_destroy(&jb->missing_seq_hash);
}
@@ -1227,8 +1243,10 @@ SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp
if (got < ntohs(jb->target_seq)) {
jb_debug(jb, 2, "got nacked seq %u too late\n", got);
jb_frame_inc(jb, 1);
jb->nack_didnt_save_the_day++;
} else {
jb_debug(jb, 2, "got nacked %u saved the day!\n", got);
jb->nack_saved_the_day++;
}
}