OEMCrypto v17.2

Version 17.2 includes udpates to support MediaCAS. See the
CHANGELOG for full details.
This commit is contained in:
Fred Gylys-Colwell
2023-09-07 13:32:55 -07:00
parent f998d6c4ae
commit 31f24774e8
189 changed files with 6390 additions and 3411 deletions

View File

@@ -2,7 +2,9 @@
// source code may only be used and distributed under the Widevine License
// Agreement.
//
// Clock - A fake clock just for running tests.
// Clock - A fake clock just for running tests. This is used when running
// OEMCrypto unit tests. It is not used when tests include the CE CDM source
// code because that uses the clock in cdm/test_host.cpp instead.
#include <chrono>

View File

@@ -14,6 +14,7 @@
#endif
#include <errno.h>
#include <inttypes.h>
#include <string.h>
#include <unistd.h>
@@ -53,6 +54,18 @@ void TestSleep::Sleep(unsigned int seconds) {
if (callback_ != nullptr) callback_->ElapseTime(milliseconds);
}
void TestSleep::SleepUntil(int64_t desired_time) {
SyncFakeClock();
const int64_t now = Clock().GetCurrentTime();
if (desired_time < now) {
LOGE("Test Clock skew sleeping from time %" PRId64 " to %" PRId64, now,
desired_time);
return;
}
const unsigned int sleep_time = static_cast<unsigned int>(desired_time - now);
TestSleep::Sleep(sleep_time);
}
void TestSleep::SyncFakeClock() {
// Syncing can be done by sleeping 0 seconds.
Sleep(0);

View File

@@ -13,7 +13,9 @@ namespace wvutil {
class TestSleep {
public:
// The callback is called when the clock should be advanced.
// The callback is called when the test clock should be advanced. If the
// system uses a real clock, it is used to sync the real and test
// clock. Otherwise it is used to simulate sleep in the test clock.
class CallBack {
public:
virtual void ElapseTime(int64_t milliseconds) = 0;
@@ -27,6 +29,9 @@ class TestSleep {
// callback exists, this calls the callback.
static void Sleep(unsigned int seconds);
// Like sleep, above, except it sleeps until the specified time.
static void SleepUntil(int64_t desired_time);
// If we are using a real clock and a fake clock, then the real clock advances
// a little while we are doing work, but the fake one only advances when we
// sleep. This function advances the fake clock to be in sync with the real