|
@@ -31,6 +31,11 @@ message_ptr RtpPacketizer::packetize(shared_ptr<binary> payload, bool mark) {
|
|
|
if (setVideoRotation)
|
|
|
rtpExtHeaderSize += 2;
|
|
|
|
|
|
+ const bool setPlayoutDelay = (rtpConfig->playoutDelayId > 0 && rtpConfig->playoutDelayId < 15);
|
|
|
+
|
|
|
+ if (setPlayoutDelay)
|
|
|
+ rtpExtHeaderSize += 4;
|
|
|
+
|
|
|
if (rtpConfig->mid.has_value())
|
|
|
rtpExtHeaderSize += (1 + rtpConfig->mid->length());
|
|
|
|
|
@@ -85,6 +90,21 @@ message_ptr RtpPacketizer::packetize(shared_ptr<binary> payload, bool mark) {
|
|
|
reinterpret_cast<const std::byte *>(rtpConfig->rid->c_str()),
|
|
|
rtpConfig->rid->length());
|
|
|
}
|
|
|
+
|
|
|
+ if (setPlayoutDelay) {
|
|
|
+ uint16_t min = rtpConfig->playoutDelayMin & 0xFFF;
|
|
|
+ uint16_t max = rtpConfig->playoutDelayMax & 0xFFF;
|
|
|
+
|
|
|
+ // 12 bits for min + 12 bits for max
|
|
|
+ byte data[] = {
|
|
|
+ byte((min >> 4) & 0xFF),
|
|
|
+ byte(((min & 0xF) << 4) | ((max >> 8) & 0xF)),
|
|
|
+ byte(max & 0xFF)
|
|
|
+ };
|
|
|
+
|
|
|
+ extHeader->writeOneByteHeader(offset, rtpConfig->playoutDelayId, data, 3);
|
|
|
+ offset += 4;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
rtp->preparePacket();
|