@@ -71,10 +71,12 @@ modified by
71
71
// a +% b : shift a by b
72
72
// a == b : equality is same as for just numbers
73
73
74
+
namespace srt {
75
+
74
76
/// The AvgBufSize class is used to calculate moving average of the buffer (RCV or SND)
75
77
class AvgBufSize
76
78
{
77
-
typedef srt::sync::steady_clock::time_point time_point;
79
+
typedef sync::steady_clock::time_point time_point;
78
80
79
81
public:
80
82
AvgBufSize()
@@ -102,8 +104,8 @@ class AvgBufSize
102
104
103
105
class CSndBuffer
104
106
{
105
-
typedef srt::sync::steady_clock::time_point time_point;
106
-
typedef srt::sync::steady_clock::duration duration;
107
+
typedef sync::steady_clock::time_point time_point;
108
+
typedef sync::steady_clock::duration duration;
107
109
108
110
public:
109
111
// XXX There's currently no way to access the socket ID set for
@@ -140,21 +142,19 @@ class CSndBuffer
140
142
int addBufferFromFile(std::fstream& ifs, int len);
141
143
142
144
/// Find data position to pack a DATA packet from the furthest reading point.
143
-
/// @param [out] data the pointer to the data position.
144
-
/// @param [out] msgno message number of the packet.
145
-
/// @param [out] origintime origin time stamp of the message
146
-
/// @param [in] kflags Odd|Even crypto key flag
145
+
/// @param [out] w_packet data packet buffer to fill.
146
+
/// @param [out] w_origintime origin time stamp of the message.
147
+
/// @param [in] kflags Odd|Even crypto key flag.
147
148
/// @return Actual length of data read.
148
-
int readData(srt::CPacket& w_packet, time_point& w_origintime, int kflgs);
149
+
int readData(CPacket& w_packet, time_point& w_origintime, int kflgs);
149
150
150
151
/// Find data position to pack a DATA packet for a retransmission.
151
-
/// @param [out] data the pointer to the data position.
152
152
/// @param [in] offset offset from the last ACK point (backward sequence number difference)
153
-
/// @param [out] msgno message number of the packet.
154
-
/// @param [out] origintime origin time stamp of the message
155
-
/// @param [out] msglen length of the message
153
+
/// @param [out] w_packet data packet buffer to fill.
154
+
/// @param [out] w_origintime origin time stamp of the message
155
+
/// @param [out] w_msglen length of the message
156
156
/// @return Actual length of data read (return 0 if offset too large, -1 if TTL exceeded).
157
-
int readData(const int offset, srt::CPacket& w_packet, time_point& w_origintime, int& w_msglen);
157
+
int readData(const int offset, CPacket& w_packet, time_point& w_origintime, int& w_msglen);
158
158
159
159
/// Get the time of the last retransmission (if any) of the DATA packet.
160
160
/// @param [in] offset offset from the last ACK point (backward sequence number difference)
@@ -207,7 +207,7 @@ class CSndBuffer
207
207
static const int INPUTRATE_INITIAL_BYTESPS = BW_INFINITE;
208
208
209
209
private:
210
-
srt::sync::Mutex m_BufLock; // used to synchronize buffer operation
210
+
sync::Mutex m_BufLock; // used to synchronize buffer operation
211
211
212
212
struct Block
213
213
{
@@ -274,8 +274,8 @@ class CSndBuffer
274
274
275
275
class CRcvBuffer
276
276
{
277
-
typedef srt::sync::steady_clock::time_point time_point;
278
-
typedef srt::sync::steady_clock::duration duration;
277
+
typedef sync::steady_clock::time_point time_point;
278
+
typedef sync::steady_clock::duration duration;
279
279
280
280
public:
281
281
// XXX There's currently no way to access the socket ID set for
@@ -288,15 +288,15 @@ class CRcvBuffer
288
288
/// Construct the buffer.
289
289
/// @param [in] queue CUnitQueue that actually holds the units (packets)
290
290
/// @param [in] bufsize_pkts in units (packets)
291
-
CRcvBuffer(srt::CUnitQueue* queue, int bufsize_pkts = DEFAULT_SIZE);
291
+
CRcvBuffer(CUnitQueue* queue, int bufsize_pkts = DEFAULT_SIZE);
292
292
~CRcvBuffer();
293
293
294
294
public:
295
295
/// Write data into the buffer.
296
296
/// @param [in] unit pointer to a data unit containing new packet
297
297
/// @param [in] offset offset from last ACK point.
298
298
/// @return 0 is success, -1 if data is repeated.
299
-
int addData(srt::CUnit* unit, int offset);
299
+
int addData(CUnit* unit, int offset);
300
300
301
301
/// Read data into a user buffer.
302
302
/// @param [in] data pointer to user buffer.
@@ -402,7 +402,7 @@ class CRcvBuffer
402
402
403
403
bool isRcvDataReady();
404
404
bool isRcvDataAvailable() { return m_iLastAckPos != m_iStartPos; }
405
-
srt::CPacket* getRcvReadyPacket(int32_t seqdistance);
405
+
CPacket* getRcvReadyPacket(int32_t seqdistance);
406
406
407
407
/// Set TimeStamp-Based Packet Delivery Rx Mode
408
408
/// @param [in] timebase localtime base (uSec) of packet time stamps including buffering delay
@@ -464,7 +464,7 @@ class CRcvBuffer
464
464
/// data.
465
465
size_t freeUnitAt(size_t p)
466
466
{
467
-
srt::CUnit* u = m_pUnit[p];
467
+
CUnit* u = m_pUnit[p];
468
468
m_pUnit[p] = NULL;
469
469
size_t rmbytes = u->m_Packet.getLength();
470
470
m_pUnitQueue->makeUnitFree(u);
@@ -531,9 +531,9 @@ class CRcvBuffer
531
531
}
532
532
533
533
private:
534
-
srt::CUnit** m_pUnit; // Array of pointed units collected in the buffer
534
+
CUnit** m_pUnit; // Array of pointed units collected in the buffer
535
535
const int m_iSize; // Size of the internal array of CUnit* items
536
-
srt::CUnitQueue* m_pUnitQueue; // the shared unit queue
536
+
CUnitQueue* m_pUnitQueue; // the shared unit queue
537
537
538
538
int m_iStartPos; // HEAD: first packet available for reading
539
539
int m_iLastAckPos; // the last ACKed position (exclusive), follows the last readable
@@ -546,20 +546,22 @@ class CRcvBuffer
546
546
// up to which data are already retrieved;
547
547
// in message reading mode it's unused and always 0)
548
548
549
-
srt::sync::Mutex m_BytesCountLock; // used to protect counters operations
550
-
int m_iBytesCount; // Number of payload bytes in the buffer
551
-
int m_iAckedPktsCount; // Number of acknowledged pkts in the buffer
552
-
int m_iAckedBytesCount; // Number of acknowledged payload bytes in the buffer
553
-
unsigned m_uAvgPayloadSz; // Average payload size for dropped bytes estimation
549
+
sync::Mutex m_BytesCountLock; // used to protect counters operations
550
+
int m_iBytesCount; // Number of payload bytes in the buffer
551
+
int m_iAckedPktsCount; // Number of acknowledged pkts in the buffer
552
+
int m_iAckedBytesCount; // Number of acknowledged payload bytes in the buffer
553
+
unsigned m_uAvgPayloadSz; // Average payload size for dropped bytes estimation
554
554
555
-
srt::CTsbpdTime m_tsbpd;
555
+
CTsbpdTime m_tsbpd;
556
556
557
-
AvgBufSize m_mavg;
557
+
AvgBufSize m_mavg;
558
558
559
559
private:
560
560
CRcvBuffer();
561
561
CRcvBuffer(const CRcvBuffer&);
562
562
CRcvBuffer& operator=(const CRcvBuffer&);
563
563
};
564
564
565
+
} // namespace srt
566
+
565
567
#endif
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4