Skip to content

Commit

Permalink
[FragmentedSampleReader] Create senc when saio/saiz/senc are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
CastagnaIT committed Oct 7, 2024
1 parent 4794c89 commit c4d224c
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 c4d224c

Please sign in to comment.