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

For #906, #902, replace the endless thread with coroutine

This commit is contained in:
winlin 2017-05-29 17:56:26 +08:00
parent fc380fe48d
commit 44f542f77f
7 changed files with 28 additions and 151 deletions

View file

@ -60,7 +60,7 @@ SrsBufferCache::SrsBufferCache(SrsSource* s, SrsRequest* r)
req = r->copy();
source = s;
queue = new SrsMessageQueue(true);
pthread = new SrsEndlessThread("http-stream", this);
trd = new SrsCoroutine("http-stream", this);
// TODO: FIXME: support reload.
fast_cache = _srs_config->get_vhost_http_remux_fast_cache(req->vhost);
@ -68,7 +68,7 @@ SrsBufferCache::SrsBufferCache(SrsSource* s, SrsRequest* r)
SrsBufferCache::~SrsBufferCache()
{
srs_freep(pthread);
srs_freep(trd);
srs_freep(queue);
srs_freep(req);
@ -87,7 +87,7 @@ int SrsBufferCache::update(SrsSource* s, SrsRequest* r)
int SrsBufferCache::start()
{
return pthread->start();
return trd->start();
}
int SrsBufferCache::dump_cache(SrsConsumer* consumer, SrsRtmpJitterAlgorithm jitter)
@ -138,7 +138,7 @@ int SrsBufferCache::cycle()
// TODO: FIXME: support reload.
queue->set_queue_size(fast_cache);
while (true) {
while (!trd->pull()) {
pprint->elapse();
// get messages from consumer.