Commit ab0e9b39 authored by Simon Morlat's avatar Simon Morlat

use ortp_random() that correctly wraps random function on all os.

parent 4ca3bf8a
...@@ -122,9 +122,9 @@ static void enc_init(MSFilter *f) { ...@@ -122,9 +122,9 @@ static void enc_init(MSFilter *f) {
s->frame_count = 0; s->frame_count = 0;
s->last_fir_seq_nr = -1; s->last_fir_seq_nr = -1;
#ifdef PICTURE_ID_ON_16_BITS #ifdef PICTURE_ID_ON_16_BITS
s->picture_id = (random() & 0x7FFF) | 0x8000; s->picture_id = (ortp_random() & 0x7FFF) | 0x8000;
#else #else
s->picture_id = random() & 0x007F; s->picture_id = ortp_random() & 0x007F;
#endif #endif
s->avpf_enabled = FALSE; s->avpf_enabled = FALSE;
......
...@@ -183,13 +183,13 @@ static const char * const candidate_pair_state_values[] = { ...@@ -183,13 +183,13 @@ static const char * const candidate_pair_state_values[] = {
static uint64_t generate_tie_breaker(void) static uint64_t generate_tie_breaker(void)
{ {
return (((uint64_t)random()) << 32) | (((uint64_t)random()) & 0xffffffff); return (((uint64_t)ortp_random()) << 32) | (((uint64_t)ortp_random()) & 0xffffffff);
} }
static char * generate_ufrag(void) static char * generate_ufrag(void)
{ {
char *ufrag = ms_malloc(9); char *ufrag = ms_malloc(9);
sprintf(ufrag, "%08x", (int)random()); sprintf(ufrag, "%08x", (int)ortp_random());
ufrag[8] = '\0'; ufrag[8] = '\0';
return ufrag; return ufrag;
} }
...@@ -197,7 +197,7 @@ static char * generate_ufrag(void) ...@@ -197,7 +197,7 @@ static char * generate_ufrag(void)
static char * generate_pwd(void) static char * generate_pwd(void)
{ {
char *pwd = ms_malloc(25); char *pwd = ms_malloc(25);
sprintf(pwd, "%08x%08x%08x", (int)random(), (int)random(), (int)random()); sprintf(pwd, "%08x%08x%08x", (int)ortp_random(), (int)ortp_random(), (int)ortp_random());
pwd[24] = '\0'; pwd[24] = '\0';
return pwd; return pwd;
} }
...@@ -1508,7 +1508,7 @@ static void ice_generate_arbitrary_foundation(char *foundation, int len, MSList ...@@ -1508,7 +1508,7 @@ static void ice_generate_arbitrary_foundation(char *foundation, int len, MSList
MSList *elem; MSList *elem;
do { do {
r = (((uint64_t)random()) << 32) | (((uint64_t)random()) & 0xffffffff); r = (((uint64_t)ortp_random()) << 32) | (((uint64_t)ortp_random()) & 0xffffffff);
snprintf(foundation, len, "%" PRIx64, r); snprintf(foundation, len, "%" PRIx64, r);
elem = ms_list_find_custom(list, (MSCompareFunc)ice_find_candidate_from_foundation, foundation); elem = ms_list_find_custom(list, (MSCompareFunc)ice_find_candidate_from_foundation, foundation);
} while (elem != NULL); } while (elem != NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment