commit 31dc2083fc6be720a211c10997716cc5a678b696
parent ce5c1a0f6e335dab96179a39e986b63484248787
Author: Karl Tomlinson <karlt+@karlt.net>
Date: Wed, 8 Oct 2025 00:22:24 +0000
Bug 1992922 Use IterationDuration() from SystemClockDriver::WaitInterval() r=padenot
A subsequent patch will round iteration duration to audio blocks.
Differential Revision: https://phabricator.services.mozilla.com/D267734
Diffstat:
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp
@@ -271,8 +271,8 @@ TimeDuration SystemClockDriver::WaitInterval() {
MOZ_ASSERT(mThread);
MOZ_ASSERT(OnThread());
TimeStamp now = TimeStamp::Now();
- int64_t timeoutMS = MEDIA_GRAPH_TARGET_PERIOD_MS -
- int64_t((now - mCurrentTimeStamp).ToMilliseconds());
+ int64_t timeoutMS =
+ IterationDuration() - int64_t((now - mCurrentTimeStamp).ToMilliseconds());
// Make sure timeoutMS doesn't overflow 32 bits by waking up at
// least once a minute, if we need to wake up at all
timeoutMS = std::max<int64_t>(0, std::min<int64_t>(timeoutMS, 60 * 1000));
diff --git a/dom/media/GraphDriver.h b/dom/media/GraphDriver.h
@@ -475,7 +475,7 @@ class ThreadedDriver : public GraphDriver {
* A SystemClockDriver drives a GraphInterface using a system clock, and waits
* using a monitor, between each iteration.
*/
-class SystemClockDriver : public ThreadedDriver {
+class SystemClockDriver final : public ThreadedDriver {
public:
SystemClockDriver(GraphInterface* aGraphInterface,
GraphDriver* aPreviousDriver, uint32_t aSampleRate);
@@ -499,7 +499,7 @@ class SystemClockDriver : public ThreadedDriver {
* An OfflineClockDriver runs the graph as fast as possible, without waiting
* between iteration.
*/
-class OfflineClockDriver : public ThreadedDriver {
+class OfflineClockDriver final : public ThreadedDriver {
public:
OfflineClockDriver(GraphInterface* aGraphInterface, uint32_t aSampleRate,
GraphTime aSlice);
@@ -547,7 +547,8 @@ struct AudioInputProcessingParamsRequest {
* API, we have to do block processing at 128 frames per block, we need to
* keep a little spill buffer to store the extra frames.
*/
-class AudioCallbackDriver : public GraphDriver, public MixerCallbackReceiver {
+class AudioCallbackDriver final : public GraphDriver,
+ public MixerCallbackReceiver {
using IterationResult = GraphInterface::IterationResult;
enum class FallbackDriverState;
class FallbackWrapper;