From 4587f8d5507300782e329f9527f35f905f3bb697 Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期二, 29 十月 2019 14:13:25 +0800 Subject: [PATCH] Merge branch 'master' of ssh://192.168.5.5:29418/valib/goffmpeg --- csrc/worker/rec.hpp | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/csrc/worker/rec.hpp b/csrc/worker/rec.hpp index c802d9a..fc6ba0d 100644 --- a/csrc/worker/rec.hpp +++ b/csrc/worker/rec.hpp @@ -9,6 +9,7 @@ #include "../buz/recorder.hpp" struct AVPacket; +class CPacket; namespace ffwrapper { @@ -24,8 +25,6 @@ private: ffwrapper::FormatIn *recRef_; int min_cache_len_; - // 鏁翠釜娴佺▼鑰楁椂琛ュ伩褰曞埗鏃堕棿,2s榛樿 - const int time_offset_; // 褰曞儚鐨勫疄渚�,瀵瑰簲浠诲姟 std::unordered_map<std::string, std::unique_ptr<buz::Recorder> > map_rec_; // 澶氱嚎绋嬫坊鍔犱换鍔″疄渚�,鍦ㄨ娴佺嚎绋嬩娇鐢ㄥ綍鍍�,浣嗘槸娣诲姞鍦ㄥ彟涓�涓嚎绋� @@ -47,25 +46,28 @@ std::mutex mtx_pkt_; private: + // 鏌ユ壘缂撳瓨涓殑褰曞埗甯� + void findRecFramesIndex(const int64_t &fired_id, const int duration, int &start, int &end); + // 褰曞儚瀹炰緥鐨勫洖璋冨嚱鏁�,褰曞儚瀹屾垚鍚庤缃綍鍍忔枃浠惰矾寰�,id鍜屽抚id void setRecInfo(std::string &id, int &index, std::string &path); // 缂撳瓨瑙嗛鍖� - void cachePacket(std::shared_ptr<ffwrapper::CodedData> data, int64_t &id); + void cachePacket(const CPacket &pkt); // 涓㈠純缂撳瓨 int shrinkCache(); // 鍒涘缓褰曞儚瀹炰緥寮�濮嬪綍鍍� - std::unique_ptr<buz::Recorder> startRec(std::string id, std::string dir, const int mind, const int maxd, const bool audio); + std::unique_ptr<buz::Recorder> startRec(std::string id, std::string dir, const int64_t &frameID, const int mind, const int maxd, const bool audio); // 娓呴櫎缂撳瓨,鏂嚎閲嶈繛鏃堕渶瑕� void clear(); public: - void NewRec(const char* id, const char *output, const int mindur, const int maxdur, const bool audio); + void NewRec(const char* id, const char *output, const int64_t &frameID, const int mindur, const int maxdur, const bool audio); // 鍑嗗濂藉綍鍍� void Load(ffwrapper::FormatIn *in); void Unload(); const bool Loaded() const; // 缂撳瓨褰曞儚鐨勮棰戝寘,绛夊緟瑙﹀彂褰曞儚,鎴栫洿鎺ユ斁鍒板綍鍍忕紦瀛� - void SetPacket(std::shared_ptr<ffwrapper::CodedData> data, int64_t &id); + void SetPacket(const CPacket &pkt); // 瑙﹀彂褰曞儚 void FireRecSignal(const char* sid,const int64_t &id); // 鑾峰彇褰曞儚鏂囦欢璺緞鍜屽抚id -- Gitblit v1.8.0