修复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{ bool WebRtcTransportImp::canSendRtp() const{
auto &sdp = getSdp(SdpType::answer); if (!_play_src) {
return _play_src && (sdp.media[0].direction == RtpDirection::sendrecv || sdp.media[0].direction == RtpDirection::sendonly); 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{ bool WebRtcTransportImp::canRecvRtp() const{
auto &sdp = getSdp(SdpType::answer); if (!_push_src) {
return _push_src && (sdp.media[0].direction == RtpDirection::sendrecv || sdp.media[0].direction == RtpDirection::recvonly); 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() { void WebRtcTransportImp::onStartWebRTC() {