live555 调优总结
来源:互联网 发布:漫画控不能连接网络 编辑:程序博客网 时间:2024/06/05 20:04
发送优化方面,主要就是调整live555的缓冲区大小和每次发送的数据大小,众所周知,流媒体发送的是各种大小的音视频数据,而这些数据大的几百k,小的就几个字节,如果每一个零散的数据都要走一遍发送循环,对于live555这种单线程的架构来说,性能吃紧,所以做了几点调整:
MediaSink.cpp114行:unsigned OutPacketBuffer::maxSize = 30000;StreamParser.cp宏定义:#define BANK_SIZE 150000,改为2400000;MultiFramedRTPSink.cpp47行:setPacketSizes(1000, 8192);RTPInterface.cpp129行:increaseSendBufferTo(envir(), fGS->socketNum(), 512*1024);//数据累积发送,不再单独发送//注释掉332行,修改为以下://if (!sendDataOverTCP(socketNum, framingHeader, 4, False)) break;//if (!sendDataOverTCP(socketNum, packet, packetSize, True)) break; struct iovec iov[2]; iov[0].iov_base = framingHeader; iov[0].iov_len = 4; iov[1].iov_base = packet; iov[1].iov_len = packetSize; writev(socketNum, iov, 2);
MultiFramedRTPSink.cpp402 行//当前的数据缓冲区如果没有发送完成,就继续发送,不再走一遍live555的eventloop流程,提高效率!#if 0 // We have more frames left to send. Figure out when the next frame // is due to start playing, then make sure that we wait this long before // sending the next packet. struct timeval timeNow; gettimeofday(&timeNow, NULL); int secsDiff = fNextSendTime.tv_sec - timeNow.tv_sec; int64_t uSecondsToGo = secsDiff*1000000 + (fNextSendTime.tv_usec - timeNow.tv_usec); if (uSecondsToGo < 0 || secsDiff < 0) { // sanity check: Make sure that the time-to-delay is non-negative: uSecondsToGo = 0; } if (uSecondsToGo > 0) printf("uSecondsToGo: %d\n", uSecondsToGo); // Delay this amount of time: nextTask() = envir().taskScheduler().scheduleDelayedTask(uSecondsToGo, (TaskFunc*)sendNext, this);#else sendNext(this);#endif
这样几点修改,大大提升了live555在网络数据发送方面的性能
阅读全文
0 0
- live555 调优总结
- 关于live555的总结
- live555库的使用总结
- live555
- live555
- live555
- live555
- live555
- live555
- live555
- live555
- live555
- live555
- LIVE555
- live555
- live555
- LIVE555
- Live555
- 测试计划2
- FastJson对JodaTime的处理
- 整合Spring时Service层为什么不做全局包扫描详解
- 服务器端设计的思想、方法及应用
- Java微信支付全教程demo【公众号支付】
- live555 调优总结
- turtlebot3_Python脚本控制运行
- C++ 获取exe路径
- 7. 并发模式(Go Tutorial)
- 架构architecture篇-----1.docker命令
- DirectShow学习-概述
- 谷歌Cartographer学习(1)-快速安装测试
- android开发如何集成支付宝sdk
- java.lang.NoClassDefFoundError: org.greenrobot.greendao.database.DatabaseOpenHelper$EncryptedHelper