Skip to content

Commit

Permalink
fix: Prevent crash in GetEarliestTimestamp() if periods are empty (sh…
Browse files Browse the repository at this point in the history
…aka-project#1173)

While I have not yet found why the periods are empty, this will prevent shaka from seg faulting

Fixes shaka-project#1172
  • Loading branch information
murillo128 authored Jul 12, 2023
1 parent dab165d commit d6f28d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packager/mpd/base/mpd_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ float MpdBuilder::GetStaticMpdDuration() {
bool MpdBuilder::GetEarliestTimestamp(double* timestamp_seconds) {
DCHECK(timestamp_seconds);
DCHECK(!periods_.empty());
if (periods_.empty())
return false;
double timestamp = 0;
double earliest_timestamp = -1;
// TODO(kqyang): This is used to set availabilityStartTime. We may consider
Expand Down

0 comments on commit d6f28d4

Please sign in to comment.