Skip to content

Commit

Permalink
Merge pull request #1689 from CastagnaIT/fix_mp4_senc_omega
Browse files Browse the repository at this point in the history
[backport][FragmentedSampleReader] Create senc when saio/saiz/senc are missing
  • Loading branch information
CastagnaIT authored Oct 9, 2024
2 parents a2cceb1 + a761c98 commit 27a5edd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/samplereader/FragmentedSampleReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "utils/Utils.h"
#include "utils/log.h"

#include <bento4/Ap4SencAtom.h>

using namespace UTILS;

namespace
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 27a5edd

Please sign in to comment.