From b3dd7bdf54aff8c85a36d9637258050e68820abd Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期三, 20 七月 2022 16:20:18 +0800
Subject: [PATCH] use gb tcp
---
csrc/wrapper.cpp | 12 ++++++++++--
csrc/thirdparty/gb28181/include/PsToEs.hpp | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/csrc/thirdparty/gb28181/include/PsToEs.hpp b/csrc/thirdparty/gb28181/include/PsToEs.hpp
index 4128360..cd582e5 100644
--- a/csrc/thirdparty/gb28181/include/PsToEs.hpp
+++ b/csrc/thirdparty/gb28181/include/PsToEs.hpp
@@ -43,7 +43,7 @@
pthread_mutex_lock(&mtx);
if (q.empty()) {
gettimeofday(&now, NULL);
- t.tv_sec = now.tv_sec + 3;
+ t.tv_sec = now.tv_sec + 12;
t.tv_nsec = now.tv_usec * 1000;
// pthread_cond_wait(&cond, &mtx);
pthread_cond_timedwait(&cond, &mtx, &t);
diff --git a/csrc/wrapper.cpp b/csrc/wrapper.cpp
index eec65a7..d5d212b 100644
--- a/csrc/wrapper.cpp
+++ b/csrc/wrapper.cpp
@@ -204,11 +204,19 @@
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_){
+ url = input_url_ + gb_suffix[gs_idx];
+ }
+ 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;
}
--
Gitblit v1.8.0