From f346559ee07016172cab40b7fca5b2c5e09df899 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期四, 21 七月 2022 16:13:38 +0800
Subject: [PATCH] bug fixed
---
csrc/wrapper.cpp | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/csrc/wrapper.cpp b/csrc/wrapper.cpp
index e743dcb..e4540b3 100644
--- a/csrc/wrapper.cpp
+++ b/csrc/wrapper.cpp
@@ -110,14 +110,16 @@
VideoProp prop;
prop.url_ = input;
prop.rtsp_tcp_ = true;
- prop.gpu_acc_ = !cpu_;
+ prop.gpu_acc_ = false;
prop.gpu_index_ = devid_;
std::unique_ptr<FormatIn> in(new FormatIn(prop, prop.gpuAccl()));
int flag = -1;
+#ifdef GB28181
if (gb_){
flag = in->openGb28181(input, NULL);
}else{
+#endif
AVDictionary *avdic = prop.optsFormat();
if(avdic){
flag = in->open(input, &avdic);
@@ -125,7 +127,9 @@
}else{
flag = in->open(input, NULL);
}
+#ifdef GB28181
}
+#endif
if(flag == 0){
if(!in->findStreamInfo(NULL)){
@@ -200,11 +204,22 @@
int64_t file_rebootime = 0;
int64_t file_frame = 0;
+ using namespace std;
+ const string gb_suffix[] = {"/StreamType=2", "/StreamType=3", ""};
+ const size_t gb_size = sizeof(gb_suffix) / sizeof(string);
+ int gs_idx = 0;
+ string url = input_url_;
while(!stop_stream_.load()){
- auto in = init_reader(input_url_.c_str());
+ if (gb_){
+ if (input_url_.find("/StreamType=") == string::npos)
+ url = input_url_ + gb_suffix[gs_idx];
+
+ logIt("======>>input real url %s\n", url.c_str());
+ }
+ auto in = init_reader(url.c_str());
if (!in) {
- logIt("ERROR: init_reader! url: %s\n", input_url_.c_str());
+ logIt("ERROR: init_reader! url: %s\n", url.c_str());
sleep(2);
continue;
}
@@ -454,6 +469,7 @@
return flag;
}
+#ifdef GB28181
int GetGb28181Pic(const char *rtspUrl, char *retData, int *retDataLen, const int tt){
int ret = 0;
std::atomic_bool add_camera{false};
@@ -496,5 +512,6 @@
t.detach();
return -1;
}
+#endif
}
--
Gitblit v1.8.0