Fix and rebuild

This commit is contained in:
luiscuenca 2017-11-30 16:07:43 -07:00
parent 9cd2dc921a
commit 98e8361690
2 changed files with 5 additions and 7 deletions

View file

@ -139,7 +139,7 @@ public:
QThread::msleep(_runDelayMs);
}
auto rootItem = _surface->getRootItem();
if (rootItem) {
if (rootItem && !_surface->getCleaned()) {
for (auto player : rootItem->findChildren<QMediaPlayer*>()) {
auto mediaState = player->state();
QMediaService *svc = player->service();
@ -165,12 +165,7 @@ public:
svc->releaseControl(out);
// if multimedia was paused, it will start playing automatically after changing audio device
// this will reset it back to a paused state
if (mediaState == QMediaPlayer::State::PausedState) {
player->pause();
}
else if (mediaState == QMediaPlayer::State::StoppedState) {
player->stop();
}
}
}
qDebug() << "QML Audio changed to " << _newTargetDevice;
@ -504,6 +499,7 @@ QOpenGLContext* OffscreenQmlSurface::getSharedContext() {
}
void OffscreenQmlSurface::cleanup() {
_isCleaned = true;
_canvas->makeCurrent();
_renderControl->invalidate();

View file

@ -75,6 +75,7 @@ public:
void pause();
void resume();
bool isPaused() const;
bool getCleaned() { return _isCleaned; }
void setBaseUrl(const QUrl& baseUrl);
QQuickItem* getRootItem();
@ -177,6 +178,7 @@ private:
bool _polish { true };
bool _paused { true };
bool _focusText { false };
bool _isCleaned{ false };
uint8_t _maxFps { 60 };
MouseTranslator _mouseTranslator { [](const QPointF& p) { return p.toPoint(); } };
QWindow* _proxyWindow { nullptr };