1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

refine the comments, fix bug of parse message

This commit is contained in:
winlin 2014-02-19 14:54:04 +08:00
parent 73b298cab5
commit 39f15ba3da
2 changed files with 13 additions and 3 deletions

View file

@ -215,7 +215,7 @@ int SrsClient::stream_service_cycle()
rtmp->set_recv_timeout(SRS_RECV_TIMEOUT_US); rtmp->set_recv_timeout(SRS_RECV_TIMEOUT_US);
rtmp->set_send_timeout(SRS_SEND_TIMEOUT_US); rtmp->set_send_timeout(SRS_SEND_TIMEOUT_US);
// set timeout to larger. // set chunk size to larger.
int chunk_size = config->get_chunk_size(req->vhost); int chunk_size = config->get_chunk_size(req->vhost);
if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) { if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) {
srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret); srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret);
@ -223,7 +223,7 @@ int SrsClient::stream_service_cycle()
} }
srs_trace("set chunk_size=%d success", chunk_size); srs_trace("set chunk_size=%d success", chunk_size);
// find a source to publish. // find a source to serve.
SrsSource* source = SrsSource::find(req); SrsSource* source = SrsSource::find(req);
srs_assert(source != NULL); srs_assert(source != NULL);

View file

@ -173,7 +173,8 @@ messages.
* independently for each direction. * independently for each direction.
*/ */
#define RTMP_DEFAULT_CHUNK_SIZE 128 #define RTMP_DEFAULT_CHUNK_SIZE 128
#define RTMP_MIN_CHUNK_SIZE 2 #define RTMP_MIN_CHUNK_SIZE 128
#define RTMP_MAX_CHUNK_SIZE 65536
/** /**
* 6.1. Chunk Format * 6.1. Chunk Format
@ -1279,6 +1280,9 @@ int SrsCommonMessage::decode_packet(SrsProtocol* protocol)
// reset stream, for header read completed. // reset stream, for header read completed.
stream->reset(); stream->reset();
if (header.is_amf3_command()) {
stream->skip(1);
}
std::string request_name = protocol->get_request_name(transactionId); std::string request_name = protocol->get_request_name(transactionId);
if (request_name.empty()) { if (request_name.empty()) {
@ -3201,6 +3205,12 @@ int SrsSetChunkSizePacket::decode(SrsStream* stream)
ERROR_RTMP_CHUNK_SIZE, chunk_size, ret); ERROR_RTMP_CHUNK_SIZE, chunk_size, ret);
return ret; return ret;
} }
if (chunk_size > RTMP_MAX_CHUNK_SIZE) {
ret = ERROR_RTMP_CHUNK_SIZE;
srs_error("invalid chunk size. max=%d, actual=%d, ret=%d",
RTMP_MAX_CHUNK_SIZE, chunk_size, ret);
return ret;
}
return ret; return ret;
} }