修复webrtc单track功能异常的问题

This commit is contained in:
xiongziliang 2021-07-10 20:36:32 +08:00
parent 76d6e68ecc
commit 99a8154fa5

View File

@ -386,13 +386,27 @@ void WebRtcTransportImp::onSendSockData(const char *buf, size_t len, struct sock
///////////////////////////////////////////////////////////////////
bool WebRtcTransportImp::canSendRtp() const{
auto &sdp = getSdp(SdpType::answer);
return _play_src && (sdp.media[0].direction == RtpDirection::sendrecv || sdp.media[0].direction == RtpDirection::sendonly);
if (!_play_src) {
return false;
}
for (auto &m : getSdp(SdpType::answer).media) {
if (m.direction == RtpDirection::sendrecv || m.direction == RtpDirection::sendonly) {
return true;
}
}
return false;
}
bool WebRtcTransportImp::canRecvRtp() const{
auto &sdp = getSdp(SdpType::answer);
return _push_src && (sdp.media[0].direction == RtpDirection::sendrecv || sdp.media[0].direction == RtpDirection::recvonly);
if (!_push_src) {
return false;
}
for (auto &m : getSdp(SdpType::answer).media) {
if (m.direction == RtpDirection::sendrecv || m.direction == RtpDirection::recvonly) {
return true;
}
}
return false;
}
void WebRtcTransportImp::onStartWebRTC() {