on multithreading, when i try connect rstp url that increase connection time
Hello.
I've make program for multi-viewer of RTSP signal, using OpenCV v3.4.4, C++, on Windows.
So, I've make like this. 1 thread - 1 connection, x8.
But, I the result was not seems to be the thread are independent.
The reason of why, on each thread when connection, the connection time increase.
This is my codes,
wsprintf(m_log, TEXT("[connection start]"), m_rtspNum + 1, m_RtspUrlw);
OutputDebugString(m_log);
DWORD currtime = GET_7FFE008CLOCK_MILLISEC;
if (m_vc) // m_vc = new VideoCapture(); was do on constructor.
m_vc->open(m_RtspUrl);
DWORD diff = GET_7FFE008CLOCK_MILLISEC - currtime;
wsprintf(m_log, TEXT("[connection end - takes(%d)ms]"), diff);
OutputDebugString(m_log);
The result of time diff was not same or similar each threads. Please see the below
Ex) Status - 4Threads, RTSP URL all invalid( RTSP Server is not alive)
- 1st Thread 1st connection try - 30 sec // .. not connected and try to connect again until when it connected.
- 2st Thread 1st connection try - 60 sec
- 3st Thread 1st connection try - 90 sec
- 4st Thread 1st connection try - 120 sec
- 1st Thread 2st connection try- 120 sec
- 2st Thread 2st connection try- 120 sec
- 3st Thread 2st connection try- 120 sec
- 4st Thread 2st connection try- 120 sec .... After all now, it takes 120sec.
Status - 4Threads, RTSP URL all valid( RTSP Server is alive)
- 1st Thread 1st connection try - 3 sec .. connected then get frame and draw on window.
- 2st Thread 1st connection try - 6 sec
- 3st Thread 1st connection try - 8 sec
- 4st Thread 1st connection try - 12 sec
Please Help me.
I want to make like independent connection on thread.