mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
预留rtcp相关代码
This commit is contained in:
parent
8c460bfcff
commit
a176cb83a8
@ -186,6 +186,17 @@ void WebRtcTransport::sendRtpPacket(char *buf, size_t len, bool flush) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebRtcTransport::sendRtcpPacket(char *buf, size_t len, bool flush){
|
||||||
|
const uint8_t *p = (uint8_t *) buf;
|
||||||
|
bool ret = false;
|
||||||
|
if (_srtp_session_send) {
|
||||||
|
ret = _srtp_session_send->EncryptRtcp(&p, &len);
|
||||||
|
}
|
||||||
|
if (ret) {
|
||||||
|
onSendSockData((char *) p, len, flush);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
WebRtcTransportImp::Ptr WebRtcTransportImp::create(const EventPoller::Ptr &poller){
|
WebRtcTransportImp::Ptr WebRtcTransportImp::create(const EventPoller::Ptr &poller){
|
||||||
WebRtcTransportImp::Ptr ret(new WebRtcTransportImp(poller), [](WebRtcTransportImp *ptr){
|
WebRtcTransportImp::Ptr ret(new WebRtcTransportImp(poller), [](WebRtcTransportImp *ptr){
|
||||||
@ -389,17 +400,22 @@ void WebRtcTransportImp::onRtp(const char *buf, size_t len) {
|
|||||||
|
|
||||||
void WebRtcTransportImp::onRtcp(const char *buf, size_t len) {
|
void WebRtcTransportImp::onRtcp(const char *buf, size_t len) {
|
||||||
RtcpHeader *rtcp = (RtcpHeader *) buf;
|
RtcpHeader *rtcp = (RtcpHeader *) buf;
|
||||||
|
//todo rtcp相关
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcTransportImp::onSortedRtp(const RtpPayloadInfo &info, RtpPacket::Ptr rtp) {
|
void WebRtcTransportImp::onSortedRtp(const RtpPayloadInfo &info, RtpPacket::Ptr rtp) {
|
||||||
if(!info.is_common_rtp){
|
if(!info.is_common_rtp){
|
||||||
WarnL;
|
WarnL;
|
||||||
}
|
}
|
||||||
_push_src->onWrite(std::move(rtp), true);
|
if (_pli_ticker.elapsedTime() > 2000) {
|
||||||
|
//todo 发送pli
|
||||||
|
_pli_ticker.resetTime();
|
||||||
|
}
|
||||||
|
_push_src->onWrite(std::move(rtp), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcTransportImp::onBeforeSortedRtp(const RtpPayloadInfo &info, const RtpPacket::Ptr &rtp) {
|
void WebRtcTransportImp::onBeforeSortedRtp(const RtpPayloadInfo &info, const RtpPacket::Ptr &rtp) {
|
||||||
|
//todo rtcp相关
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
* @param len rtcp长度
|
* @param len rtcp长度
|
||||||
*/
|
*/
|
||||||
void sendRtpPacket(char *buf, size_t len, bool flush);
|
void sendRtpPacket(char *buf, size_t len, bool flush);
|
||||||
|
void sendRtcpPacket(char *buf, size_t len, bool flush);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//// dtls相关的回调 ////
|
//// dtls相关的回调 ////
|
||||||
@ -152,6 +153,7 @@ private:
|
|||||||
mutable uint8_t _send_rtp_pt[2] = {0, 0};
|
mutable uint8_t _send_rtp_pt[2] = {0, 0};
|
||||||
RtspMediaSourceImp::Ptr _push_src;
|
RtspMediaSourceImp::Ptr _push_src;
|
||||||
unordered_map<uint8_t, RtpPayloadInfo> _rtp_receiver;
|
unordered_map<uint8_t, RtpPayloadInfo> _rtp_receiver;
|
||||||
|
Ticker _pli_ticker;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user