summaryrefslogtreecommitdiffstats
path: root/linhes/mythtv/0031-UPnP-Reduce-startup-latency-by-moving-blocking-code-to-own-thread.patch
blob: 288a243c209880d654356ba594e1c2301815b945 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
diff -Naur mythtv-master-20210518-gc8c226c9b4-old/mythtv/libs/libmythupnp/ssdp.cpp mythtv-master-20210518-gc8c226c9b4-new/mythtv/libs/libmythupnp/ssdp.cpp
--- mythtv-master-20210518-gc8c226c9b4-old/mythtv/libs/libmythupnp/ssdp.cpp	2021-05-18 16:11:31.379999938 +0200
+++ mythtv-master-20210518-gc8c226c9b4-new/mythtv/libs/libmythupnp/ssdp.cpp	2021-05-18 16:11:34.569999938 +0200
@@ -155,21 +155,21 @@
         // ------------------------------------------------------------------
 
         LOG(VB_UPNP, LOG_INFO,
-            "SSDP::EnableNotifications() - sending NTS_byebye");
-        m_pNotifyTask->SetNTS( NTS_byebye );
-        m_pNotifyTask->Execute( nullptr );
-
-        m_bAnnouncementsEnabled = true;
+            "SSDP::EnableNotifications() - sending NTS_byebye2");
+        m_pNotifyTask->SetNTS( NTS_byebye2 );
+    }
+    else
+    {
+        LOG(VB_UPNP, LOG_INFO,
+            "SSDP::EnableNotifications() - sending NTS_alive");
+        m_pNotifyTask->SetNTS( NTS_alive );
     }
 
+    m_bAnnouncementsEnabled = true;
+
     // ------------------------------------------------------------------
     // Add Announcement Task to the Queue
     // ------------------------------------------------------------------
-
-    LOG(VB_UPNP, LOG_INFO, "SSDP::EnableNotifications() - sending NTS_alive");
-
-    m_pNotifyTask->SetNTS( NTS_alive );
-
     TaskQueue::Instance()->AddTask(m_pNotifyTask);
 
     LOG(VB_UPNP, LOG_INFO,
diff -Naur mythtv-master-20210518-gc8c226c9b4-old/mythtv/libs/libmythupnp/upnptasknotify.cpp mythtv-master-20210518-gc8c226c9b4-new/mythtv/libs/libmythupnp/upnptasknotify.cpp
--- mythtv-master-20210518-gc8c226c9b4-old/mythtv/libs/libmythupnp/upnptasknotify.cpp	2021-05-18 16:11:31.379999938 +0200
+++ mythtv-master-20210518-gc8c226c9b4-new/mythtv/libs/libmythupnp/upnptasknotify.cpp	2021-05-18 16:11:34.586666605 +0200
@@ -165,6 +167,11 @@
 
     if (m_eNTS == NTS_alive) 
         pQueue->AddTask( (m_nMaxAge / 2), (Task *)this  );
+    else if (m_eNTS == NTS_byebye2)
+    {
+        m_eNTS = NTS_alive;
+        pQueue->AddTask( this );
+    }
 
     m_mutex.unlock();
 
diff -Naur mythtv-master-20210518-gc8c226c9b4-old/mythtv/libs/libmythupnp/upnptasknotify.h mythtv-master-20210518-gc8c226c9b4-new/mythtv/libs/libmythupnp/upnptasknotify.h
--- mythtv-master-20210518-gc8c226c9b4-old/mythtv/libs/libmythupnp/upnptasknotify.h	2021-05-18 16:11:31.379999938 +0200
+++ mythtv-master-20210518-gc8c226c9b4-new/mythtv/libs/libmythupnp/upnptasknotify.h	2021-05-18 16:11:34.586666605 +0200
@@ -38,7 +38,8 @@
 enum UPnpNotifyNTS
 {
     NTS_alive   = 0,
-    NTS_byebye  = 1
+    NTS_byebye  = 1,
+    NTS_byebye2
 };
 
 /////////////////////////////////////////////////////////////////////////////
@@ -89,6 +90,7 @@
             {
                 case NTS_alive : return( "ssdp:alive"  );
                 case NTS_byebye: return( "ssdp:byebye" );
+                case NTS_byebye2: return( "ssdp:byebye" );
             }
             return( "unknown" );
         }