Prevent seg fault when finalizing empty segment (#759)

Fixes #757.
This commit is contained in:
Sergio Garcia Murillo 2020-04-25 23:09:48 +02:00 committed by GitHub
parent 8e113af215
commit dba798798b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -150,9 +150,11 @@ Status Segmenter::Initialize(const StreamInfo& info,
}
Status Segmenter::Finalize() {
if (prev_sample_) {
uint64_t duration =
prev_sample_->pts() - first_timestamp_ + prev_sample_->duration();
segment_info_.set_duration(FromBmffTimestamp(duration));
}
return DoFinalize();
}