avoid passing on same frame multiple times in a row
Stefan Schuermans

Stefan Schuermans commited on 2011-11-19 22:13:47
Showing 1 changed files, with 8 additions and 0 deletions.

... ...
@@ -56,6 +56,10 @@ void Stream::detach(StreamRecv *recv)
56 56
  */
57 57
 void Stream::setFrame(stBlinkenFrame *pFrame)
58 58
 {
59
+  // leave if frame is already set to an identical one
60
+  if (m_pFrame && !BlinkenFrameCompare(pFrame, m_pFrame))
61
+    return;
62
+
59 63
   // update local copy of current frame
60 64
   if (m_pFrame)
61 65
     BlinkenFrameFree(m_pFrame);
... ...
@@ -72,6 +76,10 @@ void Stream::setFrame(stBlinkenFrame *pFrame)
72 76
 /// set current frame to none
73 77
 void Stream::setNoFrame()
74 78
 {
79
+  // leave if frame is already set to none
80
+  if (!m_pFrame)
81
+    return;
82
+
75 83
   // set current frame to none
76 84
   if (m_pFrame) {
77 85
     BlinkenFrameFree(m_pFrame);
78 86