mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
优化代码
This commit is contained in:
parent
3c935e7fdd
commit
ce04a7279c
@ -102,7 +102,7 @@ void WebRtcTransport::setRemoteDtlsFingerprint(const RtcSession &remote){
|
|||||||
_dtls_transport->SetRemoteFingerprint(remote_fingerprint);
|
_dtls_transport->SetRemoteFingerprint(remote_fingerprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcTransport::onCheckSdp(SdpType type, RtcSession &sdp) const{
|
void WebRtcTransport::onCheckSdp(SdpType type, RtcSession &sdp){
|
||||||
for (auto &m : sdp.media) {
|
for (auto &m : sdp.media) {
|
||||||
if (m.type != TrackApplication && !m.rtcp_mux) {
|
if (m.type != TrackApplication && !m.rtcp_mux) {
|
||||||
throw std::invalid_argument("只支持rtcp-mux模式");
|
throw std::invalid_argument("只支持rtcp-mux模式");
|
||||||
@ -292,7 +292,7 @@ void WebRtcTransportImp::onStartWebRTC() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcTransportImp::onCheckSdp(SdpType type, RtcSession &sdp) const{
|
void WebRtcTransportImp::onCheckSdp(SdpType type, RtcSession &sdp){
|
||||||
WebRtcTransport::onCheckSdp(type, sdp);
|
WebRtcTransport::onCheckSdp(type, sdp);
|
||||||
if (type != SdpType::answer || !canSendRtp()) {
|
if (type != SdpType::answer || !canSendRtp()) {
|
||||||
return;
|
return;
|
||||||
|
@ -79,7 +79,7 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
virtual void onStartWebRTC() = 0;
|
virtual void onStartWebRTC() = 0;
|
||||||
virtual void onRtcConfigure(RtcConfigure &configure) const {}
|
virtual void onRtcConfigure(RtcConfigure &configure) const {}
|
||||||
virtual void onCheckSdp(SdpType type, RtcSession &sdp) const;
|
virtual void onCheckSdp(SdpType type, RtcSession &sdp);
|
||||||
virtual void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) = 0;
|
virtual void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) = 0;
|
||||||
|
|
||||||
virtual void onRtp(const char *buf, size_t len) = 0;
|
virtual void onRtp(const char *buf, size_t len) = 0;
|
||||||
@ -125,7 +125,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void onStartWebRTC() override;
|
void onStartWebRTC() override;
|
||||||
void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) override;
|
void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) override;
|
||||||
void onCheckSdp(SdpType type, RtcSession &sdp) const override;
|
void onCheckSdp(SdpType type, RtcSession &sdp) override;
|
||||||
void onRtcConfigure(RtcConfigure &configure) const override;
|
void onRtcConfigure(RtcConfigure &configure) const override;
|
||||||
|
|
||||||
void onRtp(const char *buf, size_t len) override;
|
void onRtp(const char *buf, size_t len) override;
|
||||||
@ -153,14 +153,20 @@ private:
|
|||||||
void onBeforeSortedRtp(const RtpPayloadInfo &info,const RtpPacket::Ptr &rtp);
|
void onBeforeSortedRtp(const RtpPayloadInfo &info,const RtpPacket::Ptr &rtp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t _recv_video_ssrc;
|
//pli rtcp计时器
|
||||||
mutable uint8_t _send_rtp_pt[2] = {0, 0};
|
|
||||||
Ticker _pli_ticker;
|
Ticker _pli_ticker;
|
||||||
|
//rtc rtp推流的视频ssrc
|
||||||
|
uint32_t _recv_video_ssrc;
|
||||||
|
//记录协商的rtp的pt类型
|
||||||
|
uint8_t _send_rtp_pt[2] = {0, 0};
|
||||||
|
//复合udp端口,接收一切rtp与rtcp
|
||||||
Socket::Ptr _socket;
|
Socket::Ptr _socket;
|
||||||
RtcSession _answer_sdp;
|
//推流或播放的rtsp源
|
||||||
RtspMediaSource::Ptr _src;
|
RtspMediaSource::Ptr _src;
|
||||||
RtspMediaSource::RingType::RingReader::Ptr _reader;
|
RtspMediaSource::RingType::RingReader::Ptr _reader;
|
||||||
|
//根据rtp的pt获取相关信息
|
||||||
unordered_map<uint8_t, RtpPayloadInfo> _rtp_info_pt;
|
unordered_map<uint8_t, RtpPayloadInfo> _rtp_info_pt;
|
||||||
|
//根据推流端rtp的ssrc获取相关信息
|
||||||
unordered_map<uint32_t, RtpPayloadInfo*> _rtp_info_ssrc;
|
unordered_map<uint32_t, RtpPayloadInfo*> _rtp_info_ssrc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user