From b8ce44aba0970bf0b702d93adf6fcda9307a6350 Mon Sep 17 00:00:00 2001 From: Sergio Garcia Murillo Date: Wed, 3 Mar 2021 08:53:58 +0100 Subject: [PATCH] Prevent seg fault if mp4 fragment is not initialized Related to #900. --- packager/media/formats/mp4/fragmenter.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packager/media/formats/mp4/fragmenter.cc b/packager/media/formats/mp4/fragmenter.cc index a7075e949e..7154c63924 100644 --- a/packager/media/formats/mp4/fragmenter.cc +++ b/packager/media/formats/mp4/fragmenter.cc @@ -157,6 +157,9 @@ Status Fragmenter::InitializeFragment(int64_t first_sample_dts) { } Status Fragmenter::FinalizeFragment() { + if (!fragment_initialized_) + return Status::OK; + if (stream_info_->is_encrypted()) { Status status = FinalizeFragmentForEncryption(); if (!status.ok())