Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
1df93ae9
Commit
1df93ae9
authored
18 years ago
by
Alex Beregszaszi
Browse files
Options
Downloads
Patches
Plain Diff
use av_random instead random/srandom
Originally committed as revision 8051 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
d5039327
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ffserver.c
+9
-6
9 additions, 6 deletions
ffserver.c
with
9 additions
and
6 deletions
ffserver.c
+
9
−
6
View file @
1df93ae9
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
#include
"version.h"
#include
"version.h"
#include
"ffserver.h"
#include
"ffserver.h"
#include
"random.h"
/* maximum number of simultaneous HTTP connections */
/* maximum number of simultaneous HTTP connections */
#define HTTP_MAX_CONNECTIONS 2000
#define HTTP_MAX_CONNECTIONS 2000
...
@@ -291,6 +292,8 @@ static int current_bandwidth;
...
@@ -291,6 +292,8 @@ static int current_bandwidth;
static
long
cur_time
;
// Making this global saves on passing it around everywhere
static
long
cur_time
;
// Making this global saves on passing it around everywhere
static
AVRandomState
random_state
;
static
long
gettime_ms
(
void
)
static
long
gettime_ms
(
void
)
{
{
struct
timeval
tv
;
struct
timeval
tv
;
...
@@ -468,8 +471,8 @@ static void start_multicast(void)
...
@@ -468,8 +471,8 @@ static void start_multicast(void)
for
(
stream
=
first_stream
;
stream
!=
NULL
;
stream
=
stream
->
next
)
{
for
(
stream
=
first_stream
;
stream
!=
NULL
;
stream
=
stream
->
next
)
{
if
(
stream
->
is_multicast
)
{
if
(
stream
->
is_multicast
)
{
/* open the RTP connection */
/* open the RTP connection */
snprintf
(
session_id
,
sizeof
(
session_id
),
snprintf
(
session_id
,
sizeof
(
session_id
),
"%08x%08x"
,
"%08x%08x"
,
(
int
)
random
(),
(
int
)
random
(
));
av_random
(
&
random_state
),
av_random
(
&
random_state
));
/* choose a port if none given */
/* choose a port if none given */
if
(
stream
->
multicast_port
==
0
)
{
if
(
stream
->
multicast_port
==
0
)
{
...
@@ -1536,7 +1539,7 @@ static int http_parse_request(HTTPContext *c)
...
@@ -1536,7 +1539,7 @@ static int http_parse_request(HTTPContext *c)
if
(
!
strcmp
(
c
->
stream
->
fmt
->
name
,
"asf_stream"
))
{
if
(
!
strcmp
(
c
->
stream
->
fmt
->
name
,
"asf_stream"
))
{
/* Need to allocate a client id */
/* Need to allocate a client id */
c
->
wmp_client_id
=
random
()
&
0x7fffffff
;
c
->
wmp_client_id
=
av_
random
(
&
random_state
)
&
0x7fffffff
;
q
+=
snprintf
(
q
,
q
-
(
char
*
)
c
->
buffer
+
c
->
buffer_size
,
"Server: Cougar 4.1.0.3923
\r\n
Cache-Control: no-cache
\r\n
Pragma: client-id=%d
\r\n
Pragma: features=
\"
broadcast
\"\r\n
"
,
c
->
wmp_client_id
);
q
+=
snprintf
(
q
,
q
-
(
char
*
)
c
->
buffer
+
c
->
buffer_size
,
"Server: Cougar 4.1.0.3923
\r\n
Cache-Control: no-cache
\r\n
Pragma: client-id=%d
\r\n
Pragma: features=
\"
broadcast
\"\r\n
"
,
c
->
wmp_client_id
);
}
}
...
@@ -2826,8 +2829,8 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url,
...
@@ -2826,8 +2829,8 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url,
/* generate session id if needed */
/* generate session id if needed */
if
(
h
->
session_id
[
0
]
==
'\0'
)
{
if
(
h
->
session_id
[
0
]
==
'\0'
)
{
snprintf
(
h
->
session_id
,
sizeof
(
h
->
session_id
),
snprintf
(
h
->
session_id
,
sizeof
(
h
->
session_id
),
"%08x%08x"
,
"%08x%08x"
,
(
int
)
random
(),
(
int
)
random
(
));
av_random
(
&
random_state
),
av_random
(
&
random_state
));
}
}
/* find rtp session, and create it if none found */
/* find rtp session, and create it if none found */
...
@@ -4525,7 +4528,7 @@ int main(int argc, char **argv)
...
@@ -4525,7 +4528,7 @@ int main(int argc, char **argv)
putenv
(
"http_proxy"
);
/* Kill the http_proxy */
putenv
(
"http_proxy"
);
/* Kill the http_proxy */
s
random
(
gettime_ms
()
+
(
getpid
()
<<
16
));
av_init_
random
(
gettime_ms
()
+
(
getpid
()
<<
16
)
,
&
random_state
);
/* address on which the server will handle HTTP connections */
/* address on which the server will handle HTTP connections */
my_http_addr
.
sin_family
=
AF_INET
;
my_http_addr
.
sin_family
=
AF_INET
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment