Revision ba6f6023

View differences:

src/connection.cpp
40 40
    tm(tm), removeMe(false),
41 41
    stopTime(0),
42 42
    interrupted(false), 
43
    lostPacket(false)
43
    lostPacket(false),
44
    convertToPS(false),
45
    lastTime(0)
44 46
{
45 47
  if (debugLevel > 1)
46 48
    std::cerr << "New client connection" << std::endl;
47 49

  
48
  dataOutput = new OutputBuffer(dataFD, 16384, 262144);
50
  dataOutput = new OutputBuffer(dataFD, 16384, 1048576);
49 51
}
50 52

  
51 53
Connection::~Connection()
......
218 220
  tuned = true;
219 221
  interrupted = false;
220 222
  lostPacket = false;
223
  this->convertToPS = convertToPS;
221 224
  return result;
222 225
}
223 226

  
......
244 247

  
245 248
void Connection::receiveData(unsigned char *data, unsigned size)
246 249
{
250
  if (debugLevel > 0) {
251
    time_t now = time(NULL);
252

  
253
    if (now - lastTime >= 2) {
254
      std::cerr << "Buffer usage:" << dataOutput->getUsed() << "/" << dataOutput->getMaxSize() 
255
		<< std::endl;
256
      lastTime = now;
257
    }
258
  }
259
  
247 260
  // Receive data from the Demuxers and forward it to the clients
248 261
  if (!dataOutput->write((char *) data, size)) {
249 262
    if (!lostPacket) {
250 263
      std::cerr << "Warning: client not reading data connection fast enough (dropping packets)" << std::endl;
251 264
      lostPacket = true;
252 265
    }
253
    // Drop a TS/PS packet from the beginning
254
    dataOutput->discard(188 + dataOutput->getUsed() % 188);
255
    dataOutput->write((char *) data, size);
266
    if (!convertToPS) {
267
      // Drop a TS packet from the beginning
268
      dataOutput->discard(188 + dataOutput->getUsed() % 188);
269
      dataOutput->write((char *) data, size);
270
    }
256 271
  }
257 272
}
258 273

  
src/connection.h
81 81
  std::string channel, type;
82 82
  OutputBuffer *dataOutput;
83 83
  SourceList demuxers;
84
  bool removeMe;
85
  time_t stopTime;
86
  bool interrupted;
87
  bool lostPacket;
84
  bool removeMe;		/** kill this connection */
85
  time_t stopTime;		/** time to stop at */
86
  bool interrupted;		/** interrupted by higher priority recording */
87
  bool lostPacket;		/** client is not keeping up */
88
  bool convertToPS;		/** convert to program stream */
89
  time_t lastTime;		/** Last time printed buffer stats */
88 90
};
89 91

  
90 92

  

Also available in: Unified diff