mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
确保完全忽略webrtc客户端不支持的rtp
This commit is contained in:
parent
82b78f4544
commit
efa839c60b
@ -33,6 +33,12 @@ void WebRtcPlayer::onStartWebRTC() {
|
|||||||
CHECK(_play_src);
|
CHECK(_play_src);
|
||||||
WebRtcTransportImp::onStartWebRTC();
|
WebRtcTransportImp::onStartWebRTC();
|
||||||
if (canSendRtp()) {
|
if (canSendRtp()) {
|
||||||
|
//确保该rtp codec类型对方支持
|
||||||
|
memset(_can_send_rtp, 0, sizeof(_can_send_rtp));
|
||||||
|
for (auto &m : _answer_sdp->media) {
|
||||||
|
_can_send_rtp[m.type] = m.direction == RtpDirection::sendonly || m.direction == RtpDirection::sendrecv;
|
||||||
|
}
|
||||||
|
|
||||||
_play_src->pause(false);
|
_play_src->pause(false);
|
||||||
_reader = _play_src->getRing()->attach(getPoller(), true);
|
_reader = _play_src->getRing()->attach(getPoller(), true);
|
||||||
weak_ptr<WebRtcPlayer> weak_self = static_pointer_cast<WebRtcPlayer>(shared_from_this());
|
weak_ptr<WebRtcPlayer> weak_self = static_pointer_cast<WebRtcPlayer>(shared_from_this());
|
||||||
@ -53,12 +59,6 @@ void WebRtcPlayer::onStartWebRTC() {
|
|||||||
}
|
}
|
||||||
strongSelf->onShutdown(SockException(Err_shutdown, "rtsp ring buffer detached"));
|
strongSelf->onShutdown(SockException(Err_shutdown, "rtsp ring buffer detached"));
|
||||||
});
|
});
|
||||||
|
|
||||||
//确保该rtp codec类型对方支持
|
|
||||||
memset(_can_send_rtp, 0, sizeof(_can_send_rtp));
|
|
||||||
for (auto &m : _answer_sdp->media) {
|
|
||||||
_can_send_rtp[m.type] = m.direction == RtpDirection::sendonly || m.direction == RtpDirection::sendrecv;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//使用完毕后,释放强引用,这样确保推流器断开后能及时注销媒体
|
//使用完毕后,释放强引用,这样确保推流器断开后能及时注销媒体
|
||||||
_play_src = nullptr;
|
_play_src = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user