最近用live555做rtsp客户端,修改了Live555自带的openRTSP,能支持多个实例了;
但联1080P的视频流超3路视频就有花屏, 联704×576的16路也有同样的问题,不知道是给解码器视频帧不对,还缺少什么参数,如sps,pps:
在FileSink::afterGettingFrame函数如下:
但联1080P的视频流超3路视频就有花屏, 联704×576的16路也有同样的问题,不知道是给解码器视频帧不对,还缺少什么参数,如sps,pps:
在FileSink::afterGettingFrame函数如下:
void FileSink::afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentation)
{
unsigned char const start_code[4] = {0x00, 0x00, 0x00, 0x01};
if (fHaveWriittenFirstFrame)
{
u_int8_t nal_unit_type = (fBuffer[0]) & 0x1F;
if (nal_unit_type == 5) //IDR
{
printf("\nfind IDR!\n");
addSpsPps();
}
else if (nal_unit_type ==6) //SEI
{
printf("\nfind IDR!\n");
}
else if (nal_unit_type == 7) //sps
{
printf("\nfind IDR!\n");
}
else if (nal_unit_type == 8) //pps
{
printf("\nfind IDR!\n");
}
if ((fPrevPresentationTime.tv_sec != presentationTime.tv_sec
|| fPrevPresentationTime.tv_usec != presentationTime.tv_usec)
&& fOneFrameSeek > 0)
{
sendData(); //关数据到解码器
}
}
else
{
addSpsPps();
fHaveWritenFirstFrame = True;
}
addData(start_code, 4, presentationTime);
addData(fBuffer, frameSize, presentationTime);
continuePlaying();
}
解决方案:25分
确定不是cpu占用率太高导致的?