mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for bug #251, support mic(message iovs cache). 2.0.61
This commit is contained in:
parent
32d537b96b
commit
d53fd7f570
8 changed files with 457 additions and 2 deletions
|
@ -634,6 +634,10 @@ SrsSource::SrsSource(SrsRequest* req)
|
|||
|
||||
_srs_config->subscribe(this);
|
||||
atc = _srs_config->get_atc(_req->vhost);
|
||||
|
||||
#ifdef SRS_PERF_MW_MSG_IOVS_CACHE
|
||||
chunk_size = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
SrsSource::~SrsSource()
|
||||
|
@ -860,6 +864,26 @@ int SrsSource::on_reload_vhost_dvr(string vhost)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsSource::on_reload_vhost_chunk_size(string vhost)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (_req->vhost != vhost) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef SRS_PERF_MW_MSG_IOVS_CACHE
|
||||
int size = _srs_config->get_chunk_size(_req->vhost);
|
||||
if (chunk_size != size) {
|
||||
srs_warn("connected clients will error for mic chunk_size changed %d=>%d",
|
||||
chunk_size, size);
|
||||
}
|
||||
chunk_size = size;
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsSource::on_reload_vhost_transcode(string vhost)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
@ -1089,6 +1113,14 @@ int SrsSource::on_meta_data(SrsCommonMessage* msg, SrsOnMetaDataPacket* metadata
|
|||
}
|
||||
srs_verbose("initialize shared ptr metadata success.");
|
||||
|
||||
#ifdef SRS_PERF_MW_MSG_IOVS_CACHE
|
||||
if ((ret = cache_metadata->mic_evaluate(chunk_size)) != ERROR_SUCCESS) {
|
||||
srs_error("mic metadata iovs failed, chunk_size=%d. ret=%d", chunk_size, ret);
|
||||
return ret;
|
||||
}
|
||||
srs_info("mic metadata iovs ok, chunk_size=%d", chunk_size);
|
||||
#endif
|
||||
|
||||
// copy to all consumer
|
||||
if (true) {
|
||||
std::vector<SrsConsumer*>::iterator it;
|
||||
|
@ -1130,6 +1162,14 @@ int SrsSource::on_audio(SrsCommonMessage* __audio)
|
|||
}
|
||||
srs_verbose("initialize shared ptr audio success.");
|
||||
|
||||
#ifdef SRS_PERF_MW_MSG_IOVS_CACHE
|
||||
if ((ret = msg.mic_evaluate(chunk_size)) != ERROR_SUCCESS) {
|
||||
srs_error("mic audio iovs failed, chunk_size=%d. ret=%d", chunk_size, ret);
|
||||
return ret;
|
||||
}
|
||||
srs_info("mic audio iovs ok, chunk_size=%d", chunk_size);
|
||||
#endif
|
||||
|
||||
#ifdef SRS_AUTO_HLS
|
||||
if ((ret = hls->on_audio(&msg)) != ERROR_SUCCESS) {
|
||||
srs_warn("hls process audio message failed, ignore and disable hls. ret=%d", ret);
|
||||
|
@ -1240,6 +1280,14 @@ int SrsSource::on_video(SrsCommonMessage* __video)
|
|||
}
|
||||
srs_verbose("initialize shared ptr video success.");
|
||||
|
||||
#ifdef SRS_PERF_MW_MSG_IOVS_CACHE
|
||||
if ((ret = msg.mic_evaluate(chunk_size)) != ERROR_SUCCESS) {
|
||||
srs_error("mic video iovs failed, chunk_size=%d. ret=%d", chunk_size, ret);
|
||||
return ret;
|
||||
}
|
||||
srs_info("mic video iovs ok, chunk_size=%d", chunk_size);
|
||||
#endif
|
||||
|
||||
#ifdef SRS_AUTO_HLS
|
||||
if ((ret = hls->on_video(&msg)) != ERROR_SUCCESS) {
|
||||
srs_warn("hls process video message failed, ignore and disable hls. ret=%d", ret);
|
||||
|
@ -1491,6 +1539,11 @@ int SrsSource::on_publish()
|
|||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SRS_PERF_MW_MSG_IOVS_CACHE
|
||||
chunk_size = _srs_config->get_chunk_size(_req->vhost);
|
||||
srs_trace("mic use chunk_size=%d to send msgs", chunk_size);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue