提交 cefc965d authored 作者: blu's avatar blu

big refacting of communitation architect

上级 ac05ab42
...@@ -58,6 +58,7 @@ private: ...@@ -58,6 +58,7 @@ private:
thread thMsgProcessor; thread thMsgProcessor;
string drport = "5549"; string drport = "5549";
json slices; json slices;
int sliceHead = -1, sliceTail = 0;
int handleMsg(vector<vector<uint8_t> > v){ int handleMsg(vector<vector<uint8_t> > v){
int ret = 0; int ret = 0;
...@@ -337,7 +338,8 @@ protected: ...@@ -337,7 +338,8 @@ protected:
while (true) { while (true) {
auto start = chrono::system_clock::now(); auto start = chrono::system_clock::now();
auto end = start; auto end = start;
string name = to_string(chrono::duration_cast<chrono::seconds>(start.time_since_epoch()).count()) + ".mp4"; int ts = chrono::duration_cast<chrono::seconds>(start.time_since_epoch()).count();
string name = to_string(ts) + ".mp4";
name = urlOut + "/" + name; name = urlOut + "/" + name;
ret = avformat_alloc_output_context2(&pAVFormatRemux, NULL, "mp4", name.c_str()); ret = avformat_alloc_output_context2(&pAVFormatRemux, NULL, "mp4", name.c_str());
if (ret < 0) { if (ret < 0) {
...@@ -373,9 +375,16 @@ protected: ...@@ -373,9 +375,16 @@ protected:
spdlog::error("evslicer {} error occurred when opening output file", selfId); spdlog::error("evslicer {} error occurred when opening output file", selfId);
} }
// TODO:
spdlog::info("evslicer {} writing new slice {}", selfId, name.c_str()); spdlog::info("evslicer {} writing new slice {}", selfId, name.c_str());
slices[tail] = name;
tail++;
if(tail >= numSlices) {
tail = 0;
head = 0;
}
slices["tail"] = tail;
slices["head"] = head;
while(chrono::duration_cast<chrono::seconds>(end-start).count() < minutes * 60) { while(chrono::duration_cast<chrono::seconds>(end-start).count() < minutes * 60) {
if(checkStop() == true) { if(checkStop() == true) {
bStopSig = true; bStopSig = true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论