Skip to content

Commit

Permalink
Merge pull request #1749 from neo1973/fix_ODR_violation
Browse files Browse the repository at this point in the history
[TestHelper] Fix ODR violation that causes crash
  • Loading branch information
CastagnaIT authored Jan 4, 2025
2 parents 4b49c87 + a2861ee commit 8ddc249
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/aes_decrypter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include "aes_decrypter.h"
#include "utils/log.h"
#include <bento4/Ap4StreamCipher.h>
#include <kodi/Filesystem.h>
// #ifndef INPUTSTREAM_TEST_BUILD
// #include <kodi/Filesystem.h>
// #endif
#include <vector>

void AESDecrypter::decrypt(const AP4_UI08* aes_key,
Expand Down
1 change: 1 addition & 0 deletions src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_executable(${BINARY}
TestSmoothTree.cpp
TestHelper.cpp
TestUtils.cpp
../aes_decrypter.cpp
../decrypters/Helpers.cpp
../decrypters/HelperPr.cpp
../decrypters/HelperWv.cpp
Expand Down
22 changes: 12 additions & 10 deletions src/test/TestHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,25 @@ bool TestAdaptiveStream::Download(const DownloadInfo& downloadInfo, std::vector<
return true;
}

void AESDecrypter::decrypt(const AP4_UI08* aes_key,
const AP4_UI08* aes_iv,
const AP4_UI08* src,
std::vector<uint8_t>& dst,
size_t dstOffset,
size_t& dataSize,
bool lastChunk)
void AESDecrypterTest::decrypt(const AP4_UI08* aes_key,
const AP4_UI08* aes_iv,
const AP4_UI08* src,
std::vector<uint8_t>& dst,
size_t dstOffset,
size_t& dataSize,
bool lastChunk)
{
}

std::string AESDecrypter::convertIV(const std::string& input)
std::string AESDecrypterTest::convertIV(const std::string& input)
{
std::string result;
return result;
}

void AESDecrypter::ivFromSequence(uint8_t* buffer, uint64_t sid){}
void AESDecrypterTest::ivFromSequence(uint8_t* buffer, uint64_t sid)
{
}

std::string DASHTestTree::RunManifestUpdate(std::string manifestUpdFile)
{
Expand All @@ -183,7 +185,7 @@ bool DASHTestTree::DownloadManifestUpd(std::string_view url,

HLSTestTree::HLSTestTree() : CHLSTree()
{
m_decrypter = std::make_unique<AESDecrypter>(AESDecrypter(std::string()));
m_decrypter = std::make_unique<AESDecrypterTest>(std::string());
}

bool HLSTestTree::DownloadKey(std::string_view url,
Expand Down
8 changes: 4 additions & 4 deletions src/test/TestHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ class TestAdaptiveStream : public adaptive::AdaptiveStream
virtual bool Download(const DownloadInfo& downloadInfo, std::vector<uint8_t>& data) override;
};

class AESDecrypter : public IAESDecrypter
class AESDecrypterTest : public IAESDecrypter
{
public:
AESDecrypter(const std::string& licenseKey) : m_licenseKey(licenseKey){};
virtual ~AESDecrypter() = default;
AESDecrypterTest(const std::string& licenseKey) : m_licenseKey(licenseKey) {};
virtual ~AESDecrypterTest() = default;

void decrypt(const AP4_UI08* aes_key,
const AP4_UI08* aes_iv,
Expand All @@ -93,7 +93,7 @@ class AESDecrypter : public IAESDecrypter
std::string convertIV(const std::string& input);
void ivFromSequence(uint8_t* buffer, uint64_t sid);
const std::string& getLicenseKey() const { return m_licenseKey; };
bool RenewLicense(const std::string& pluginUrl);
// bool RenewLicense(const std::string& pluginUrl);

private:
std::string m_licenseKey;
Expand Down

0 comments on commit 8ddc249

Please sign in to comment.