mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #16350 from ctrlaltdavid/DEV-2391
DEV-2391: Fix Recording.stopRecording() crash
This commit is contained in:
commit
6d895942f3
1 changed files with 25 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);
|
||||
}
|
||||
|
||||
|
@ -195,6 +210,16 @@ void RecordingScriptingInterface::startRecording() {
|
|||
}
|
||||
|
||||
void RecordingScriptingInterface::stopRecording() {
|
||||
if (!_recorder->isRecording()) {
|
||||
qCWarning(scriptengine) << "Recorder is not running";
|
||||
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