| | |
| | | list_recInfo_.emplace_back(info); |
| | | } |
| | | |
| | | void rec::findRecFramesIndex(const int64_t &fired_id, const int duration, int &start, int &end){ |
| | | void rec::findRecFramesIndex(int64_t &fired_id, const int duration, int &start, int &end){ |
| | | |
| | | start = end = -1; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | // 如果fired_id在startid之前,将其放入start_id之后 |
| | | if (start_id > fired_id) fired_id = start_id + duration / 2; |
| | | |
| | | if (end < 0) end = index; |
| | | } |
| | | |
| | |
| | | std::lock_guard<std::mutex> locker(mtx_pkt_); |
| | | logIt("cache size: %ld", list_pkt_.size()); |
| | | // 首次获取录像信息,先存一个最短时长 |
| | | findRecFramesIndex(frameID, duration, start, end); |
| | | rec->StartWritePacket(list_pkt_, frameID, start, end); |
| | | // maybe fired_id changed by findRecFramesIndex |
| | | int64_t fired_id = frameID; |
| | | findRecFramesIndex(fired_id, duration, start, end); |
| | | rec->StartWritePacket(list_pkt_, fired_id, start, end); |
| | | |
| | | return rec; |
| | | } |