Browse code

ffserver: fix order of evaluation bugs

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d40c0e4a6733ade9aaafc687bcaccc0cba1183b4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/09/09 06:56:26
Showing 1 changed files
... ...
@@ -562,9 +562,11 @@ static void start_multicast(void)
562 562
     default_port = 6000;
563 563
     for(stream = first_stream; stream != NULL; stream = stream->next) {
564 564
         if (stream->is_multicast) {
565
+            unsigned random0 = av_lfg_get(&random_state);
566
+            unsigned random1 = av_lfg_get(&random_state);
565 567
             /* open the RTP connection */
566 568
             snprintf(session_id, sizeof(session_id), "%08x%08x",
567
-                     av_lfg_get(&random_state), av_lfg_get(&random_state));
569
+                     random0, random1);
568 570
 
569 571
             /* choose a port if none given */
570 572
             if (stream->multicast_port == 0) {
... ...
@@ -3086,9 +3088,12 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url,
3086 3086
  found:
3087 3087
 
3088 3088
     /* generate session id if needed */
3089
-    if (h->session_id[0] == '\0')
3089
+    if (h->session_id[0] == '\0') {
3090
+        unsigned random0 = av_lfg_get(&random_state);
3091
+        unsigned random1 = av_lfg_get(&random_state);
3090 3092
         snprintf(h->session_id, sizeof(h->session_id), "%08x%08x",
3091
-                 av_lfg_get(&random_state), av_lfg_get(&random_state));
3093
+                 random0, random1);
3094
+    }
3092 3095
 
3093 3096
     /* find rtp session, and create it if none found */
3094 3097
     rtp_c = find_rtp_session(h->session_id);