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

fix #108: disable the time jitter for encoder non-monotonical stream. 0.9.133

This commit is contained in:
winlin 2014-06-25 17:14:11 +08:00
parent f173345e15
commit 1970e18ed6
13 changed files with 206 additions and 28 deletions

View file

@ -70,10 +70,15 @@ SrsDvrPlan::SrsDvrPlan()
fs = new SrsFileStream();
enc = new SrsFlvEncoder();
segment = new SrsFlvSegment();
jitter_algorithm = SrsRtmpJitterAlgorithmOFF;
_srs_config->subscribe(this);
}
SrsDvrPlan::~SrsDvrPlan()
{
_srs_config->unsubscribe(this);
srs_freep(jitter);
srs_freep(fs);
srs_freep(enc);
@ -86,6 +91,8 @@ int SrsDvrPlan::initialize(SrsSource* source, SrsRequest* req)
_source = source;
_req = req;
jitter_algorithm = (SrsRtmpJitterAlgorithm)_srs_config->get_dvr_time_jitter(_req->vhost);
return ret;
}
@ -198,7 +205,7 @@ int SrsDvrPlan::on_audio(SrsSharedPtrMessage* audio)
return ret;
}
if ((jitter->correct(audio, 0, 0)) != ERROR_SUCCESS) {
if ((jitter->correct(audio, 0, 0, jitter_algorithm)) != ERROR_SUCCESS) {
return ret;
}
@ -240,7 +247,7 @@ int SrsDvrPlan::on_video(SrsSharedPtrMessage* video)
srs_verbose("dvr video is key: %d", is_key_frame);
#endif
if ((jitter->correct(video, 0, 0)) != ERROR_SUCCESS) {
if ((jitter->correct(video, 0, 0, jitter_algorithm)) != ERROR_SUCCESS) {
return ret;
}
@ -256,6 +263,15 @@ int SrsDvrPlan::on_video(SrsSharedPtrMessage* video)
return ret;
}
int SrsDvrPlan::on_reload_vhost_dvr(std::string vhost)
{
int ret = ERROR_SUCCESS;
jitter_algorithm = (SrsRtmpJitterAlgorithm)_srs_config->get_dvr_time_jitter(_req->vhost);
return ret;
}
int SrsDvrPlan::flv_open(string stream, string path)
{
int ret = ERROR_SUCCESS;