diff --git a/src/Extension/Frame.h b/src/Extension/Frame.h index 5e4234f7..5e5121f9 100644 --- a/src/Extension/Frame.h +++ b/src/Extension/Frame.h @@ -198,79 +198,15 @@ private: }; -/** - * 帧环形缓存接口类 - */ -class FrameRingInterface : public FrameWriterInterface{ -public: - typedef RingBuffer RingType; - typedef std::shared_ptr Ptr; - - FrameRingInterface(){} - virtual ~FrameRingInterface(){} - - /** - * 获取帧环形缓存 - * @return - */ - virtual RingType::Ptr getFrameRing() const = 0; - - /** - * 设置帧环形缓存 - * @param ring - */ - virtual void setFrameRing(const RingType::Ptr &ring) = 0; -}; - -/** - * 帧环形缓存 - */ -class FrameRing : public FrameRingInterface{ -public: - typedef std::shared_ptr Ptr; - - FrameRing(){ - } - virtual ~FrameRing(){} - - /** - * 获取帧环形缓存 - * @return - */ - RingType::Ptr getFrameRing() const override { - return _frameRing; - } - - /** - * 设置帧环形缓存 - * @param ring - */ - void setFrameRing(const RingType::Ptr &ring) override { - _frameRing = ring; - } - - /** - * 输入数据帧 - * @param frame - */ - void inputFrame(const Frame::Ptr &frame) override{ - if(_frameRing){ - _frameRing->write(frame,frame->keyFrame()); - } - } -protected: - RingType::Ptr _frameRing; -}; - /** * 支持代理转发的帧环形缓存 */ -class FrameRingInterfaceDelegate : public FrameRing { +class FrameDispatcher : public FrameWriterInterface { public: - typedef std::shared_ptr Ptr; + typedef std::shared_ptr Ptr; - FrameRingInterfaceDelegate(){} - virtual ~FrameRingInterfaceDelegate(){} + FrameDispatcher(){} + virtual ~FrameDispatcher(){} void addDelegate(const FrameWriterInterface::Ptr &delegate){ lock_guard lck(_mtx); @@ -287,7 +223,6 @@ public: * @param frame 帧 */ void inputFrame(const Frame::Ptr &frame) override{ - FrameRing::inputFrame(frame); lock_guard lck(_mtx); for(auto &pr : _delegateMap){ pr.second->inputFrame(frame); diff --git a/src/Extension/Track.h b/src/Extension/Track.h index 229a13ea..ccd675e9 100644 --- a/src/Extension/Track.h +++ b/src/Extension/Track.h @@ -39,7 +39,7 @@ namespace mediakit{ /** * 媒体通道描述类,也支持帧输入输出 */ -class Track : public FrameRingInterfaceDelegate , public CodecInfo{ +class Track : public FrameDispatcher , public CodecInfo{ public: typedef std::shared_ptr Ptr; Track(){} diff --git a/src/Player/PlayerProxy.cpp b/src/Player/PlayerProxy.cpp index 2babb7c4..656c9230 100644 --- a/src/Player/PlayerProxy.cpp +++ b/src/Player/PlayerProxy.cpp @@ -207,7 +207,7 @@ void PlayerProxy::onNoneReader(MediaSource &sender) { MediaSourceEvent::onNoneReader(sender); } -class MuteAudioMaker : public FrameRingInterfaceDelegate{ +class MuteAudioMaker : public FrameDispatcher{ public: typedef std::shared_ptr Ptr; @@ -221,7 +221,7 @@ public: auto aacFrame = std::make_shared((char *)MUTE_ADTS_DATA, MUTE_ADTS_DATA_LEN, _iAudioIndex * MUTE_ADTS_DATA_MS); - FrameRingInterfaceDelegate::inputFrame(aacFrame); + FrameDispatcher::inputFrame(aacFrame); } } } diff --git a/src/Rtmp/RtmpCodec.h b/src/Rtmp/RtmpCodec.h index 525a32da..4772a0c1 100644 --- a/src/Rtmp/RtmpCodec.h +++ b/src/Rtmp/RtmpCodec.h @@ -90,7 +90,7 @@ protected: }; -class RtmpCodec : public RtmpRing, public FrameRingInterfaceDelegate , public CodecInfo{ +class RtmpCodec : public RtmpRing, public FrameDispatcher , public CodecInfo{ public: typedef std::shared_ptr Ptr; RtmpCodec(){} diff --git a/src/Rtsp/RtpCodec.h b/src/Rtsp/RtpCodec.h index 7ce212c7..0ea893c8 100644 --- a/src/Rtsp/RtpCodec.h +++ b/src/Rtsp/RtpCodec.h @@ -147,7 +147,7 @@ protected: uint32_t _ui32TimeStamp = 0; }; -class RtpCodec : public RtpRing, public FrameRingInterfaceDelegate , public CodecInfo{ +class RtpCodec : public RtpRing, public FrameDispatcher , public CodecInfo{ public: typedef std::shared_ptr Ptr; RtpCodec(){}