test: fix fake clock for muxer for integration tests (#1322)

The fix in #1289 was not complete and left the fake clock as null which
didn't have any effect. This was revealed by integration tests showing
mismatches in the timestamps in MP4.
This commit is contained in:
Cosmin Stejerean 2024-02-08 18:49:15 +01:00 committed by GitHub
parent 5d44368478
commit 9b9adf38ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View File

@ -692,10 +692,7 @@ uint64_t MP4Muxer::IsoTimeNow() {
const uint64_t kIsomTimeOffset = 2082844800l; const uint64_t kIsomTimeOffset = 2082844800l;
// Get the current system time since January 1, 1970, in seconds. // Get the current system time since January 1, 1970, in seconds.
std::chrono::system_clock::duration duration = std::int64_t secondsSince1970 = Now();
std::chrono::system_clock::now().time_since_epoch();
std::int64_t secondsSince1970 =
std::chrono::duration_cast<std::chrono::seconds>(duration).count();
// Add the offset of seconds between January 1, 1970, and January 1, 1904. // Add the offset of seconds between January 1, 1970, and January 1, 1904.
return secondsSince1970 + kIsomTimeOffset; return secondsSince1970 + kIsomTimeOffset;

View File

@ -942,6 +942,7 @@ Status Packager::Initialize(
media::MuxerFactory muxer_factory(packaging_params); media::MuxerFactory muxer_factory(packaging_params);
if (packaging_params.test_params.inject_fake_clock) { if (packaging_params.test_params.inject_fake_clock) {
internal->fake_clock.reset(new media::FakeClock());
muxer_factory.OverrideClock(internal->fake_clock); muxer_factory.OverrideClock(internal->fake_clock);
} }