1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-10-03 01:21:46 +02:00

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>
This commit is contained in:
Mike Williams 2011-05-18 09:14:22 -04:00 committed by Anton Khirnov
parent 9749cdf775
commit e2d7dc87df

View File

@ -3274,7 +3274,6 @@ static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h
static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h) static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h)
{ {
HTTPContext *rtp_c; HTTPContext *rtp_c;
char session_id[32];
rtp_c = find_rtp_session_with_url(url, h->session_id); rtp_c = find_rtp_session_with_url(url, h->session_id);
if (!rtp_c) { if (!rtp_c) {
@ -3282,16 +3281,14 @@ static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader
return; return;
} }
av_strlcpy(session_id, rtp_c->session_id, sizeof(session_id));
/* abort the session */
close_connection(rtp_c);
/* now everything is OK, so we can send the connection parameters */ /* now everything is OK, so we can send the connection parameters */
rtsp_reply_header(c, RTSP_STATUS_OK); rtsp_reply_header(c, RTSP_STATUS_OK);
/* session ID */ /* session ID */
avio_printf(c->pb, "Session: %s\r\n", session_id); avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id);
avio_printf(c->pb, "\r\n"); avio_printf(c->pb, "\r\n");
/* abort the session */
close_connection(rtp_c);
} }