FS-7499 adding some more refactoring towards better rtcp

This commit is contained in:
Anthony Minessale
2015-05-13 11:50:04 -05:00
committed by Michael Jerris
parent 930d8aea39
commit 81094b3a0c
7 changed files with 88 additions and 58 deletions
+2 -1
View File
@@ -229,7 +229,7 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_CORE_SESSION_MAX_PRIVATES 2
#define SWITCH_DEFAULT_VIDEO_SIZE 1200
#define SWITCH_RTCP_AUDIO_INTERVAL_MSEC "5000"
#define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "1000"
#define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "2000"
/* Jitter */
#define JITTER_VARIANCE_THRESHOLD 400.0
@@ -661,6 +661,7 @@ typedef struct {
uint16_t last_rpt_cycle; /* Packet loss calculation, sequence number cycle at the begining of the current RTCP report interval */
uint16_t period_pkt_count; /* Packet loss calculation, packet count received during this RTCP report interval */
uint16_t pkt_count; /* Packet loss calculation, packet count received during this session */
uint16_t sent_pkt_count;
uint32_t rtcp_rtp_count; /* RTCP report generated count */
uint32_t high_ext_seq_recv; /* Packet loss calculation, highest extended sequence number received and processed for stats */
uint16_t cycle; /* Packet loss calculation, sequence number cycle of the current RTCP report interval */
+21 -7
View File
@@ -40,6 +40,7 @@
#define SWITCH_UTILS_H
#include <switch.h>
#include <math.h>
SWITCH_BEGIN_EXTERN_C
@@ -993,18 +994,31 @@ SWITCH_DECLARE(char *) switch_util_quote_shell_arg_pool(const char *string, swit
#define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK || status == SWITCH_STATUS_INUSE)
static inline int32_t switch_calc_bitrate(int w, int h, int quality, int fps)
{
/* KUSH GAUGE*/
if (!fps) fps = 15;
if (!quality) quality = 2;
return (int32_t)((float)(w * h * fps * quality) * 0.07) / 1000;
}
static inline int32_t switch_parse_bandwidth_string(const char *bwv)
{
int32_t bw = 0;
float bw = 0;
if (!bwv) return 0;
if (bwv && (bw = (int32_t) atol(bwv))) {
if (!strcasecmp(bwv, "auto")) {
return -1;
}
if ((bw = (float) atof(bwv))) {
if (bw < 0) return 0;
if (!strcasecmp(bwv, "auto")) {
return -1;
} else if (strstr(bwv, "KB")) {
if (strstr(bwv, "KB")) {
bw *= 8;
} else if (strstr(bwv, "mb")) {
bw *= 1024;
@@ -1013,7 +1027,7 @@ static inline int32_t switch_parse_bandwidth_string(const char *bwv)
}
}
return bw;
return (int32_t) roundf(bw);
}
static inline int switch_needs_url_encode(const char *s)