diff --git a/src/samplereader/FragmentedSampleReader.cpp b/src/samplereader/FragmentedSampleReader.cpp index 3adc07b1c..1cfdeba85 100644 --- a/src/samplereader/FragmentedSampleReader.cpp +++ b/src/samplereader/FragmentedSampleReader.cpp @@ -22,6 +22,8 @@ #include "utils/Utils.h" #include "utils/log.h" +#include + using namespace UTILS; namespace @@ -386,6 +388,14 @@ AP4_Result CFragmentedSampleReader::ProcessMoof(AP4_ContainerAtom* moof, if (!m_protectedDesc || !traf) return AP4_ERROR_INVALID_FORMAT; + // If the boxes saiz, saio, senc are missing, the stream does not conform to the specs and + // may not be decrypted, so try create an empty senc where all samples will use the same default IV + if (!traf->GetChild(AP4_ATOM_TYPE_SAIO) && !traf->GetChild(AP4_ATOM_TYPE_SAIZ) && + !traf->GetChild(AP4_ATOM_TYPE_SENC)) + { + traf->AddChild(new AP4_SencAtom()); + } + bool reset_iv(false); if (AP4_FAILED(result = AP4_CencSampleInfoTable::Create(m_protectedDesc, traf, algorithm_id, reset_iv, *m_FragmentStream,