Skip to content

Commit

Permalink
test: fix fake clock for muxer for integration tests (#1322)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cosmin authored Feb 8, 2024
1 parent 5d44368 commit 9b9adf3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 1 addition & 4 deletions packager/media/formats/mp4/mp4_muxer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -692,10 +692,7 @@ uint64_t MP4Muxer::IsoTimeNow() {
const uint64_t kIsomTimeOffset = 2082844800l;

// Get the current system time since January 1, 1970, in seconds.
std::chrono::system_clock::duration duration =
std::chrono::system_clock::now().time_since_epoch();
std::int64_t secondsSince1970 =
std::chrono::duration_cast<std::chrono::seconds>(duration).count();
std::int64_t secondsSince1970 = Now();

// Add the offset of seconds between January 1, 1970, and January 1, 1904.
return secondsSince1970 + kIsomTimeOffset;
Expand Down
1 change: 1 addition & 0 deletions packager/packager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ Status Packager::Initialize(

media::MuxerFactory muxer_factory(packaging_params);
if (packaging_params.test_params.inject_fake_clock) {
internal->fake_clock.reset(new media::FakeClock());
muxer_factory.OverrideClock(internal->fake_clock);
}

Expand Down

0 comments on commit 9b9adf3

Please sign in to comment.