Prevent seg fault if webm fragment is not initialized or last frame is EOS

Fixes #900
This commit is contained in:
Sergio Garcia Murillo 2021-03-08 00:01:08 +01:00 committed by GitHub
parent b8ce44aba0
commit f9908362f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

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

View File

@ -47,7 +47,8 @@ Status WebMMuxer::InitializeMuxer() {
}
Status WebMMuxer::Finalize() {
DCHECK(segmenter_);
if (!segmenter_)
return Status::OK;
Status segmenter_finalized = segmenter_->Finalize();
if (!segmenter_finalized.ok())