Avoiding segmentation fault on streams without samples

An informational message is logged instead.

Fixes #446.

Change-Id: Ia3a79a16b3bdbabd5d56facf9bf011f29c9b1533
This commit is contained in:
KongQun Yang 2018-08-01 15:37:40 -07:00
parent 64c3b4c558
commit 416051ae65
1 changed files with 10 additions and 1 deletions

View File

@ -147,7 +147,16 @@ Status MP4Muxer::InitializeMuxer() {
}
Status MP4Muxer::Finalize() {
DCHECK(segmenter_);
// This happens on streams that are not initialized, i.e. not going through
// DelayInitializeMuxer, which can only happen if there are no samples from
// the stream.
if (!segmenter_) {
DCHECK(to_be_initialized_);
LOG(INFO) << "Skip stream '" << options().output_file_name
<< "' which does not contain any sample.";
return Status::OK;
}
Status segmenter_finalized = segmenter_->Finalize();
if (!segmenter_finalized.ok())