use lrand48 instead of lbl_random

Custom lbl_random implementation is not properly seeded, when not in
Windows, where it is used instead of [ld]rand48. rand48 functions on the
other hand are seeded (in host.cpp and rtp.c) so it can be used instead
(it perhaps doesn't make much sense to use both implementation in
UltraGrid except Windows, where custom implementation is used solely).

lbl_[s]random remains used in crypto_des (which is, however, not used).
This commit is contained in:
Martin Pulec
2023-06-28 14:50:16 +02:00
parent 6d372f47ca
commit 3480fc647c
2 changed files with 5 additions and 5 deletions

View File

@@ -3333,7 +3333,7 @@ static void send_rtcp(struct rtp *session, uint32_t rtp_ts,
check_database(session);
/* If encryption is enabled, add a 32 bit random prefix to the packet */
if (session->encryption_enabled) {
*((uint32_t *)(void *) ptr) = lbl_random();
*((uint32_t *)(void *) ptr) = lrand48();
ptr += 4;
}
@@ -3571,7 +3571,7 @@ static void rtp_send_bye_now(struct rtp *session)
check_database(session);
/* If encryption is enabled, add a 32 bit random prefix to the packet */
if (session->encryption_enabled) {
*((uint32_t *)(void *) ptr) = lbl_random();
*((uint32_t *)(void *) ptr) = lrand48();
ptr += 4;
}

View File

@@ -61,7 +61,7 @@ uint32_t get_local_mediatime(void)
if (first == 0) {
gettimeofday(&start_time, NULL);
random_offset = lbl_random();
random_offset = lrand48();
first = 1;
}
@@ -181,7 +181,7 @@ uint32_t get_std_audio_local_mediatime(double samples, int rate)
gettimeofday(&standard_time.start_time, NULL);
standard_time.atime = standard_time.start_time;
standard_time.vtime = standard_time.start_time;
standard_time.random_startime_offset = lbl_random();
standard_time.random_startime_offset = lrand48();
tv_add_usec(&standard_time.vtime, standard_time.random_startime_offset);
tv_add_usec(&standard_time.atime, standard_time.random_startime_offset);
@@ -207,7 +207,7 @@ uint32_t get_std_video_local_mediatime(void)
gettimeofday(&t0, NULL);
standard_time.atime = standard_time.start_time;
standard_time.vtime = standard_time.start_time;
standard_time.random_startime_offset = lbl_random();
standard_time.random_startime_offset = lrand48();
tv_add_usec(&standard_time.vtime, standard_time.random_startime_offset);
tv_add_usec(&standard_time.atime, standard_time.random_startime_offset);