提交 abdf7960 authored 作者: Mike Jerris's avatar Mike Jerris

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

* commit '1f4dbe50':
  FS-11955: JB: add stats for received packets that have been NACKed previously (video)
......@@ -64,6 +64,7 @@ SWITCH_DECLARE(void) switch_jb_set_session(switch_jb_t *jb, switch_core_session_
SWITCH_DECLARE(void) switch_jb_ts_mode(switch_jb_t *jb, uint32_t samples_per_frame, uint32_t samples_per_second);
SWITCH_DECLARE(void) switch_jb_set_flag(switch_jb_t *jb, switch_jb_flag_t flag);
SWITCH_DECLARE(void) switch_jb_clear_flag(switch_jb_t *jb, switch_jb_flag_t flag);
SWITCH_DECLARE(uint32_t) switch_jb_get_nack_success(switch_jb_t *jb);
SWITCH_END_EXTERN_C
#endif
......
......@@ -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++;
}
}
......
......@@ -5090,6 +5090,13 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
return;
}
if ((*rtp_session)->vb) {
/* retrieve counter for ALL received NACKed packets */
uint32_t nack_jb_ok = switch_jb_get_nack_success((*rtp_session)->vb);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG((*rtp_session)->session), SWITCH_LOG_DEBUG,
"NACK: Added to JB: [%u]\n", nack_jb_ok);
}
(*rtp_session)->flags[SWITCH_RTP_FLAG_SHUTDOWN] = 1;
READ_INC((*rtp_session));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论