1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00

refine code, rename the c0c3 header cache and iov cache.

This commit is contained in:
winlin 2014-11-12 18:19:09 +08:00
parent ab93506b01
commit 953159258c
2 changed files with 8 additions and 8 deletions

View file

@ -564,21 +564,21 @@ int SrsProtocol::do_send_message(SrsMessage* msg)
srs_assert(nbh > 0); srs_assert(nbh > 0);
// header iov // header iov
iov[0].iov_base = header; out_iov[0].iov_base = header;
iov[0].iov_len = nbh; out_iov[0].iov_len = nbh;
// payload iov // payload iov
int payload_size = pend - p; int payload_size = pend - p;
if (payload_size > out_chunk_size) { if (payload_size > out_chunk_size) {
payload_size = out_chunk_size; payload_size = out_chunk_size;
} }
iov[1].iov_base = p; out_iov[1].iov_base = p;
iov[1].iov_len = payload_size; out_iov[1].iov_len = payload_size;
// send by writev // send by writev
// sendout header and payload by writev. // sendout header and payload by writev.
// decrease the sys invoke count to get higher performance. // decrease the sys invoke count to get higher performance.
if ((ret = skt->writev(iov, 2, NULL)) != ERROR_SUCCESS) { if ((ret = skt->writev(out_iov, 2, NULL)) != ERROR_SUCCESS) {
srs_error("send with writev failed. ret=%d", ret); srs_error("send with writev failed. ret=%d", ret);
return ret; return ret;
} }
@ -592,7 +592,7 @@ int SrsProtocol::do_send_message(SrsMessage* msg)
void SrsProtocol::generate_chunk_header(SrsMessageHeader* mh, bool c0, int* pnbh, char** ph) void SrsProtocol::generate_chunk_header(SrsMessageHeader* mh, bool c0, int* pnbh, char** ph)
{ {
char* cache = out_c0_cache; char* cache = out_c0c3_cache;
// to directly set the field. // to directly set the field.
char* pp = NULL; char* pp = NULL;

View file

@ -215,11 +215,11 @@ private:
* used for type0, 11bytes(or 15bytes with extended timestamp) header. * used for type0, 11bytes(or 15bytes with extended timestamp) header.
* or for type3, 1bytes(or 5bytes with extended timestamp) header. * or for type3, 1bytes(or 5bytes with extended timestamp) header.
*/ */
char out_c0_cache[SRS_CONSTS_RTMP_MAX_FMT0_HEADER_SIZE]; char out_c0c3_cache[SRS_CONSTS_RTMP_MAX_FMT0_HEADER_SIZE];
/** /**
* output iovec cache. * output iovec cache.
*/ */
iovec iov[2]; iovec out_iov[2];
/** /**
* output chunk size, default to 128, set by config. * output chunk size, default to 128, set by config.
*/ */