From 1518fb1f0e59beedfa32663adb3d0bee302f1ad5 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期五, 26 七月 2019 10:42:26 +0800
Subject: [PATCH] bug fix
---
apipassive.go | 6 +++---
csrc/wrapper.cpp | 1 +
csrc/cffmpeg.cpp | 2 +-
csrc/buz/recorder.cpp | 5 ++++-
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/apipassive.go b/apipassive.go
index 84dfda5..769c01f 100644
--- a/apipassive.go
+++ b/apipassive.go
@@ -26,10 +26,10 @@
var l C.int
p := C.wrap_fn_info_recorder(h.ffmpeg, &i, &l)
- if i == -1 {
+ if p == nil {
return -1, ""
}
- defer C.free(unsafe.Pointer(p))
+ C.free(unsafe.Pointer(p))
return int(i), C.GoString(p)
}
@@ -71,4 +71,4 @@
k := int(key)
return d, s, k
-}
\ No newline at end of file
+}
diff --git a/csrc/buz/recorder.cpp b/csrc/buz/recorder.cpp
index 9a5b985..30bf17a 100644
--- a/csrc/buz/recorder.cpp
+++ b/csrc/buz/recorder.cpp
@@ -96,6 +96,9 @@
//callback to frame index and path
if(func_rec_info_){
func_rec_info_(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 +225,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();
diff --git a/csrc/cffmpeg.cpp b/csrc/cffmpeg.cpp
index 423ef01..cbb0b1f 100644
--- a/csrc/cffmpeg.cpp
+++ b/csrc/cffmpeg.cpp
@@ -63,7 +63,7 @@
int i;
std::string p;
s->GetInfoRecorder(i, p);
- if(i < 0){
+ if(p.empty()){
return NULL;
}
*index = i;
diff --git a/csrc/wrapper.cpp b/csrc/wrapper.cpp
index 72fda1d..82c5141 100644
--- a/csrc/wrapper.cpp
+++ b/csrc/wrapper.cpp
@@ -277,6 +277,7 @@
info.file_frame_index = index;
info.file_path = path;
list_rec_.emplace_back(info);
+ logIt("list rec files count : %d", list_rec_.size());
}
}
--
Gitblit v1.8.0