正在显示
2 个修改的文件
包含
13 行增加
和
3 行删除
| @@ -215,7 +215,7 @@ int SrsClient::stream_service_cycle() | @@ -215,7 +215,7 @@ int SrsClient::stream_service_cycle() | ||
| 215 | rtmp->set_recv_timeout(SRS_RECV_TIMEOUT_US); | 215 | rtmp->set_recv_timeout(SRS_RECV_TIMEOUT_US); |
| 216 | rtmp->set_send_timeout(SRS_SEND_TIMEOUT_US); | 216 | rtmp->set_send_timeout(SRS_SEND_TIMEOUT_US); |
| 217 | 217 | ||
| 218 | - // set timeout to larger. | 218 | + // set chunk size to larger. |
| 219 | int chunk_size = config->get_chunk_size(req->vhost); | 219 | int chunk_size = config->get_chunk_size(req->vhost); |
| 220 | if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) { | 220 | if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) { |
| 221 | srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret); | 221 | srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret); |
| @@ -223,7 +223,7 @@ int SrsClient::stream_service_cycle() | @@ -223,7 +223,7 @@ int SrsClient::stream_service_cycle() | ||
| 223 | } | 223 | } |
| 224 | srs_trace("set chunk_size=%d success", chunk_size); | 224 | srs_trace("set chunk_size=%d success", chunk_size); |
| 225 | 225 | ||
| 226 | - // find a source to publish. | 226 | + // find a source to serve. |
| 227 | SrsSource* source = SrsSource::find(req); | 227 | SrsSource* source = SrsSource::find(req); |
| 228 | srs_assert(source != NULL); | 228 | srs_assert(source != NULL); |
| 229 | 229 |
| @@ -173,7 +173,8 @@ messages. | @@ -173,7 +173,8 @@ messages. | ||
| 173 | * independently for each direction. | 173 | * independently for each direction. |
| 174 | */ | 174 | */ |
| 175 | #define RTMP_DEFAULT_CHUNK_SIZE 128 | 175 | #define RTMP_DEFAULT_CHUNK_SIZE 128 |
| 176 | -#define RTMP_MIN_CHUNK_SIZE 2 | 176 | +#define RTMP_MIN_CHUNK_SIZE 128 |
| 177 | +#define RTMP_MAX_CHUNK_SIZE 65536 | ||
| 177 | 178 | ||
| 178 | /** | 179 | /** |
| 179 | * 6.1. Chunk Format | 180 | * 6.1. Chunk Format |
| @@ -1279,6 +1280,9 @@ int SrsCommonMessage::decode_packet(SrsProtocol* protocol) | @@ -1279,6 +1280,9 @@ int SrsCommonMessage::decode_packet(SrsProtocol* protocol) | ||
| 1279 | 1280 | ||
| 1280 | // reset stream, for header read completed. | 1281 | // reset stream, for header read completed. |
| 1281 | stream->reset(); | 1282 | stream->reset(); |
| 1283 | + if (header.is_amf3_command()) { | ||
| 1284 | + stream->skip(1); | ||
| 1285 | + } | ||
| 1282 | 1286 | ||
| 1283 | std::string request_name = protocol->get_request_name(transactionId); | 1287 | std::string request_name = protocol->get_request_name(transactionId); |
| 1284 | if (request_name.empty()) { | 1288 | if (request_name.empty()) { |
| @@ -3201,6 +3205,12 @@ int SrsSetChunkSizePacket::decode(SrsStream* stream) | @@ -3201,6 +3205,12 @@ int SrsSetChunkSizePacket::decode(SrsStream* stream) | ||
| 3201 | ERROR_RTMP_CHUNK_SIZE, chunk_size, ret); | 3205 | ERROR_RTMP_CHUNK_SIZE, chunk_size, ret); |
| 3202 | return ret; | 3206 | return ret; |
| 3203 | } | 3207 | } |
| 3208 | + if (chunk_size > RTMP_MAX_CHUNK_SIZE) { | ||
| 3209 | + ret = ERROR_RTMP_CHUNK_SIZE; | ||
| 3210 | + srs_error("invalid chunk size. max=%d, actual=%d, ret=%d", | ||
| 3211 | + RTMP_MAX_CHUNK_SIZE, chunk_size, ret); | ||
| 3212 | + return ret; | ||
| 3213 | + } | ||
| 3204 | 3214 | ||
| 3205 | return ret; | 3215 | return ret; |
| 3206 | } | 3216 | } |
-
请 注册 或 登录 后发表评论