Signed-off-by: Limin Wang <lance.lmwang@gmail.com>tags/n4.4
@@ -1025,7 +1025,7 @@ static void handle_rtp_info(RTSPState *rt, const char *url, | |||||
static void rtsp_parse_rtp_info(RTSPState *rt, const char *p) | static void rtsp_parse_rtp_info(RTSPState *rt, const char *p) | ||||
{ | { | ||||
int read = 0; | int read = 0; | ||||
char key[20], value[1024], url[1024] = ""; | |||||
char key[20], value[MAX_URL_SIZE], url[MAX_URL_SIZE] = ""; | |||||
uint32_t seq = 0, rtptime = 0; | uint32_t seq = 0, rtptime = 0; | ||||
for (;;) { | for (;;) { | ||||
@@ -1124,7 +1124,7 @@ void ff_rtsp_skip_packet(AVFormatContext *s) | |||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
int ret, len, len1; | int ret, len, len1; | ||||
uint8_t buf[1024]; | |||||
uint8_t buf[MAX_URL_SIZE]; | |||||
ret = ffurl_read_complete(rt->rtsp_hd, buf, 3); | ret = ffurl_read_complete(rt->rtsp_hd, buf, 3); | ||||
if (ret != 3) | if (ret != 3) | ||||
@@ -1150,7 +1150,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, | |||||
int return_on_interleaved_data, const char *method) | int return_on_interleaved_data, const char *method) | ||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
char buf[4096], buf1[1024], *q; | |||||
char buf[MAX_URL_SIZE], buf1[MAX_URL_SIZE], *q; | |||||
unsigned char ch; | unsigned char ch; | ||||
const char *p; | const char *p; | ||||
int ret, content_length, line_count = 0, request = 0; | int ret, content_length, line_count = 0, request = 0; | ||||
@@ -1230,7 +1230,7 @@ start: | |||||
av_freep(&content); | av_freep(&content); | ||||
if (request) { | if (request) { | ||||
char buf[1024]; | |||||
char buf[MAX_URL_SIZE]; | |||||
char base64buf[AV_BASE64_SIZE(sizeof(buf))]; | char base64buf[AV_BASE64_SIZE(sizeof(buf))]; | ||||
const char* ptr = buf; | const char* ptr = buf; | ||||
@@ -1306,7 +1306,7 @@ static int rtsp_send_cmd_with_content_async(AVFormatContext *s, | |||||
int send_content_length) | int send_content_length) | ||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
char buf[4096], *out_buf; | |||||
char buf[MAX_URL_SIZE], *out_buf; | |||||
char base64buf[AV_BASE64_SIZE(sizeof(buf))]; | char base64buf[AV_BASE64_SIZE(sizeof(buf))]; | ||||
if (!rt->rtsp_hd_out) | if (!rt->rtsp_hd_out) | ||||
@@ -1416,7 +1416,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, | |||||
int rtx = 0, j, i, err, interleave = 0, port_off; | int rtx = 0, j, i, err, interleave = 0, port_off; | ||||
RTSPStream *rtsp_st; | RTSPStream *rtsp_st; | ||||
RTSPMessageHeader reply1, *reply = &reply1; | RTSPMessageHeader reply1, *reply = &reply1; | ||||
char cmd[2048]; | |||||
char cmd[MAX_URL_SIZE]; | |||||
const char *trans_pref; | const char *trans_pref; | ||||
if (rt->transport == RTSP_TRANSPORT_RDT) | if (rt->transport == RTSP_TRANSPORT_RDT) | ||||
@@ -1437,7 +1437,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, | |||||
port_off -= port_off & 0x01; | port_off -= port_off & 0x01; | ||||
for (j = rt->rtp_port_min + port_off, i = 0; i < rt->nb_rtsp_streams; ++i) { | for (j = rt->rtp_port_min + port_off, i = 0; i < rt->nb_rtsp_streams; ++i) { | ||||
char transport[2048]; | |||||
char transport[MAX_URL_SIZE]; | |||||
/* | /* | ||||
* WMS serves all UDP data over a single connection, the RTX, which | * WMS serves all UDP data over a single connection, the RTX, which | ||||
@@ -1586,7 +1586,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, | |||||
break; | break; | ||||
case RTSP_LOWER_TRANSPORT_UDP: { | case RTSP_LOWER_TRANSPORT_UDP: { | ||||
char url[1024], options[30] = ""; | |||||
char url[MAX_URL_SIZE], options[30] = ""; | |||||
const char *peer = host; | const char *peer = host; | ||||
if (rt->rtsp_flags & RTSP_FLAG_FILTER_SRC) | if (rt->rtsp_flags & RTSP_FLAG_FILTER_SRC) | ||||
@@ -1604,7 +1604,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, | |||||
break; | break; | ||||
} | } | ||||
case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { | case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: { | ||||
char url[1024], namebuf[50], optbuf[20] = ""; | |||||
char url[MAX_URL_SIZE], namebuf[50], optbuf[20] = ""; | |||||
struct sockaddr_storage addr; | struct sockaddr_storage addr; | ||||
int port, ttl; | int port, ttl; | ||||
AVDictionary *opts = map_to_opts(rt); | AVDictionary *opts = map_to_opts(rt); | ||||
@@ -1666,7 +1666,7 @@ int ff_rtsp_connect(AVFormatContext *s) | |||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
char proto[128], host[1024], path[1024]; | char proto[128], host[1024], path[1024]; | ||||
char tcpname[1024], cmd[2048], auth[128]; | |||||
char tcpname[1024], cmd[MAX_URL_SIZE], auth[128]; | |||||
const char *lower_rtsp_proto = "tcp"; | const char *lower_rtsp_proto = "tcp"; | ||||
int port, err, tcp_fd; | int port, err, tcp_fd; | ||||
RTSPMessageHeader reply1, *reply = &reply1; | RTSPMessageHeader reply1, *reply = &reply1; | ||||
@@ -2324,7 +2324,7 @@ static int sdp_read_header(AVFormatContext *s) | |||||
RTSPStream *rtsp_st; | RTSPStream *rtsp_st; | ||||
int size, i, err; | int size, i, err; | ||||
char *content; | char *content; | ||||
char url[1024]; | |||||
char url[MAX_URL_SIZE]; | |||||
if (!ff_network_init()) | if (!ff_network_init()) | ||||
return AVERROR(EIO); | return AVERROR(EIO); | ||||
@@ -27,6 +27,7 @@ | |||||
#include "rtpdec.h" | #include "rtpdec.h" | ||||
#include "network.h" | #include "network.h" | ||||
#include "httpauth.h" | #include "httpauth.h" | ||||
#include "internal.h" | |||||
#include "libavutil/log.h" | #include "libavutil/log.h" | ||||
#include "libavutil/opt.h" | #include "libavutil/opt.h" | ||||
@@ -316,7 +317,7 @@ typedef struct RTSPState { | |||||
/** some MS RTSP streams contain a URL in the SDP that we need to use | /** some MS RTSP streams contain a URL in the SDP that we need to use | ||||
* for all subsequent RTSP requests, rather than the input URI; in | * for all subsequent RTSP requests, rather than the input URI; in | ||||
* other cases, this is a copy of AVFormatContext->filename. */ | * other cases, this is a copy of AVFormatContext->filename. */ | ||||
char control_uri[2048]; | |||||
char control_uri[MAX_URL_SIZE]; | |||||
/** The following are used for parsing raw mpegts in udp */ | /** The following are used for parsing raw mpegts in udp */ | ||||
//@{ | //@{ | ||||
@@ -444,7 +445,7 @@ typedef struct RTSPStream { | |||||
* for the selected transport. Only used for TCP. */ | * for the selected transport. Only used for TCP. */ | ||||
int interleaved_min, interleaved_max; | int interleaved_min, interleaved_max; | ||||
char control_url[1024]; /**< url for this stream (from SDP) */ | |||||
char control_url[MAX_URL_SIZE]; /**< url for this stream (from SDP) */ | |||||
/** The following are used only in SDP, not RTSP */ | /** The following are used only in SDP, not RTSP */ | ||||
//@{ | //@{ | ||||
@@ -97,7 +97,7 @@ static int rtsp_send_reply(AVFormatContext *s, enum RTSPStatusCode code, | |||||
const char *extracontent, uint16_t seq) | const char *extracontent, uint16_t seq) | ||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
char message[4096]; | |||||
char message[MAX_URL_SIZE]; | |||||
int index = 0; | int index = 0; | ||||
while (status_messages[index].code) { | while (status_messages[index].code) { | ||||
if (status_messages[index].code == code) { | if (status_messages[index].code == code) { | ||||
@@ -143,7 +143,7 @@ static inline int rtsp_read_request(AVFormatContext *s, | |||||
const char *method) | const char *method) | ||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
char rbuf[1024]; | |||||
char rbuf[MAX_URL_SIZE]; | |||||
int rbuflen, ret; | int rbuflen, ret; | ||||
do { | do { | ||||
ret = read_line(s, rbuf, sizeof(rbuf), &rbuflen); | ret = read_line(s, rbuf, sizeof(rbuf), &rbuflen); | ||||
@@ -232,9 +232,9 @@ static int rtsp_read_setup(AVFormatContext *s, char* host, char *controlurl) | |||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
RTSPMessageHeader request = { 0 }; | RTSPMessageHeader request = { 0 }; | ||||
int ret = 0; | int ret = 0; | ||||
char url[1024]; | |||||
char url[MAX_URL_SIZE]; | |||||
RTSPStream *rtsp_st; | RTSPStream *rtsp_st; | ||||
char responseheaders[1024]; | |||||
char responseheaders[MAX_URL_SIZE]; | |||||
int localport = -1; | int localport = -1; | ||||
int transportidx = 0; | int transportidx = 0; | ||||
int streamid = 0; | int streamid = 0; | ||||
@@ -351,7 +351,7 @@ static int rtsp_read_record(AVFormatContext *s) | |||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
RTSPMessageHeader request = { 0 }; | RTSPMessageHeader request = { 0 }; | ||||
int ret = 0; | int ret = 0; | ||||
char responseheaders[1024]; | |||||
char responseheaders[MAX_URL_SIZE]; | |||||
ret = rtsp_read_request(s, &request, "RECORD"); | ret = rtsp_read_request(s, &request, "RECORD"); | ||||
if (ret) | if (ret) | ||||
@@ -474,7 +474,7 @@ static inline int parse_command_line(AVFormatContext *s, const char *line, | |||||
int ff_rtsp_parse_streaming_commands(AVFormatContext *s) | int ff_rtsp_parse_streaming_commands(AVFormatContext *s) | ||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
unsigned char rbuf[4096]; | |||||
unsigned char rbuf[MAX_URL_SIZE]; | |||||
unsigned char method[10]; | unsigned char method[10]; | ||||
char uri[500]; | char uri[500]; | ||||
int ret; | int ret; | ||||
@@ -517,7 +517,7 @@ static int rtsp_read_play(AVFormatContext *s) | |||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
RTSPMessageHeader reply1, *reply = &reply1; | RTSPMessageHeader reply1, *reply = &reply1; | ||||
int i; | int i; | ||||
char cmd[1024]; | |||||
char cmd[MAX_URL_SIZE]; | |||||
av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state); | av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state); | ||||
rt->nb_byes = 0; | rt->nb_byes = 0; | ||||
@@ -603,7 +603,7 @@ static int rtsp_read_pause(AVFormatContext *s) | |||||
int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply) | int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply) | ||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
char cmd[1024]; | |||||
char cmd[MAX_URL_SIZE]; | |||||
unsigned char *content = NULL; | unsigned char *content = NULL; | ||||
int ret; | int ret; | ||||
@@ -646,7 +646,7 @@ static int rtsp_listen(AVFormatContext *s) | |||||
int default_port = RTSP_DEFAULT_PORT; | int default_port = RTSP_DEFAULT_PORT; | ||||
char tcpname[500]; | char tcpname[500]; | ||||
const char *lower_proto = "tcp"; | const char *lower_proto = "tcp"; | ||||
unsigned char rbuf[4096]; | |||||
unsigned char rbuf[MAX_URL_SIZE]; | |||||
unsigned char method[10]; | unsigned char method[10]; | ||||
int rbuflen = 0; | int rbuflen = 0; | ||||
int ret; | int ret; | ||||
@@ -838,7 +838,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
int ret; | int ret; | ||||
RTSPMessageHeader reply1, *reply = &reply1; | RTSPMessageHeader reply1, *reply = &reply1; | ||||
char cmd[1024]; | |||||
char cmd[MAX_URL_SIZE]; | |||||
retry: | retry: | ||||
if (rt->server_type == RTSP_SERVER_REAL) { | if (rt->server_type == RTSP_SERVER_REAL) { | ||||
@@ -49,7 +49,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) | |||||
int i; | int i; | ||||
char *sdp; | char *sdp; | ||||
AVFormatContext sdp_ctx, *ctx_array[1]; | AVFormatContext sdp_ctx, *ctx_array[1]; | ||||
char url[1024]; | |||||
char url[MAX_URL_SIZE]; | |||||
if (s->start_time_realtime == 0 || s->start_time_realtime == AV_NOPTS_VALUE) | if (s->start_time_realtime == 0 || s->start_time_realtime == AV_NOPTS_VALUE) | ||||
s->start_time_realtime = av_gettime(); | s->start_time_realtime = av_gettime(); | ||||
@@ -111,7 +111,7 @@ static int rtsp_write_record(AVFormatContext *s) | |||||
{ | { | ||||
RTSPState *rt = s->priv_data; | RTSPState *rt = s->priv_data; | ||||
RTSPMessageHeader reply1, *reply = &reply1; | RTSPMessageHeader reply1, *reply = &reply1; | ||||
char cmd[1024]; | |||||
char cmd[MAX_URL_SIZE]; | |||||
snprintf(cmd, sizeof(cmd), | snprintf(cmd, sizeof(cmd), | ||||
"Range: npt=0.000-\r\n"); | "Range: npt=0.000-\r\n"); | ||||