mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
修复对象同名导致的bug
This commit is contained in:
parent
8548753c28
commit
892b2d2ef9
@ -11,6 +11,7 @@
|
||||
#if defined(ENABLE_RTPPROXY)
|
||||
#include "PSEncoder.h"
|
||||
#include "Extension/H264.h"
|
||||
#include "Rtsp/RtspMuxer.h"
|
||||
namespace mediakit{
|
||||
|
||||
PSEncoder::PSEncoder() {
|
||||
@ -147,24 +148,6 @@ void PSEncoder::inputFrame(const Frame::Ptr &frame) {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class RingDelegateHelper : public RingDelegate<RtpPacket::Ptr> {
|
||||
public:
|
||||
typedef function<void(RtpPacket::Ptr in, bool is_key)> onRtp;
|
||||
|
||||
~RingDelegateHelper() override{}
|
||||
RingDelegateHelper(onRtp on_rtp){
|
||||
_on_rtp = std::move(on_rtp);
|
||||
}
|
||||
void onWrite(RtpPacket::Ptr in, bool is_key) override{
|
||||
_on_rtp(std::move(in), is_key);
|
||||
}
|
||||
|
||||
private:
|
||||
onRtp _on_rtp;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PSEncoderImp::PSEncoderImp(uint32_t ssrc, uint8_t payload_type) {
|
||||
|
@ -13,20 +13,6 @@
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
class RingDelegateHelper : public RingDelegate<RtpPacket::Ptr> {
|
||||
public:
|
||||
RingDelegateHelper(RtspMuxer *delegate) {
|
||||
_delegate = delegate;
|
||||
}
|
||||
|
||||
void onWrite(RtpPacket::Ptr in, bool is_key) override {
|
||||
_delegate->onRtp(std::move(in), is_key);
|
||||
}
|
||||
|
||||
private:
|
||||
RtspMuxer *_delegate;
|
||||
};
|
||||
|
||||
void RtspMuxer::onRtp(RtpPacket::Ptr in, bool is_key) {
|
||||
if (_rtp_stamp[in->type] != in->getHeader()->stamp) {
|
||||
//rtp时间戳变化才计算ntp,节省cpu资源
|
||||
@ -51,7 +37,9 @@ RtspMuxer::RtspMuxer(const TitleSdp::Ptr &title) {
|
||||
}
|
||||
_rtpRing = std::make_shared<RtpRing::RingType>();
|
||||
_rtpInterceptor = std::make_shared<RtpRing::RingType>();
|
||||
_rtpInterceptor->setDelegate(std::make_shared<RingDelegateHelper>(this));
|
||||
_rtpInterceptor->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr in, bool is_key) {
|
||||
onRtp(std::move(in), is_key);
|
||||
}));
|
||||
_ntp_stamp_start = getCurrentMillisecond(true);
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,28 @@
|
||||
#include "RtpCodec.h"
|
||||
|
||||
namespace mediakit{
|
||||
|
||||
class RingDelegateHelper : public RingDelegate<RtpPacket::Ptr> {
|
||||
public:
|
||||
typedef function<void(RtpPacket::Ptr in, bool is_key)> onRtp;
|
||||
|
||||
~RingDelegateHelper() override{}
|
||||
RingDelegateHelper(onRtp on_rtp){
|
||||
_on_rtp = std::move(on_rtp);
|
||||
}
|
||||
void onWrite(RtpPacket::Ptr in, bool is_key) override{
|
||||
_on_rtp(std::move(in), is_key);
|
||||
}
|
||||
|
||||
private:
|
||||
onRtp _on_rtp;
|
||||
};
|
||||
|
||||
/**
|
||||
* rtsp生成器
|
||||
*/
|
||||
class RtspMuxer : public MediaSinkInterface{
|
||||
public:
|
||||
friend class RingDelegateHelper;
|
||||
using Ptr = std::shared_ptr<RtspMuxer>;
|
||||
|
||||
/**
|
||||
@ -62,7 +78,6 @@ public:
|
||||
|
||||
private:
|
||||
void onRtp(RtpPacket::Ptr in, bool is_key);
|
||||
void computeNtp(const Frame::Ptr &frame);
|
||||
void trySyncTrack();
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user