'gstreamer application crash with signal 11
I am working on Gstreamer 1.14.05 on an embedded piece of hardware. I have done up a function (callback) that will name the new record file according to the a fixed recording duration specified - YYMMDD_HHMMSS(start)_HHMMSS(end).mp4(see code)
I have runned the code and I have gotten problem that I believed is related to segmentation fault and I believe somehow it has got to do with this naming
The actual error:
audit: type=1701 audit(1648454527.720:4): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=3032 comm="queue0:src" exe="/home/root/videoTest" sig=11 res=1
Segmentation fault (core dumped)
The segfault happens rather in a haphazard manner, soometimes it happened at the 1st 1-2 intervals (within 60sec). Other times it may take up to 6 mins.
Code:
// helper code to rename file in specified format
using time_pt = std::chrono::system_clock::time_point;
std::string replaceStr(const time_pt& t1,
const time_pt& t2,
const std::string& dir)
{
const std::string format1 = "%Y%m%d_%H%M%S";
const std::string format2 = "%H%M%S";
std::time_t tt1 = std::chrono::system_clock::to_time_t(t1);
std::tm tm = *std::localtime(&tt1);
std::stringstream ss;
ss << dir << "/";
ss << std::put_time( &tm, format1.c_str() );
std::time_t tt2 = std::chrono::system_clock::to_time_t(t2);
tm = *std::localtime(&tt2); //Locale time-zone, usually UTC by default.
ss << "_" << std::put_time( &tm, format2.c_str() ) << ".mp4";
return ss.str();
}
// function to name the video file
gchararray
format_location_callback(GstElement * splitmux,
guint fragment_id,
gpointer udata)
{
// R is a structure for recording data
// this function is called every 30s
R* rec = (R*) udata;
time_pt start = std::chrono::system_clock::now();
time_pt end = start + std::chrono::seconds(30);
rec->last_start = start;
rec->last_split = replaceStr(start, end, "/media/video");
return (rec->last_split).c_str();
}
// the code to install this callback
g_signal_connect (splitmuxsink, "format-location",
(GCallback)format_location_callback,
&rec);
Would appreciate on how else could I proceed to debug on the code and find the error or if you could point out whether the replaceStr function is efficient and bug free
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
