mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-03 08:57:32 +08:00
webrtc是否允许发送rtp逻辑移至基类
This commit is contained in:
@@ -33,12 +33,6 @@ void WebRtcPlayer::onStartWebRTC() {
|
||||
CHECK(_play_src);
|
||||
WebRtcTransportImp::onStartWebRTC();
|
||||
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);
|
||||
_reader = _play_src->getRing()->attach(getPoller(), true);
|
||||
weak_ptr<WebRtcPlayer> weak_self = static_pointer_cast<WebRtcPlayer>(shared_from_this());
|
||||
@@ -49,7 +43,7 @@ void WebRtcPlayer::onStartWebRTC() {
|
||||
}
|
||||
size_t i = 0;
|
||||
pkt->for_each([&](const RtpPacket::Ptr &rtp) {
|
||||
strongSelf->beforeSendRtp(rtp, ++i == pkt->size());
|
||||
strongSelf->onSendRtp(rtp, ++i == pkt->size());
|
||||
});
|
||||
});
|
||||
_reader->setDetachCB([weak_self]() {
|
||||
@@ -91,10 +85,3 @@ void WebRtcPlayer::onRtcConfigure(RtcConfigure &configure) const {
|
||||
configure.audio.direction = configure.video.direction = RtpDirection::sendonly;
|
||||
configure.setPlayRtspInfo(_play_src->getSdp());
|
||||
}
|
||||
|
||||
void WebRtcPlayer::beforeSendRtp(const RtpPacket::Ptr &rtp, bool flush, bool rtx) {
|
||||
if (!_can_send_rtp[rtp->type]) {
|
||||
return;
|
||||
}
|
||||
onSendRtp(rtp, flush, rtx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user