Skip to content

Commit 27a5edd

Browse files
authored
Merge pull request #1689 from CastagnaIT/fix_mp4_senc_omega
[backport][FragmentedSampleReader] Create senc when saio/saiz/senc are missing
2 parents a2cceb1 + a761c98 commit 27a5edd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/samplereader/FragmentedSampleReader.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "utils/Utils.h"
2323
#include "utils/log.h"
2424

25+
#include <bento4/Ap4SencAtom.h>
26+
2527
using namespace UTILS;
2628

2729
namespace
@@ -386,6 +388,14 @@ AP4_Result CFragmentedSampleReader::ProcessMoof(AP4_ContainerAtom* moof,
386388
if (!m_protectedDesc || !traf)
387389
return AP4_ERROR_INVALID_FORMAT;
388390

391+
// If the boxes saiz, saio, senc are missing, the stream does not conform to the specs and
392+
// may not be decrypted, so try create an empty senc where all samples will use the same default IV
393+
if (!traf->GetChild(AP4_ATOM_TYPE_SAIO) && !traf->GetChild(AP4_ATOM_TYPE_SAIZ) &&
394+
!traf->GetChild(AP4_ATOM_TYPE_SENC))
395+
{
396+
traf->AddChild(new AP4_SencAtom());
397+
}
398+
389399
bool reset_iv(false);
390400
if (AP4_FAILED(result = AP4_CencSampleInfoTable::Create(m_protectedDesc, traf, algorithm_id,
391401
reset_iv, *m_FragmentStream,

0 commit comments

Comments
 (0)