Revision ba6f6023 src/connection.cpp
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 |
|
Also available in: Unified diff