MCPcopy Create free account
hub / github.com/Haivision/srt / ExtendColumns

Method ExtendColumns

srtcore/fec.cpp:2492–2583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2490}
2491
2492size_t FECFilterBuiltin::ExtendColumns(size_t colgx)
2493{
2494 // This isn't safe to allow the group container to get expanded to any
2495 // size, however with some very tolerant settings, such as 10 seconds of
2496 // latency and very large receiver buffer, this might be tolerable.
2497 //
2498 // Therefore put only two conditions here:
2499 //
2500 // 1. The group containers must keep at most place for so many
2501 // packets as it is intended for the receiver buffer. Keeping
2502 // group cells for more packets doesn't make sense anyway.
2503 //
2504 // 2. Existing group containers should contain at least size
2505 // for two series. If they don't contain that much, there's no
2506 // need to do any emergency shrinking. Unknown whether this is
2507 // physically possible, although it may also happen in case when
2508 // you have very large FEC matrix size not coordinated with the
2509 // receiver buffer size.
2510
2511 // colgx is the number of column + NSERIES * numberCols().
2512 // We can state that for every column we should have a number
2513 // of packets as many as the number of rows, so simply multiply this.
2514 const size_t size_in_packets = colgx * numberRows();
2515 const size_t n_series = colgx / numberCols();
2516
2517 if (CheckEmergencyShrink(n_series, size_in_packets))
2518 {
2519 HLOGC(pflog.Debug, log << "FEC: DONE Emergency resize, colgx=" << colgx << " series=" << n_series
2520 << "npackets=" << size_in_packets << " exceeds buf=" << rcvBufferSize());
2521 }
2522 else
2523 {
2524 HLOGC(pflog.Debug, log << "FEC: Will extend up to colgx=" << colgx << " series=" << n_series
2525 << " for npackets=" << size_in_packets);
2526 }
2527
2528
2529#if ENABLE_HEAVY_LOGGING
2530 LOGC(pflog.Debug, log << "FEC: COL STATS BEFORE: n=" << rcv.colq.size());
2531
2532 for (size_t i = 0; i < rcv.colq.size(); ++i)
2533 LOGC(pflog.Debug, log << "... [" << i << "] " << rcv.colq[i].DisplayStats());
2534#endif
2535
2536 // First, obtain the "series" of columns, possibly fixed.
2537 const int series = int(colgx / numberCols());
2538
2539 // Now, the base of the series is the base increased by one matrix size.
2540
2541 const int32_t base = rcv.colq[0].base;
2542
2543 // This is the base for series 0, but this procedure must be prepared
2544 // for that the series will not necessarily be 1, may be greater.
2545 // Extension requires to be done in order to achieve this very index
2546 // existing in the column, so you need to add whole series in loop
2547 // until the series covering this shift is created.
2548
2549 // Check, up to which series the columns are initialized.

Callers

nothing calls this directly

Calls 2

DisplayStatsMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected