Prevent seg fault if webm fragment is not initialized or last frame is EOS
Fixes #900
This commit is contained in:
parent
b8ce44aba0
commit
f9908362f8
|
@ -150,7 +150,7 @@ Status Segmenter::Initialize(const StreamInfo& info,
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Segmenter::Finalize() {
|
Status Segmenter::Finalize() {
|
||||||
if (prev_sample_) {
|
if (prev_sample_ && !prev_sample_->end_of_stream()) {
|
||||||
uint64_t duration =
|
uint64_t duration =
|
||||||
prev_sample_->pts() - first_timestamp_ + prev_sample_->duration();
|
prev_sample_->pts() - first_timestamp_ + prev_sample_->duration();
|
||||||
segment_info_.set_duration(FromBmffTimestamp(duration));
|
segment_info_.set_duration(FromBmffTimestamp(duration));
|
||||||
|
|
|
@ -47,7 +47,8 @@ Status WebMMuxer::InitializeMuxer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Status WebMMuxer::Finalize() {
|
Status WebMMuxer::Finalize() {
|
||||||
DCHECK(segmenter_);
|
if (!segmenter_)
|
||||||
|
return Status::OK;
|
||||||
Status segmenter_finalized = segmenter_->Finalize();
|
Status segmenter_finalized = segmenter_->Finalize();
|
||||||
|
|
||||||
if (!segmenter_finalized.ok())
|
if (!segmenter_finalized.ok())
|
||||||
|
|
Loading…
Reference in New Issue