From 30a56cd911261397a6840bfe48f17b23e2374a6d Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期四, 25 七月 2019 17:50:17 +0800
Subject: [PATCH] bug fix
---
csrc/ffmpeg/format/FormatIn.cpp | 12 ++++++++++--
csrc/ffmpeg/format/FormatIn.hpp | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/csrc/ffmpeg/format/FormatIn.cpp b/csrc/ffmpeg/format/FormatIn.cpp
index b0a577b..4df2c0f 100644
--- a/csrc/ffmpeg/format/FormatIn.cpp
+++ b/csrc/ffmpeg/format/FormatIn.cpp
@@ -33,6 +33,7 @@
,io_ctx_(NULL)
,read_io_buff_(NULL)
,read_io_buff_size_(32768)
+ ,handle_gb28181(NULL)
{}
FormatIn::~FormatIn()
@@ -53,6 +54,9 @@
avcodec_close(dec_ctx_);
dec_ctx_ = NULL;
}
+ }
+ if (handle_gb28181){
+ delete handle_gb28181;
}
}
@@ -90,9 +94,13 @@
std::string fn = filename;
//GB28181API gb28181(fn);
- handle_gb28181.addCamera(fn);
+ if (handle_gb28181){
+ delete handle_gb28181;
+ }
+ handle_gb28181 = new GB28181API;
+ handle_gb28181->addCamera(fn);
- int ret = openWithCustomIO((void *)&handle_gb28181, handle_gb28181.readData, options);
+ int ret = openWithCustomIO((void *)&handle_gb28181, handle_gb28181->readData, options);
if(ret < 0){
logIt("do openWithCustomIO failed:%d",ret);
}
diff --git a/csrc/ffmpeg/format/FormatIn.hpp b/csrc/ffmpeg/format/FormatIn.hpp
index 4155aae..a569524 100644
--- a/csrc/ffmpeg/format/FormatIn.hpp
+++ b/csrc/ffmpeg/format/FormatIn.hpp
@@ -63,7 +63,7 @@
AVIOContext *io_ctx_;
uint8_t *read_io_buff_;
const int read_io_buff_size_;
- GB28181API handle_gb28181;
+ GB28181API *handle_gb28181;
};
}
--
Gitblit v1.8.0