Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
iptv_rtcp: improve random numbers source
  • Loading branch information
perexg committed Jan 9, 2016
1 parent ab7db15 commit dfae393
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/input/mpegts/iptv/iptv_rtcp.c
Expand Up @@ -304,6 +304,8 @@ int
rtcp_init(iptv_rtcp_info_t * info)

{
uint32_t rnd;

info->last_ts = 0;
info->next_ts = 0;
info->members = 2;
Expand All @@ -314,12 +316,9 @@ rtcp_init(iptv_rtcp_info_t * info)
info->average_packet_size = 52;

// Fill my SSRC
// TODO: have a better random
unsigned int seed = 21 * time(NULL);
seed += 37 * clock();
seed += 97 * getpid();
srandom(seed);
info->my_ssrc = random();
uuid_random((uint8_t *)&rnd, sizeof(random));
info->my_ssrc = rnd;
srand48(rnd * 0x4232a9b9);

return 0;
}
Expand Down

0 comments on commit dfae393

Please sign in to comment.