mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
for bug #249, simplify the macro, 0 to disable chunk stream cache.
This commit is contained in:
parent
159ef3823c
commit
57f844b636
2 changed files with 8 additions and 1 deletions
|
@ -75,6 +75,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* how many chunk stream to cache, [0, N].
|
||||
* to imporove about 10% performance when chunk size small, and 5% for large chunk.
|
||||
* @see https://github.com/winlinvip/simple-rtmp-server/issues/249
|
||||
* @remark 0 to disable the chunk stream cache.
|
||||
*/
|
||||
#define SRS_PERF_CHUNK_STREAM_CACHE 16
|
||||
|
||||
|
|
|
@ -418,7 +418,10 @@ SrsProtocol::SrsProtocol(ISrsProtocolReaderWriter* io)
|
|||
warned_c0c3_cache_dry = false;
|
||||
auto_response_when_recv = true;
|
||||
|
||||
cs_cache = new SrsChunkStream*[SRS_PERF_CHUNK_STREAM_CACHE];
|
||||
cs_cache = NULL;
|
||||
if (SRS_PERF_CHUNK_STREAM_CACHE > 0) {
|
||||
cs_cache = new SrsChunkStream*[SRS_PERF_CHUNK_STREAM_CACHE];
|
||||
}
|
||||
for (int cid = 0; cid < SRS_PERF_CHUNK_STREAM_CACHE; cid++) {
|
||||
SrsChunkStream* cs = new SrsChunkStream(cid);
|
||||
// set the perfer cid of chunk,
|
||||
|
@ -1102,6 +1105,9 @@ int SrsProtocol::recv_interlaced_message(SrsMessage** pmsg)
|
|||
}
|
||||
srs_verbose("read basic header success. fmt=%d, cid=%d", fmt, cid);
|
||||
|
||||
// the cid must not negative.
|
||||
srs_assert(cid >= 0);
|
||||
|
||||
// once we got the chunk message header,
|
||||
// that is there is a real message in cache,
|
||||
// increase the timeout to got it.
|
||||
|
|
Loading…
Reference in a new issue