live555源码阅读笔记

live555大致可以看成是2部分,一部分是sink,一部分是source。当然还有一部分是建立服务器的media部分不用看。

source是video进来,sink是出去。

在liveMedia/RTPInterface.cpp中:

Boolean RTPInterface::sendPacket(unsigned char* packet, unsigned packetSize) {
  Boolean success = True; // we'll return False instead if any of the sends fail

  //由此可见下面是UDP推流
  // Normal case: Send as a UDP packet:
  if (!fGS->output(envir(), packet, packetSize)) success = False;

  // Also, send over each of our TCP sockets:
  //下面是TCP推流,注释掉下面的代码可以只用UDP发送
  #if 0 
  tcpStreamRecord* nextStream;
  for (tcpStreamRecord* stream = fTCPStreams; stream != NULL; stream = nextStream) {
    nextStream = stream->fNext; // Set this now, in case the following deletes "stream":
    if (!sendRTPorRTCPPacketOverTCP(packet, packetSize,
				    stream->fStreamSocketNum, stream->fStreamChannelId)) {
      success = False;
    }
  }
#endif
  return success;
}

live555推流默认是UDP,TCP两个通道同时推流的,所以在拉流的客户端,你用TCP也好UDP也好都是能拉流成功的。但是TCP有可能会挂包,导致中断重连,可以选择注释掉。

 

参考:

https://www.programmersought.com/article/3714384677/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值