当前位置:网站首页>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;
}
边栏推荐
- Application of ultra pure water particle counter in electronic semiconductors
- Improve lighting C program
- PMSM dead time compensation
- C WinForm [view status bar -- statusstrip] - Practice 2
- Shape template matching based on Halcon learning [vi] find_ mirror_ dies. Hdev routine
- C WinForm [realize the previous and next selection pictures] - practice 7
- Screen record of the opening ceremony of the Beijing winter olympics 2
- Shape template matching based on Halcon learning [v] find_ cocoa_ packages_ max_ deformation. Hdev routine
- Global and Chinese market of resistivity meter 2022-2028: Research Report on technology, participants, trends, market size and share
- Halcon's practice based on shape template matching [2]
猜你喜欢
Drive LED -- GPIO control
软件设计师:03-数据库系统
Altium Designer 19.1.18 - 更改铺铜的透明度
VESC Benjamin test motor parameters
Basic embedded concepts
Relationship between line voltage and phase voltage, line current and phase current
Network communication model -- Network OSI tcp/ip layering
C WinForm [get file path -- traverse folder pictures] - practical exercise 6
C WinForm [help interface - send email] - practice five
C WinForm [change the position of the form after running] - Practical Exercise 4
随机推荐
Ads usage skills
Factors affecting the quality of slip rings in production
MySQL - storage engine
Altium designer 19.1.18 - change the transparency of copper laying
Consul installation
Altium Designer 19.1.18 - 隐藏某一个网络的飞线
Extern keyword function
MLPerf Training v2.0 榜单发布,在同等GPU配置下百度飞桨性能世界第一
Linked list (establishment, deletion, insertion and printing of one-way linked list)
找不到实时聊天软件?给你推荐电商企业都在用的!
Global and Chinese market of urban rail connectors 2022-2028: Research Report on technology, participants, trends, market size and share
1089 insert or merge, including test point 5
UEFI development learning 6 - creation of protocol
Use of orbbec Astra depth camera of OBI Zhongguang in ROS melody
UEFI development learning series
Network communication model -- Network OSI tcp/ip layering
Global and Chinese markets for recycled boilers 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for waste treatment air switches 2022-2028: Research Report on technology, participants, trends, market size and share
Shape template matching based on Halcon learning [VII] reuse_ model. Hdev routine
The printer encountered an abnormal configuration problem 0x8007007e (win10)