fix: Prevent crash in GetEarliestTimestamp() if periods are empty (#1173)

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

Fixes #1172
This commit is contained in:
Sergio Garcia Murillo 2023-07-12 23:51:00 +02:00 committed by GitHub
parent dab165d3e5
commit d6f28d456c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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