Commit 203b583d authored by Mikhail Karpenko's avatar Mikhail Karpenko

Go back to single mmap video buffer

Second mmap to the fixed address in the end of the first mmapped buffer
results in application crash. Do not use double mmapping and process
buffer roll over.
parent e7b3122e
...@@ -73,8 +73,10 @@ int main(int argc, char *argv[]) { ...@@ -73,8 +73,10 @@ int main(int argc, char *argv[]) {
cerr << "|" << (*it).first << "| == |" << (*it).second << "|" << endl; cerr << "|" << (*it).first << "| == |" << (*it).second << "|" << endl;
} }
for (int i = 0; i < SENSOR_PORTS; i++) { for (int i = 0; i < 1; i++) {
// for (int i = 0; i < SENSOR_PORTS; i++) {
pthread_attr_t attr; pthread_attr_t attr;
cout << "Start thread " << i << endl;
streamers[i] = new Streamer(args, i); streamers[i] = new Streamer(args, i);
pthread_attr_init(&attr); pthread_attr_init(&attr);
......
...@@ -420,3 +420,13 @@ bool Socket::send3v(void **v_ptr, int *v_len) { ...@@ -420,3 +420,13 @@ bool Socket::send3v(void **v_ptr, int *v_len) {
return true; return true;
return false; return false;
} }
bool Socket::send_vect(const struct iovec *iov, int num)
{
bool ret_val = false;
if (::writev(fd, iov, num))
ret_val = true;
return ret_val;
}
...@@ -58,6 +58,7 @@ public: ...@@ -58,6 +58,7 @@ public:
bool send(const string data); bool send(const string data);
bool send2v(void **v_ptr, int *v_len); bool send2v(void **v_ptr, int *v_len);
bool send3v(void **v_ptr, int *v_len); bool send3v(void **v_ptr, int *v_len);
bool send_vect(const struct iovec *iov, int num);
static int poll(list<Socket *> &s, int timeout = -1); static int poll(list<Socket *> &s, int timeout = -1);
void listen(int in); void listen(int in);
......
This diff is collapsed.
...@@ -77,7 +77,6 @@ protected: ...@@ -77,7 +77,6 @@ protected:
// struct timeval f_tv; // struct timeval f_tv;
long buffer_length; long buffer_length;
unsigned long *buffer_ptr; unsigned long *buffer_ptr;
unsigned long *buffer_ptr_s; /// Second copy of the circbuf just after the end of the first to prevent rollovers
void *frame_ptr; void *frame_ptr;
int fd_circbuf; int fd_circbuf;
int fd_jpeghead; int fd_jpeghead;
...@@ -85,6 +84,8 @@ protected: ...@@ -85,6 +84,8 @@ protected:
long capture(void); long capture(void);
// bool process(void); // bool process(void);
long process(void); long process(void);
unsigned long get_frame_len(unsigned long offset);
void get_frame_pars(void *frame_pars, unsigned long offset);
// for statistic // for statistic
long v_t_sec; long v_t_sec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment