tcp->sendPacket(buffer, bufferLength);
}
-ULONG MVPReceiver::getBlock(unsigned char* buffer, unsigned long amount)
-{
-/*
- pthread_mutex_lock(&processedRingLock);
-
- int numTries = 0;
-
- while ((unsigned long)processed.getContent() < amount)
- {
- pthread_mutex_unlock(&processedRingLock);
- if (++numTries == 30) // 15s
- {
- logger->log("MVPReceiver", Log::DEBUG, "getBlock timeout");
- return 0;
- }
- usleep(500000);
- pthread_mutex_lock(&processedRingLock);
- }
-
- unsigned long amountReceived = processed.get(buffer, amount);
- pthread_mutex_unlock(&processedRingLock);
- return amountReceived;
- */
- sleep(10);
- return 0;
-}
static MVPReceiver* create(cChannel*, int priority);
virtual ~MVPReceiver();
int init(TCP* tcp, ULONG streamID);
- ULONG getBlock(unsigned char* buffer, unsigned long amount);
bool isVdrActivated();
private:
int VompClientRRProc::processGetBlock()
{
- if (!x.lp && !x.recplayer)
+ if (x.lp)
+ {
+ log->log("RRProc", Log::ERR, "Get block called during live streaming");
+ return 0;
+ }
+
+ if (!x.recplayer)
{
- log->log("RRProc", Log::DEBUG, "Get block called when no streaming happening!");
+ log->log("RRProc", Log::ERR, "Get block called when no recording open");
return 0;
}
log->log("RRProc", Log::DEBUG, "getblock pos = %llu length = %lu", position, amount);
UCHAR sendBuffer[amount];
- ULONG amountReceived = 0; // compiler moan.
- if (x.lp)
- {
- log->log("RRProc", Log::DEBUG, "getting from live");
- amountReceived = x.lp->getBlock(&sendBuffer[0], amount);
-
- if (!amountReceived)
- {
- // vdr has possibly disconnected the receiver
- log->log("RRProc", Log::DEBUG, "VDR has disconnected the live receiver");
- delete x.lp;
- x.lp = NULL;
- }
- }
- else if (x.recplayer)
- {
- log->log("RRProc", Log::DEBUG, "getting from recording");
- amountReceived = x.recplayer->getBlock(&sendBuffer[0], position, amount);
- }
+ ULONG amountReceived = x.recplayer->getBlock(&sendBuffer[0], position, amount);
if (!amountReceived)
{