|
@@ -935,7 +935,8 @@ int rtcCreateDataChannelEx(int pc, const char *label, const rtcDataChannelInit *
|
|
|
dci.reliability.unordered = reliability->unordered;
|
|
dci.reliability.unordered = reliability->unordered;
|
|
|
if (reliability->unreliable) {
|
|
if (reliability->unreliable) {
|
|
|
if (reliability->maxPacketLifeTime > 0)
|
|
if (reliability->maxPacketLifeTime > 0)
|
|
|
- dci.reliability.maxPacketLifeTime.emplace(milliseconds(reliability->maxPacketLifeTime));
|
|
|
|
|
|
|
+ dci.reliability.maxPacketLifeTime.emplace(
|
|
|
|
|
+ milliseconds(reliability->maxPacketLifeTime));
|
|
|
else
|
|
else
|
|
|
dci.reliability.maxRetransmits.emplace(reliability->maxRetransmits);
|
|
dci.reliability.maxRetransmits.emplace(reliability->maxRetransmits);
|
|
|
}
|
|
}
|
|
@@ -999,9 +1000,10 @@ int rtcGetDataChannelReliability(int dc, rtcReliability *reliability) {
|
|
|
Reliability dcr = dataChannel->reliability();
|
|
Reliability dcr = dataChannel->reliability();
|
|
|
std::memset(reliability, 0, sizeof(*reliability));
|
|
std::memset(reliability, 0, sizeof(*reliability));
|
|
|
reliability->unordered = dcr.unordered;
|
|
reliability->unordered = dcr.unordered;
|
|
|
- if(dcr.maxPacketLifeTime) {
|
|
|
|
|
|
|
+ if (dcr.maxPacketLifeTime) {
|
|
|
reliability->unreliable = true;
|
|
reliability->unreliable = true;
|
|
|
- reliability->maxPacketLifeTime = static_cast<unsigned int>(dcr.maxPacketLifeTime->count());
|
|
|
|
|
|
|
+ reliability->maxPacketLifeTime =
|
|
|
|
|
+ static_cast<unsigned int>(dcr.maxPacketLifeTime->count());
|
|
|
} else if (dcr.maxRetransmits) {
|
|
} else if (dcr.maxRetransmits) {
|
|
|
reliability->unreliable = true;
|
|
reliability->unreliable = true;
|
|
|
reliability->maxRetransmits = *dcr.maxRetransmits;
|
|
reliability->maxRetransmits = *dcr.maxRetransmits;
|
|
@@ -1256,8 +1258,8 @@ int rtcSetH264Packetizer(int tr, const rtcPacketizerInit *init) {
|
|
|
emplaceRtpConfig(rtpConfig, tr);
|
|
emplaceRtpConfig(rtpConfig, tr);
|
|
|
// create packetizer
|
|
// create packetizer
|
|
|
auto nalSeparator = init ? init->nalSeparator : RTC_NAL_SEPARATOR_LENGTH;
|
|
auto nalSeparator = init ? init->nalSeparator : RTC_NAL_SEPARATOR_LENGTH;
|
|
|
- auto maxFragmentSize = init && init->maxFragmentSize ? init->maxFragmentSize
|
|
|
|
|
- : RTC_DEFAULT_MAX_FRAGMENT_SIZE;
|
|
|
|
|
|
|
+ auto maxFragmentSize =
|
|
|
|
|
+ init && init->maxFragmentSize ? init->maxFragmentSize : RTC_DEFAULT_MAX_FRAGMENT_SIZE;
|
|
|
auto packetizer = std::make_shared<H264RtpPacketizer>(
|
|
auto packetizer = std::make_shared<H264RtpPacketizer>(
|
|
|
static_cast<rtc::NalUnit::Separator>(nalSeparator), rtpConfig, maxFragmentSize);
|
|
static_cast<rtc::NalUnit::Separator>(nalSeparator), rtpConfig, maxFragmentSize);
|
|
|
track->setMediaHandler(packetizer);
|
|
track->setMediaHandler(packetizer);
|
|
@@ -1273,8 +1275,8 @@ int rtcSetH265Packetizer(int tr, const rtcPacketizerInit *init) {
|
|
|
emplaceRtpConfig(rtpConfig, tr);
|
|
emplaceRtpConfig(rtpConfig, tr);
|
|
|
// create packetizer
|
|
// create packetizer
|
|
|
auto nalSeparator = init ? init->nalSeparator : RTC_NAL_SEPARATOR_LENGTH;
|
|
auto nalSeparator = init ? init->nalSeparator : RTC_NAL_SEPARATOR_LENGTH;
|
|
|
- auto maxFragmentSize = init && init->maxFragmentSize ? init->maxFragmentSize
|
|
|
|
|
- : RTC_DEFAULT_MAX_FRAGMENT_SIZE;
|
|
|
|
|
|
|
+ auto maxFragmentSize =
|
|
|
|
|
+ init && init->maxFragmentSize ? init->maxFragmentSize : RTC_DEFAULT_MAX_FRAGMENT_SIZE;
|
|
|
auto packetizer = std::make_shared<H265RtpPacketizer>(
|
|
auto packetizer = std::make_shared<H265RtpPacketizer>(
|
|
|
static_cast<rtc::NalUnit::Separator>(nalSeparator), rtpConfig, maxFragmentSize);
|
|
static_cast<rtc::NalUnit::Separator>(nalSeparator), rtpConfig, maxFragmentSize);
|
|
|
track->setMediaHandler(packetizer);
|
|
track->setMediaHandler(packetizer);
|
|
@@ -1289,8 +1291,8 @@ int rtcSetAV1Packetizer(int tr, const rtcPacketizerInit *init) {
|
|
|
auto rtpConfig = createRtpPacketizationConfig(init);
|
|
auto rtpConfig = createRtpPacketizationConfig(init);
|
|
|
emplaceRtpConfig(rtpConfig, tr);
|
|
emplaceRtpConfig(rtpConfig, tr);
|
|
|
// create packetizer
|
|
// create packetizer
|
|
|
- auto maxFragmentSize = init && init->maxFragmentSize ? init->maxFragmentSize
|
|
|
|
|
- : RTC_DEFAULT_MAX_FRAGMENT_SIZE;
|
|
|
|
|
|
|
+ auto maxFragmentSize =
|
|
|
|
|
+ init && init->maxFragmentSize ? init->maxFragmentSize : RTC_DEFAULT_MAX_FRAGMENT_SIZE;
|
|
|
auto packetization = init->obuPacketization == RTC_OBU_PACKETIZED_TEMPORAL_UNIT
|
|
auto packetization = init->obuPacketization == RTC_OBU_PACKETIZED_TEMPORAL_UNIT
|
|
|
? AV1RtpPacketizer::Packetization::TemporalUnit
|
|
? AV1RtpPacketizer::Packetization::TemporalUnit
|
|
|
: AV1RtpPacketizer::Packetization::Obu;
|
|
: AV1RtpPacketizer::Packetization::Obu;
|
|
@@ -1301,6 +1303,21 @@ int rtcSetAV1Packetizer(int tr, const rtcPacketizerInit *init) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+int rtcSetVP8Packetizer(int tr, const rtcPacketizerInit *init) {
|
|
|
|
|
+ return wrap([&] {
|
|
|
|
|
+ auto track = getTrack(tr);
|
|
|
|
|
+ // create RTP configuration
|
|
|
|
|
+ auto rtpConfig = createRtpPacketizationConfig(init);
|
|
|
|
|
+ emplaceRtpConfig(rtpConfig, tr);
|
|
|
|
|
+ // create packetizer
|
|
|
|
|
+ auto maxFragmentSize =
|
|
|
|
|
+ init && init->maxFragmentSize ? init->maxFragmentSize : RTC_DEFAULT_MAX_FRAGMENT_SIZE;
|
|
|
|
|
+ auto packetizer = std::make_shared<VP8RtpPacketizer>(rtpConfig, maxFragmentSize);
|
|
|
|
|
+ track->setMediaHandler(packetizer);
|
|
|
|
|
+ return RTC_ERR_SUCCESS;
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
int rtcSetOpusPacketizer(int tr, const rtcPacketizerInit *init) {
|
|
int rtcSetOpusPacketizer(int tr, const rtcPacketizerInit *init) {
|
|
|
return wrap([&] {
|
|
return wrap([&] {
|
|
|
auto track = getTrack(tr);
|
|
auto track = getTrack(tr);
|
|
@@ -1592,7 +1609,7 @@ int rtcCreateWebSocketEx(const char *url, const rtcWsConfiguration *config) {
|
|
|
else if (config->maxOutstandingPings < 0)
|
|
else if (config->maxOutstandingPings < 0)
|
|
|
c.maxOutstandingPings = 0; // setting to 0 disables, not setting keeps default
|
|
c.maxOutstandingPings = 0; // setting to 0 disables, not setting keeps default
|
|
|
|
|
|
|
|
- if(config->maxMessageSize > 0)
|
|
|
|
|
|
|
+ if (config->maxMessageSize > 0)
|
|
|
c.maxMessageSize = size_t(config->maxMessageSize);
|
|
c.maxMessageSize = size_t(config->maxMessageSize);
|
|
|
|
|
|
|
|
auto webSocket = std::make_shared<WebSocket>(std::move(c));
|
|
auto webSocket = std::make_shared<WebSocket>(std::move(c));
|
|
@@ -1632,7 +1649,7 @@ int rtcGetWebSocketPath(int ws, char *buffer, int size) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int rtcCreateWebSocketServer(const rtcWsServerConfiguration *config,
|
|
int rtcCreateWebSocketServer(const rtcWsServerConfiguration *config,
|
|
|
- rtcWebSocketClientCallbackFunc cb) {
|
|
|
|
|
|
|
+ rtcWebSocketClientCallbackFunc cb) {
|
|
|
return wrap([&] {
|
|
return wrap([&] {
|
|
|
if (!config)
|
|
if (!config)
|
|
|
throw std::invalid_argument("Unexpected null pointer for config");
|
|
throw std::invalid_argument("Unexpected null pointer for config");
|
|
@@ -1650,7 +1667,7 @@ int rtcCreateWebSocketServer(const rtcWsServerConfiguration *config,
|
|
|
c.keyPemPass = config->keyPemPass ? make_optional(string(config->keyPemPass)) : nullopt;
|
|
c.keyPemPass = config->keyPemPass ? make_optional(string(config->keyPemPass)) : nullopt;
|
|
|
c.bindAddress = config->bindAddress ? make_optional(string(config->bindAddress)) : nullopt;
|
|
c.bindAddress = config->bindAddress ? make_optional(string(config->bindAddress)) : nullopt;
|
|
|
|
|
|
|
|
- if(config->maxMessageSize > 0)
|
|
|
|
|
|
|
+ if (config->maxMessageSize > 0)
|
|
|
c.maxMessageSize = size_t(config->maxMessageSize);
|
|
c.maxMessageSize = size_t(config->maxMessageSize);
|
|
|
|
|
|
|
|
auto webSocketServer = std::make_shared<WebSocketServer>(std::move(c));
|
|
auto webSocketServer = std::make_shared<WebSocketServer>(std::move(c));
|