mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-07 04:08:13 +08:00
优化代码
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "Common/config.h"
|
||||
#include "RtmpPlayer.h"
|
||||
#include "RtmpParser.h"
|
||||
#include "RtmpMediaSource.h"
|
||||
#include "Poller/Timer.h"
|
||||
#include "Util/TimeTicker.h"
|
||||
|
||||
@@ -62,6 +63,10 @@ public:
|
||||
private:
|
||||
//派生类回调函数
|
||||
bool onCheckMeta(AMFValue &val) override {
|
||||
m_pRtmpMediaSrc = dynamic_pointer_cast<RtmpMediaSource>(m_pMediaSrc);
|
||||
if(m_pRtmpMediaSrc){
|
||||
m_pRtmpMediaSrc->onGetMetaData(val);
|
||||
}
|
||||
try {
|
||||
m_parser.reset(new RtmpParser(val));
|
||||
m_parser->setOnVideoCB(m_onGetVideoCB);
|
||||
@@ -69,14 +74,20 @@ private:
|
||||
return true;
|
||||
} catch (std::exception &ex) {
|
||||
WarnL << ex.what();
|
||||
return false;
|
||||
return m_pRtmpMediaSrc ? true : false;
|
||||
}
|
||||
}
|
||||
void onMediaData(const RtmpPacket::Ptr &chunkData) override {
|
||||
if(m_parser){
|
||||
m_parser->inputRtmp(chunkData);
|
||||
}
|
||||
if(m_pRtmpMediaSrc){
|
||||
m_pRtmpMediaSrc->onGetMedia(chunkData);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
RtmpMediaSource::Ptr m_pRtmpMediaSrc;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user