优化接口

This commit is contained in:
xiongziliang
2018-10-25 16:55:48 +08:00
parent 0839ddb681
commit 3d83a236b6
10 changed files with 20 additions and 26 deletions

View File

@@ -76,6 +76,7 @@ public:
}
}
virtual void onGetMetaData(const AMFValue &metadata) {
lock_guard<recursive_mutex> lock(_mtxMap);
_metadata = metadata;
@@ -88,7 +89,8 @@ public:
_bAsyncRegist = true;
}
}
virtual void onGetMedia(const RtmpPacket::Ptr &pkt) {
void onWrite(const RtmpPacket::Ptr &pkt,bool isKey = true) override {
lock_guard<recursive_mutex> lock(_mtxMap);
if (pkt->isCfgFrame()) {
_mapCfgFrame.emplace(pkt->typeId, pkt);
@@ -107,10 +109,6 @@ private:
lock_guard<recursive_mutex> lock(_mtxMap);
return _iCfgFrameSize != -1 && _iCfgFrameSize == _mapCfgFrame.size();
}
void onWrite(const RtmpPacket::Ptr &pkt,bool isKey = true) override {
onGetMedia(pkt);
}
protected:
AMFValue _metadata;
unordered_map<int, RtmpPacket::Ptr> _mapCfgFrame;