Browse code

ffserver: move close_connection() call to avoid a temporary string and copy.

Signed-off-by: Mike Williams <mike@mikebwilliams.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Mike Williams authored on 2011/05/18 22:14:22
Showing 1 changed files
... ...
@@ -3274,7 +3274,6 @@ static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h
3274 3274
 static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h)
3275 3275
 {
3276 3276
     HTTPContext *rtp_c;
3277
-    char session_id[32];
3278 3277
 
3279 3278
     rtp_c = find_rtp_session_with_url(url, h->session_id);
3280 3279
     if (!rtp_c) {
... ...
@@ -3282,16 +3281,14 @@ static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader
3282 3282
         return;
3283 3283
     }
3284 3284
 
3285
-    av_strlcpy(session_id, rtp_c->session_id, sizeof(session_id));
3286
-
3287
-    /* abort the session */
3288
-    close_connection(rtp_c);
3289
-
3290 3285
     /* now everything is OK, so we can send the connection parameters */
3291 3286
     rtsp_reply_header(c, RTSP_STATUS_OK);
3292 3287
     /* session ID */
3293
-    avio_printf(c->pb, "Session: %s\r\n", session_id);
3288
+    avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id);
3294 3289
     avio_printf(c->pb, "\r\n");
3290
+
3291
+    /* abort the session */
3292
+    close_connection(rtp_c);
3295 3293
 }
3296 3294
 
3297 3295