Ansersion / myRtspClient

A RTSP client based on jrtplib
Apache License 2.0
163 stars 92 forks source link

There is a frame loss situation when using multiple channels #16

Open gczhcm opened 5 years ago

gczhcm commented 5 years ago

In the case of acquiring multiple video streams and one thread per path, there is a phenomenon of frame dropping. By capturing the packet, the machine has received the lost packet, but the program has not received it. Below is my code. bool RtspClient::isPlay() { bool isplay=false; pthread_mutex_lock( &this->playMutex ); if(this->Del==0&&this->used==1) isplay=true; pthread_mutex_unlock( &this->playMutex ); return isplay; } uint32_t timesTamp=0; while( Client->isPlay()) { uint8_t* ret = Client->GetMediaData("video", buf, &size, bufSize,&timesTamp); } I added the get rtp timestamp and found that there is a frame loss situation at 25fps. I use the way of RTSP over TCP to get data. I want to ask the function uint8_t MyRTPTCPSession::GetMyRTPData(uint8_t data_buf, size_t * size, unsigned long timeout_ms) whether it is multi-thread safe image

Ansersion commented 5 years ago

Maybe you can refer to #6 to enlarge the rtp buffer. By the way, MyRTPTCPSession::GetMyRTPData is not multi-thread safe.

gczhcm commented 5 years ago

image how to set buf size of rtp with tcp

gczhcm commented 5 years ago

image there is not tcp

Ansersion commented 5 years ago

I‘ll be appreciate if you can help me to capture the packets with wireshark and send it to ansersion@gmail.com to give me more info to find the problem.