在做live555 直播的时候，输入的图片尺寸是320*240 的时候，live555 输出的RTSP数据流可以正常解码，运行没有出现异常现象，但是把图片尺寸改为640*480的时候，就出现了问题：
MultiFramedRTPSink::afterGettingFrame1(): The input frame data was too large for our buffer size (100452). 13457 bytes of trailing data was dropped! Correct this by increasing "OutPacketBuffer::maxSize" to at least 113457, *before* creating this 'RTPSink'. (Current value is 100000.)
/BUFFER SIZE PROBLEM///
Generally, while running HD stream, one can face packet loss due to ridiculously large NAL units. This will create an error stating something like ->
“MultiFramedRTPSink::afterGettingFrame1(): The input frame data was too large for our buffer size (60753). 34086 bytes of trailing data was dropped! Correct this by increasing "OutPacketBuffer::maxSize" to at least 94839, *before* creating this 'RTPSink'. (Current value is 60000.)”
To solve this, you need to make the following changes to your code:
1. Go to “live/liveMedia/MultiFramedRTPsource.cpp” and change “increaseRecieveBufferTo(env, RTPgs-> socketNUm(), 2000000)”
2. Go to “live/liveMedia/StreamParser.cpp” and increase BANK_SIZE to 300000 or 600000.
(This will also help remove StreamParser Error that you might encounter!)
3. In “live/liveMedia/MediaSink.cpp” change the value of unsigned OutPacketBuffer::max size to 600000.
4. In “mediaServer/DynamicRTSPServer.cpp”, change OutPacketBuffer::maxSize to 600000 at all places where it is defined.
5. *Most importantly, you need to change the code in your own program, more so than the libraries themselves. This means that if you just do what pt.5 tells you to, you can avoid pts 1-4. Therefore, in your code change OutPacketBuffer::maxsize to 600000 (Our code file is testH264VideoStreamer.cpp so we made the above change in that. Note: testH264VideoStreamer.cpp lies in testProgs directory). You NEED to change this value in your code before you create any RTP sinks.
6. Also to allow for more holistic changes, go to “testProgs/playCommon.cpp” and change the value of fileSinkBufferSize to 600000.
///WHAT ELSE CAN BE DONE
It is more advisable to reduce the buffer size of your stream by increasing compression levels. Also you would need to increase the buffer size of vlc player to allow for smooth streaming. To do so, go to VLC-> Tools -> Preferences -> Select “Show All” -> Click on Stream Output -> Change “stream output muxer caching” to a suitable value in ms. (1500 - 3000)
与此同时，在我做的H264 直播工程中， 还需要设置const unsigned estimatedSessionBandwidth 的值，需要把它调到一个合适大小的值。