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

Refine get_hds_fragment and get_hds_window in time unit

This commit is contained in:
winlin 2019-04-16 08:24:11 +08:00
parent 917f6d066d
commit 010e35bec2
4 changed files with 23 additions and 14 deletions

View file

@ -348,7 +348,7 @@ srs_error_t SrsHds::on_video(SrsSharedPtrMessage* msg)
currentSegment->on_video(msg);
double fragment_duration = _srs_config->get_hds_fragment(hds_req->vhost) * 1000;
double fragment_duration = srsu2ms(_srs_config->get_hds_fragment(hds_req->vhost));
if (currentSegment->duration() >= fragment_duration) {
// flush segment
if ((err = currentSegment->flush()) != srs_success) {
@ -398,7 +398,7 @@ srs_error_t SrsHds::on_audio(SrsSharedPtrMessage* msg)
currentSegment->on_audio(msg);
double fragment_duration = _srs_config->get_hds_fragment(hds_req->vhost) * 1000;
double fragment_duration = srsu2ms(_srs_config->get_hds_fragment(hds_req->vhost));
if (currentSegment->duration() >= fragment_duration) {
// flush segment
if ((err = currentSegment->flush()) != srs_success) {
@ -718,7 +718,7 @@ void SrsHds::adjust_windows()
windows_size += fragment->duration();
}
double windows_size_limit = _srs_config->get_hds_window(hds_req->vhost) * 1000;
double windows_size_limit = srsu2ms(_srs_config->get_hds_window(hds_req->vhost));
if (windows_size > windows_size_limit ) {
SrsHdsFragment *fragment = fragments.front();
unlink(fragment->fragment_path().c_str());