Commit efa839c6 by ziyue

确保完全忽略webrtc客户端不支持的rtp

parent 82b78f45
...@@ -33,6 +33,12 @@ void WebRtcPlayer::onStartWebRTC() { ...@@ -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() { ...@@ -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;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论