mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
Fix a bug in WebRTC where the DTLS certificate is too large(big than MTU) (#3250)
This commit is contained in:
parent
f9da87eb5d
commit
62641f426b
@ -201,9 +201,26 @@ void WebRtcTransport::OnDtlsTransportConnected(
|
|||||||
onStartWebRTC();
|
onStartWebRTC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
struct DtlsHeader {
|
||||||
|
uint8_t content_type;
|
||||||
|
uint16_t dtls_version;
|
||||||
|
uint16_t epoch;
|
||||||
|
uint8_t seq[6];
|
||||||
|
uint16_t length;
|
||||||
|
uint8_t payload[1];
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
void WebRtcTransport::OnDtlsTransportSendData(
|
void WebRtcTransport::OnDtlsTransportSendData(
|
||||||
const RTC::DtlsTransport *dtlsTransport, const uint8_t *data, size_t len) {
|
const RTC::DtlsTransport *dtlsTransport, const uint8_t *data, size_t len) {
|
||||||
sendSockData((char *)data, len, nullptr);
|
size_t offset = 0;
|
||||||
|
while(offset < len) {
|
||||||
|
auto *header = reinterpret_cast<const DtlsHeader *>(data + offset);
|
||||||
|
auto length = ntohs(header->length) + offsetof(DtlsHeader, payload);
|
||||||
|
sendSockData((char *)data + offset, length, nullptr);
|
||||||
|
offset += length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcTransport::OnDtlsTransportConnecting(const RTC::DtlsTransport *dtlsTransport) {
|
void WebRtcTransport::OnDtlsTransportConnecting(const RTC::DtlsTransport *dtlsTransport) {
|
||||||
|
Loading…
Reference in New Issue
Block a user