- unsigned StreamEncoder::maxFrameSize() const {
- return 80 * 1024;
- }
复制代码
这段代码限制了单帧最大为80k,往fOutBuffer里面填充帧的时候进来的帧大于80K且fOutBufferSize又大于80k但是小余进来的帧size的时候神奇的一幕出现了,码流大到一定值时客户端卡死,直到码流变小。- void StreamEncoder::copy_to_outputbuffer(void)
- {
- memmove(fOutputBuffer, dstbuf, dstsize);
- fNumValidDataBytes += dstsize;
- fOutputBuffer += dstsize;
- fTotOfFrameToSend++;
- if(dstbuf != NULL)
- free(dstbuf);
- }
- void StreamEncoder::continueReadProcessing1(unsigned frameSize,unsigned numTruncatedBytes,
- struct timeval presentationTime,
- unsigned durationInMicroseconds){
- fNumTruncatedBytes = numTruncatedBytes;
- fPresentationTime = presentationTime;
- fDurationInMicroseconds = durationInMicroseconds;
- encoder_to_h264();
- if(fNumValidDataBytes+dstsize<fOutputBufferSize && fTotOfFrameToSend<fMaxOfFrameToSend)
- {
- copy_to_outputbuffer();
- }
-
- fFrameSize = fNumValidDataBytes;
- gettimeofday(&fPresentationTime, NULL);
- reset();
- FramedSource::afterGetting(this);
- }
复制代码
- unsigned StreamEncoder::maxFrameSize() const {
- return 180 * 1024;
- }
复制代码
欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |