接收到rtp包

This commit is contained in:
ziyue 2021-04-01 14:16:42 +08:00
parent 9ffa5c2135
commit 1978748f2e
2 changed files with 15 additions and 15 deletions

View File

@ -1294,11 +1294,11 @@ void RtcConfigure::matchMedia(shared_ptr<RtcSession> &ret, TrackType type, const
answer_media.fingerprint = configure.fingerprint; answer_media.fingerprint = configure.fingerprint;
answer_media.ice_lite = configure.ice_lite; answer_media.ice_lite = configure.ice_lite;
switch (offer_media.role) { switch (offer_media.role) {
case DtlsRole::actpass :
case DtlsRole::active : { case DtlsRole::active : {
answer_media.role = DtlsRole::passive; answer_media.role = DtlsRole::passive;
break; break;
} }
case DtlsRole::actpass :
case DtlsRole::passive : { case DtlsRole::passive : {
answer_media.role = DtlsRole::active; answer_media.role = DtlsRole::active;
break; break;

View File

@ -24,6 +24,10 @@ void WebRtcTransport::OnIceServerSelectedTuple(const RTC::IceServer *iceServer,
void WebRtcTransport::OnIceServerConnected(const RTC::IceServer *iceServer) { void WebRtcTransport::OnIceServerConnected(const RTC::IceServer *iceServer) {
InfoL; InfoL;
}
void WebRtcTransport::OnIceServerCompleted(const RTC::IceServer *iceServer) {
InfoL;
if (_answer_sdp->media[0].role == DtlsRole::passive) { if (_answer_sdp->media[0].role == DtlsRole::passive) {
dtls_transport_->Run(RTC::DtlsTransport::Role::SERVER); dtls_transport_->Run(RTC::DtlsTransport::Role::SERVER);
} else { } else {
@ -31,10 +35,6 @@ void WebRtcTransport::OnIceServerConnected(const RTC::IceServer *iceServer) {
} }
} }
void WebRtcTransport::OnIceServerCompleted(const RTC::IceServer *iceServer) {
InfoL;
}
void WebRtcTransport::OnIceServerDisconnected(const RTC::IceServer *iceServer) { void WebRtcTransport::OnIceServerDisconnected(const RTC::IceServer *iceServer) {
InfoL; InfoL;
} }
@ -141,16 +141,6 @@ bool is_rtcp(char *buf) {
} }
void WebRtcTransport::OnInputDataPacket(char *buf, size_t len, RTC::TransportTuple *tuple) { void WebRtcTransport::OnInputDataPacket(char *buf, size_t len, RTC::TransportTuple *tuple) {
if (is_rtp(buf)) {
RtpHeader *header = (RtpHeader *) buf;
InfoL << "rtp:" << header->dumpString(len);
return;
}
if (is_rtcp(buf)) {
RtcpHeader *header = (RtcpHeader *) buf;
// InfoL << "rtcp:" << header->dumpString();
return;
}
if (RTC::StunPacket::IsStun((const uint8_t *) buf, len)) { if (RTC::StunPacket::IsStun((const uint8_t *) buf, len)) {
RTC::StunPacket *packet = RTC::StunPacket::Parse((const uint8_t *) buf, len); RTC::StunPacket *packet = RTC::StunPacket::Parse((const uint8_t *) buf, len);
if (packet == nullptr) { if (packet == nullptr) {
@ -164,6 +154,16 @@ void WebRtcTransport::OnInputDataPacket(char *buf, size_t len, RTC::TransportTup
dtls_transport_->ProcessDtlsData((uint8_t *) buf, len); dtls_transport_->ProcessDtlsData((uint8_t *) buf, len);
return; return;
} }
if (is_rtp(buf)) {
RtpHeader *header = (RtpHeader *) buf;
InfoL << "rtp:" << header->dumpString(len);
return;
}
if (is_rtcp(buf)) {
RtcpHeader *header = (RtcpHeader *) buf;
// InfoL << "rtcp:" << header->dumpString();
return;
}
} }
void WebRtcTransport::WritRtpPacket(char *buf, size_t len) { void WebRtcTransport::WritRtpPacket(char *buf, size_t len) {