summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-11-04 22:18:14 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-11-05 17:53:37 +0100
commit1f55a084efcd98b9780f8a9e22cbea76b6d649c8 (patch)
tree7991a3ef24d45e394ec98a150b5f069839ea6fb2 /src
parent85a0060f4814bb419c745ed0c45cd5fa42e03da1 (diff)
WinRT: avoid warning about negative timer
If we synthesize, then the audio sink never becomes active, and we never start the elapsed timer. As asking for the elapsed times of an invalid timer is undefined behavior, don't do it. Pick-to: 6.6 Change-Id: Ida32957e37eccada38ae66298b93b334127b6124 Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/tts/winrt/qtexttospeech_winrt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/tts/winrt/qtexttospeech_winrt.cpp b/src/plugins/tts/winrt/qtexttospeech_winrt.cpp
index ee1f3dd..9cb0b5d 100644
--- a/src/plugins/tts/winrt/qtexttospeech_winrt.cpp
+++ b/src/plugins/tts/winrt/qtexttospeech_winrt.cpp
@@ -423,7 +423,8 @@ void QTextToSpeechEngineWinRTPrivate::sinkStateChanged(QAudio::State sinkState)
elapsedTimer.invalidate();
} else {
boundaryTimer.stop();
- playedTime += elapsedTimer.nsecsElapsed() / 1000;
+ if (elapsedTimer.isValid())
+ playedTime += elapsedTimer.nsecsElapsed() / 1000;
elapsedTimer.invalidate();
audioSink->suspend();
}