Skip to content

Commit

Permalink
Merge pull request #1700 from fingul/master
Browse files Browse the repository at this point in the history
Fix:  LL-HLS sub playlist, EXT-X-TARGETDURATION ist not rounded.
  • Loading branch information
getroot authored Oct 2, 2024
2 parents 8f5c166 + a57fe1f commit ac83406
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/projects/publishers/llhls/llhls_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,16 @@ bool LLHlsStream::AddPackager(const std::shared_ptr<const MediaTrack> &media_tra

// milliseconds to seconds
auto segment_count = _storage_config.max_segments;
auto segment_duration = static_cast<float_t>(_storage_config.segment_duration_ms) / 1000.0;

// segment_duration used for mark X-TARGETDURATION, and must rounded to the nearest integer number of seconds.

// Note that in protocol version 6, the semantics of the EXT-
// X-TARGETDURATION tag changed slightly. In protocol version 5 and
// earlier it indicated the maximum segment duration; in protocol
// version 6 and later it indicates the the maximum segment duration
// rounded to the nearest integer number of seconds.

auto segment_duration = std::round(static_cast<float_t>(_storage_config.segment_duration_ms) / 1000.0);
auto chunk_duration = static_cast<float_t>(_packager_config.chunk_duration_ms) / 1000.0;
auto track_id = media_track->GetId();

Expand Down Expand Up @@ -1619,4 +1628,4 @@ std::vector<std::shared_ptr<const mdl::Dump>> LLHlsStream::GetDumpInfoList()
dump_list.push_back(it.second);
}
return dump_list;
}
}

0 comments on commit ac83406

Please sign in to comment.