mirror of
https://github.com/lubosz/overte.git
synced 2025-04-09 00:02:39 +02:00
Add missing threading checks to Recording API methods
This commit is contained in:
parent
e708cb98bb
commit
185d6990eb
1 changed files with 20 additions and 0 deletions
|
@ -64,6 +64,11 @@ void RecordingScriptingInterface::playClip(NetworkClipLoaderPointer clipLoader,
|
|||
}
|
||||
|
||||
void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue callback) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
BLOCKING_INVOKE_METHOD(this, "loadRecording", Q_ARG(const QString&, url), Q_ARG(QScriptValue, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
auto clipLoader = DependencyManager::get<recording::ClipCache>()->getClipLoader(url);
|
||||
|
||||
if (clipLoader->isLoaded()) {
|
||||
|
@ -117,6 +122,11 @@ void RecordingScriptingInterface::startPlaying() {
|
|||
}
|
||||
|
||||
void RecordingScriptingInterface::setPlayerVolume(float volume) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
BLOCKING_INVOKE_METHOD(this, "setPlayerVolume", Q_ARG(float, volume));
|
||||
return;
|
||||
}
|
||||
|
||||
_player->setVolume(std::min(std::max(volume, 0.0f), 1.0f));
|
||||
}
|
||||
|
||||
|
@ -137,6 +147,11 @@ void RecordingScriptingInterface::setPlayFromCurrentLocation(bool playFromCurren
|
|||
}
|
||||
|
||||
void RecordingScriptingInterface::setPlayerLoop(bool loop) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
BLOCKING_INVOKE_METHOD(this, "setPlayerLoop", Q_ARG(bool, loop));
|
||||
return;
|
||||
}
|
||||
|
||||
_player->loop(loop);
|
||||
}
|
||||
|
||||
|
@ -200,6 +215,11 @@ void RecordingScriptingInterface::stopRecording() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (QThread::currentThread() != thread()) {
|
||||
BLOCKING_INVOKE_METHOD(this, "stopRecording");
|
||||
return;
|
||||
}
|
||||
|
||||
_recorder->stop();
|
||||
_lastClip = _recorder->getClip();
|
||||
_lastClip->seek(0);
|
||||
|
|
Loading…
Reference in a new issue