当前位置:网站首页>Live555 push RTSP audio and video stream summary (III) flower screen problem caused by pushing H264 real-time stream
Live555 push RTSP audio and video stream summary (III) flower screen problem caused by pushing H264 real-time stream
2022-07-05 08:00:00 【Drink more hot water-】
live555 do RTSP Server When pushing real-time streams , The solution to the flower screen problem
There should be many places that can be optimized , At present, only 3 Strategy solutions :
Due to live555 The complex classes in the error are very unfamiliar , These are the conclusions after simple debugging :
1.StreamParser.cpp
As I understand it , This parameter represents a frame H264 The size of the data , Default 150K, If the resolution is large , It is likely to exceed the size , Maybe every frame will lose data and splash the screen ---------> But I just changed ; There is no actual change to large resolution verification
#define BANK_SIZE 800000 //300 -> 800
2. modify maxSize size
OutPacketBuffer::maxSize = 1000000; //
stay H264FramedLiveSource::doGetNextFrame() in , It's usually right H264 Do the operation of memory copy :
memcpy(fTo ,video_buf,fMaxSize);
fTo yes live555 Released pointer , The maximum memory it points to is maxSize , With every turn fTo Copy the data ,fMaxSize From maxSize Slowly decrease , until 0, Then point to another maxSize Size of memory
therefore What I see is : take maxSize The size is from 200k increase , You will find that the problem of flower screen has been improved , however , It will still spend dozens of seconds
3. utilize FrameSource Medium fNumTruncatedBytescans
And then the last one :, With every turn fTo Copy the data ,fMaxSize From maxSize Slowly decrease , until 0, Then point to another maxSize Size of memory , So in fTo Of buf When it is about to run out , The last frame H264 The data can't be put , Will put the data that can't be put , I threw it away manually , Then it's time to spend the screen ! Meow
that fNumTruncatedBytescans yes FrameSource One of the parameters in , It means the number of discarded bags , But in fact, direct operation of it has no effect . Only one number can be customized to implement my idea :
every time fTo When exhausted , Save the lost data locally , Next callback doGetNextFrame() when , First write in the lost data , Then write this time 264 Put the bag in the back .
because H264 Yes, there is NALU Of , There are strict head and tail marks ; So it seems OK Of
then ,live555 Of buf Not directly fTo the buf, Not this buf Only one frame of data can be saved , This is also the wrong idea before
Upper pseudo code :
void H264FramedLiveSource::doGetNextFrame()
{
int ret = 0;
int h264_total_size = 0;
int64_t timeStamp;
unsigned char video_buf[MAX_VDATA_SIZE];
memset(video_buf,0,sizeof(video_buf));
getH264Data(&h264_total_size,&timeStamp ,video_buf);
if(h264_total_size > fMaxSize) {
// buff Exhausted frames
memcpy(fTo ,video_buf,fMaxSize);
memcpy(truncatedBytes, video_buf+fMaxSize,h264_total_size-fMaxSize);
fNumTruncatedBytes = h264_total_size - fMaxSize;
NumTruncatedBytes = h264_total_size - fMaxSize;
fFrameSize = fMaxSize;
}
else
{
if(NumTruncatedBytes != 0)
{
memcpy(fTo ,truncatedBytes,NumTruncatedBytes);
memcpy(fTo+NumTruncatedBytes ,video_buf,h264_total_size);
fFrameSize = h264_total_size+NumTruncatedBytes;
fNumTruncatedBytes = 0;
NumTruncatedBytes = 0;
memset(truncatedBytes,0,sizeof(truncatedBytes));
}
else
{
memset(truncatedBytes,0,sizeof(truncatedBytes));
memcpy(fTo ,video_buf,h264_total_size);
fFrameSize = h264_total_size;
fNumTruncatedBytes = 0;
NumTruncatedBytes = 0;
}
}
FramedSource::afterGetting(this);
return;
}
边栏推荐
- Hardware 3 -- function of voltage follower
- The printer encountered an abnormal configuration problem 0x8007007e (win10)
- Detailed explanation of pragma usage
- Programming knowledge -- basis of C language
- Volatile of C language
- Basic embedded concepts
- Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world
- Connection mode - bridge and net
- Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
- Process communication mode between different hosts -- socket
猜你喜欢
![C WinForm [get file path -- traverse folder pictures] - practical exercise 6](/img/8b/1e470de4e4ecd4fd1bb8e5cf23f466.jpg)
C WinForm [get file path -- traverse folder pictures] - practical exercise 6

C language uses arrays to realize the intersection, union, difference and complement of sets

Beijing Winter Olympics opening ceremony display equipment record 3
![Measurement fitting based on Halcon learning [III] PM_ measure_ board. Hdev routine](/img/f9/fc4f0bbce36b3c1368d838d723b027.jpg)
Measurement fitting based on Halcon learning [III] PM_ measure_ board. Hdev routine

Altium Designer 19.1.18 - 更改铺铜的透明度

Extended application of single chip microcomputer-06 independent key

Hardware 1 -- relationship between gain and magnification

如何进行导电滑环选型

Cadence simulation encountered "input.scs": can not open input file change path problem

Use of orbbec Astra depth camera of OBI Zhongguang in ROS melody
随机推荐
C WinForm [exit application] - practice 3
Gradle复合构建
Altium designer 19.1.18 - hide the fly line of a network
Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
Create inf module in AMI code
TCP and UDP
Global and Chinese market of quenching furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
[professional literacy] specific direction of analog integrated circuits
C language uses arrays to realize the intersection, union, difference and complement of sets
IC software learning
The research found that the cross-border e-commerce customer service system has these five functions!
Connection mode - bridge and net
C language # and #
Communication standard -- communication protocol
Shape template matching based on Halcon learning [viii] PM_ multiple_ models. Hdev routine
Baiwen 7-day smart home learning experience of Internet of things
Network port usage
Altium designer learning (I)
MLPerf Training v2.0 榜单发布,在同等GPU配置下百度飞桨性能世界第一
研究發現,跨境電商客服系統都有這五點功能!