mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-04 09:47:33 +08:00
优化代码
This commit is contained in:
@@ -183,7 +183,8 @@ public:
|
||||
}
|
||||
}
|
||||
bool is_video = rtp->type == TrackVideo;
|
||||
PacketCache<RtpPacket>::inputPacket(is_video, std::move(rtp), keyPos);
|
||||
auto stamp = rtp->timeStamp;
|
||||
PacketCache<RtpPacket>::inputPacket(stamp, is_video, std::move(rtp), keyPos);
|
||||
}
|
||||
|
||||
void clearCache() override{
|
||||
|
||||
@@ -37,17 +37,19 @@ class RtspSession;
|
||||
class BufferRtp : public Buffer{
|
||||
public:
|
||||
typedef std::shared_ptr<BufferRtp> Ptr;
|
||||
BufferRtp(const RtpPacket::Ptr & pkt,uint32_t offset = 0 ):_rtp(pkt),_offset(offset){}
|
||||
virtual ~BufferRtp(){}
|
||||
BufferRtp(Buffer::Ptr pkt, uint32_t offset = 0) : _rtp(std::move(pkt)), _offset(offset) {}
|
||||
~BufferRtp() override{}
|
||||
|
||||
char *data() const override {
|
||||
return (char *)_rtp->data() + _offset;
|
||||
}
|
||||
|
||||
uint32_t size() const override {
|
||||
return _rtp->size() - _offset;
|
||||
}
|
||||
|
||||
private:
|
||||
RtpPacket::Ptr _rtp;
|
||||
Buffer::Ptr _rtp;
|
||||
uint32_t _offset;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user