Explorar el Código

another bug fixed

UwU hace 2 meses
padre
commit
5c56b87a42

+ 4 - 1
src/WallpaperEngine/Media/DBusMediaSource.cpp

@@ -339,8 +339,9 @@ void DBusMediaSource::initialStatusFetch () {
 }
 
 void DBusMediaSource::performUpdate () {
-    // nothing to do if no player is detected
+    // no player detected yet (or the previous one went away) - try to find one
     if (!this->m_currentPlayer.has_value ()) {
+	this->detectPlayer ();
 	return;
     }
 
@@ -350,6 +351,8 @@ void DBusMediaSource::performUpdate () {
     );
 
     if (reply == nullptr) {
+	// the player is gone, forget it so we stop querying a dead name and can detect a new one
+	this->m_currentPlayer.reset ();
 	return;
     }
 

+ 5 - 1
src/WallpaperEngine/Media/MediaSource.cpp

@@ -28,10 +28,14 @@ MediaSource::~MediaSource () {
 }
 
 void MediaSource::update () {
-    if (std::chrono::steady_clock::now () <= m_nextUpdate) {
+    auto now = std::chrono::steady_clock::now ();
+
+    if (now <= m_nextUpdate) {
 	return;
     }
 
+    m_nextUpdate = now + m_updateInterval;
+
     this->performUpdate ();
 }