]> git.vomp.tv Git - vompserver.git/commitdiff
Bug fix for new stream protocol
authorChris Tallon <chris@vomp.tv>
Sun, 25 Nov 2007 13:25:36 +0000 (13:25 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 25 Nov 2007 13:25:36 +0000 (13:25 +0000)
mvpreceiver.c

index fcc9caf0c4c3964e2167a9d4e3291ad017152da2..ae8c01b5344620421ce6bf1f1abe8b2350efa269 100755 (executable)
@@ -102,14 +102,17 @@ void MVPReceiver::threadMethod()
     threadWaitForSignal();
     threadCheckExit();
     
-    pthread_mutex_lock(&processedRingLock);
-    amountReceived = processed.get(buffer+12, streamChunkSize);
-    pthread_mutex_unlock(&processedRingLock);
+    do
+    {
+      pthread_mutex_lock(&processedRingLock);
+      amountReceived = processed.get(buffer+12, streamChunkSize);
+      pthread_mutex_unlock(&processedRingLock);
     
-    *(ULONG*)&buffer[0] = htonl(2); // stream channel
-    *(ULONG*)&buffer[4] = htonl(streamID);
-    *(ULONG*)&buffer[8] = htonl(amountReceived);
-    tcp->sendPacket(buffer, amountReceived + 12);
+      *(ULONG*)&buffer[0] = htonl(2); // stream channel
+      *(ULONG*)&buffer[4] = htonl(streamID);
+      *(ULONG*)&buffer[8] = htonl(amountReceived);
+      tcp->sendPacket(buffer, amountReceived + 12);
+    } while(processed.getContent());
   }  
 }