Skip to content

Commit ef144d5

Browse files
committed
test 2
1 parent 23cbc52 commit ef144d5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/samplereader/FragmentedSampleReader.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ bool CFragmentedSampleReader::Initialize(SESSION::CStream* stream)
5555
AP4_SampleDescription* desc{m_track->GetSampleDescription(0)};
5656
if (desc->GetType() == AP4_SampleDescription::TYPE_PROTECTED)
5757
{
58-
m_protectedDesc = static_cast<AP4_ProtectedSampleDescription*>(desc);
58+
auto protectedDesc = static_cast<AP4_ProtectedSampleDescription*>(desc);
5959

6060
AP4_ContainerAtom* schi;
61-
if (m_protectedDesc->GetSchemeInfo() &&
62-
(schi = m_protectedDesc->GetSchemeInfo()->GetSchiAtom()))
61+
if (protectedDesc->GetSchemeInfo() && (schi = protectedDesc->GetSchemeInfo()->GetSchiAtom()))
6362
{
6463
AP4_TencAtom* tenc(AP4_DYNAMIC_CAST(AP4_TencAtom, schi->GetChild(AP4_ATOM_TYPE_TENC, 0)));
6564
if (tenc && tenc->GetDefaultKid())
@@ -163,7 +162,7 @@ AP4_Result CFragmentedSampleReader::ReadSample()
163162

164163
//Protection could have changed in ProcessMoof
165164
bool useDecryptingDecoder =
166-
m_protectedDesc &&
165+
m_singleSampleDecryptor &&
167166
(m_decrypterCaps.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH) != 0;
168167
//bool decrypterPresent{m_decrypter != nullptr};
169168

@@ -177,6 +176,7 @@ AP4_Result CFragmentedSampleReader::ReadSample()
177176
*/
178177
if (m_decrypter)
179178
{
179+
LOG::Log(LOGERROR, "READSAMPLE USE m_decrypter");
180180
m_sampleData.Reserve(sampleData.GetDataSize());
181181
if (AP4_FAILED(result = m_decrypter->DecryptSampleData(m_poolId, sampleData, m_sampleData,
182182
NULL, streamType)))
@@ -199,12 +199,16 @@ AP4_Result CFragmentedSampleReader::ReadSample()
199199
}
200200
else if (useDecryptingDecoder)
201201
{
202+
LOG::Log(LOGERROR, "READSAMPLE USE useDecryptingDecoder");
202203
m_sampleData.Reserve(sampleData.GetDataSize());
203204
m_singleSampleDecryptor->DecryptSampleData(m_poolId, sampleData, m_sampleData, nullptr, 0,
204205
nullptr, nullptr, streamType);
205206
}
206207
else
208+
{
209+
LOG::Log(LOGERROR, "READSAMPLE USE nothing");
207210
m_sampleData.SetData(sampleData.GetData(), sampleData.GetDataSize());
211+
}
208212

209213
if (m_codecHandler->Transform(m_sample.GetDts(), m_sample.GetDuration(), m_sampleData,
210214
m_track->GetMediaTimeScale()))
@@ -485,7 +489,7 @@ AP4_Result CFragmentedSampleReader::ProcessMoof(AP4_ContainerAtom* moof,
485489
}
486490
}
487491
SUCCESS:
488-
if (m_singleSampleDecryptor && m_decrypter && m_codecHandler)
492+
if (m_singleSampleDecryptor && m_codecHandler)
489493
{
490494
if (AP4_FAILED(m_singleSampleDecryptor->SetFragmentInfo(
491495
m_poolId, m_defaultKey, m_codecHandler->m_naluLengthSize, m_codecHandler->m_extraData,
@@ -522,9 +526,11 @@ void CFragmentedSampleReader::UpdateSampleDescription()
522526
LOG::LogF(LOGERROR, "Cannot sample description from protected sample description");
523527
return;
524528
}
529+
LOG::LogF(LOGWARNING, "m_protectedDesc PRESENT");
525530
}
526531
else {
527532
m_protectedDesc = nullptr;
533+
LOG::LogF(LOGWARNING, "m_protectedDesc NOT-PRESENT");
528534
}
529535

530536
LOG::LogF(LOGDEBUG, "Codec fourcc: %s (%u)", CODEC::FourCCToString(desc->GetFormat()).c_str(),

0 commit comments

Comments
 (0)