Skip to content

Commit

Permalink
Bug 1586761 - P5 - Use new methods in media r=tjr,baku
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D63906

--HG--
extra : moz-landing-system : lando
  • Loading branch information
chihweitung committed Mar 25, 2020
1 parent 3d9adc5 commit d33e72a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 5 additions & 2 deletions dom/media/webaudio/AudioContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,14 @@ double AudioContext::CurrentTime() {
return rawTime;
}

MOZ_ASSERT(GetParentObject()->AsGlobal());
// The value of a MediaTrack's CurrentTime will always advance forward; it
// will never reset (even if one rewinds a video.) Therefore we can use a
// single Random Seed initialized at the same time as the object.
return nsRFPService::ReduceTimePrecisionAsSecs(rawTime,
GetRandomTimelineSeed());
return nsRFPService::ReduceTimePrecisionAsSecs(
rawTime, GetRandomTimelineSeed(),
/* aIsSystemPrincipal */ false,
GetParentObject()->AsGlobal()->CrossOriginIsolated());
}

nsISerialEventTarget* AudioContext::GetMainThread() const {
Expand Down
11 changes: 8 additions & 3 deletions media/webrtc/signaling/src/peerconnection/RTCStatsReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ RTCStatsTimestampMaker::RTCStatsTimestampMaker(const GlobalObject* aGlobal) {
// 053826b10f838f77c27507e5efecc96e34718541/dom/performance/Performance.cpp#111-117
mStartWallClockRaw =
PerformanceService::GetOrCreate()->TimeOrigin(mStartMonotonic);
MOZ_ASSERT(window->AsGlobal());
mCrossOriginIsolated = window->AsGlobal()->CrossOriginIsolated();
}
}

Expand All @@ -42,10 +44,13 @@ DOMHighResTimeStamp RTCStatsTimestampMaker::GetNow() const {
// mRandomTimelineSeed is not set in the unit-tests.
if (mRandomTimelineSeed) {
msSinceStart = nsRFPService::ReduceTimePrecisionAsMSecs(
msSinceStart, mRandomTimelineSeed);
msSinceStart, mRandomTimelineSeed, /* aIsSystemPrincipal */ false,
mCrossOriginIsolated);
}
return msSinceStart +
nsRFPService::ReduceTimePrecisionAsMSecs(mStartWallClockRaw, 0);
return msSinceStart + nsRFPService::ReduceTimePrecisionAsMSecs(
mStartWallClockRaw, 0,
/* aIsSystemPrincipal */ false,
mCrossOriginIsolated);
}

NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(RTCStatsReport, mParent)
Expand Down
1 change: 1 addition & 0 deletions media/webrtc/signaling/src/peerconnection/RTCStatsReport.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class RTCStatsTimestampMaker {
uint64_t mRandomTimelineSeed = 0;
DOMHighResTimeStamp mStartWallClockRaw = (double)PR_Now() / PR_USEC_PER_MSEC;
TimeStamp mStartMonotonic = TimeStamp::NowUnfuzzed();
bool mCrossOriginIsolated = false;
};

typedef MozPromise<UniquePtr<RTCStatsCollection>, nsresult, true>
Expand Down

0 comments on commit d33e72a

Please sign in to comment.