Skip to content

Commit

Permalink
refine code, rename the c0c3 header cache and iov cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 12, 2014
1 parent ab93506 commit 9531592
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions trunk/src/rtmp/srs_protocol_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,21 +564,21 @@ int SrsProtocol::do_send_message(SrsMessage* msg)
srs_assert(nbh > 0);

// header iov
iov[0].iov_base = header;
iov[0].iov_len = nbh;
out_iov[0].iov_base = header;
out_iov[0].iov_len = nbh;

// payload iov
int payload_size = pend - p;
if (payload_size > out_chunk_size) {
payload_size = out_chunk_size;
}
iov[1].iov_base = p;
iov[1].iov_len = payload_size;
out_iov[1].iov_base = p;
out_iov[1].iov_len = payload_size;

// send by writev
// sendout header and payload by writev.
// 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);
return ret;
}
Expand All @@ -592,7 +592,7 @@ int SrsProtocol::do_send_message(SrsMessage* msg)

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.
char* pp = NULL;
Expand Down
4 changes: 2 additions & 2 deletions trunk/src/rtmp/srs_protocol_stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ class SrsProtocol
* used for type0, 11bytes(or 15bytes 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.
*/
iovec iov[2];
iovec out_iov[2];
/**
* output chunk size, default to 128, set by config.
*/
Expand Down

0 comments on commit 9531592

Please sign in to comment.