From bfded635a544a1ab5d252739f4be4f7f30b39b7f Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期五, 26 七月 2019 14:46:48 +0800
Subject: [PATCH] update ffmpeg

---
 csrc/buz/recorder.cpp |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/csrc/buz/recorder.cpp b/csrc/buz/recorder.cpp
index 9a5b985..2267bf3 100644
--- a/csrc/buz/recorder.cpp
+++ b/csrc/buz/recorder.cpp
@@ -17,7 +17,7 @@
 
 namespace cffmpeg_wrap{
     namespace buz{
-        Recorder::Recorder(FormatIn *in)
+        Recorder::Recorder(FormatIn *in, const std::string &id)
         :in_(in)
         ,out_(NULL)
         ,maxduration(30 * 25)
@@ -26,6 +26,7 @@
         ,cur_frame(-1)
         ,thread_(nullptr)
         ,stop_recorder_(false)
+        ,id_(id)
         ,id_frame_(0)
         ,file_frame_index_(-1)
         ,file_path_("")
@@ -59,6 +60,7 @@
 
         void Recorder::start_writer(){
             if (cur_frame == 0) {
+                srandom(time(NULL));
                 file_path_ = dir_ + "/" + std::to_string(random()) + ".mp4";
                 out_->JustWriter(in_->getStream(), file_path_.c_str());
                 logIt("start record %s", file_path_.c_str());
@@ -95,7 +97,10 @@
             }
             //callback to frame index and path
             if(func_rec_info_){
-                func_rec_info_(file_frame_index_, file_path_);
+                func_rec_info_(id_,file_frame_index_, file_path_);
+                // logIt("recoder index %d, file name %s\n", file_frame_index_, file_path_.c_str());
+            }else{
+                // logIt("recorder has no func_rec_info");
             }
         }
 
@@ -222,7 +227,7 @@
 
         void Recorder::maybe_dump_gop(){
             //瓒呰繃min/2,涓㈠純gop
-            while (list_pkt_.size() > minduration) {
+            while (list_pkt_.size() > maxduration) {
                 list_pkt_.pop_front();
                 while(!list_pkt_.empty()){
                     auto &cache = list_pkt_.front();

--
Gitblit v1.8.0