点播 LIVE SERVER
虽然默认 50K 按理说是够的, 但实际上遇到大码流时依然会丢包, 并不是网络问题, 而是 socket buff 不够大.
从网上得到的信息为修改 increaseSendBufferTo
它的参数, 不过有很多地方调用它, 主要是修改liveMedia\RTPInterface.cpp
中的increaseSendBufferTo(envir(), fGS->socketNum(), 50*1024);
至于能不能不改源代码, 稍后研究
组播 LIVE SERVER
好像没这个问题
rtsp client
void setupNextSubsession(RTSPClient *rtspClient)
{UsageEnvironment &env = rtspClient->envir(); // alias
StreamClientState &scs = ((ourRTSPClient *)rtspClient)->scs; // alias
ourRTSPClient *myRtspClient = (ourRTSPClient *)rtspClient;
scs.subsession = scs.iter->next();
if (scs.subsession != NULL)
{if (!scs.subsession->initiate())
{env << *rtspClient << "Failed to initiate the \"" << *scs.subsession << "\" subsession: "<< env.getResultMsg() <<"\n";
setupNextSubsession(rtspClient); // give up on this subsession; go to the next one
}
else
{ // 重新配置 socket buffer 大小。if (scs.subsession->rtpSource() != NULL)
{
//unsigned newBufferSize = 1*1024*1024;
//unsigned const thresh = 1000000; // 1 second
//scs.subsession->rtpSource()->setPacketReorderingThresholdTime(thresh);
int socketNum = scs.subsession->rtpSource()->RTPgs()->socketNum();
//unsigned curBufferSize = getReceiveBufferSize(env, socketNum);
unsigned curBufferSize = setReceiveBufferTo(env, socketNum, myRtspClient->apiClass->socketRevBuffer);
if (curBufferSize < myRtspClient->apiClass->socketRevBuffer)
{env << "socket Buff is small than set,check system set! \r\n";}
}
env << *rtspClient << "Initiated the \"" << *scs.subsession << "\" subsession (";
if (scs.subsession->rtcpIsMuxed())
{env << "client port" << scs.subsession->clientPortNum();
}
else
{env << "client ports" << scs.subsession->clientPortNum() << "-" << scs.subsession->clientPortNum() + 1;}
env << ")\n";
// Continue setting up this subsession, by sending a RTSP "SETUP" command:
rtspClient->sendSetupCommand(*scs.subsession, continueAfterSETUP, False, REQUEST_STREAMING_OVER_TCP);
}
return;
}
// We've finished setting up all of the subsessions. Now, send a RTSP"PLAY" command to start the streaming:
if (scs.session->absStartTime() != NULL)
{
// Special case: The stream is indexed by 'absolute' time, so send an appropriate "PLAY" command:
rtspClient->sendPlayCommand(*scs.session, continueAfterPLAY, scs.session->absStartTime(), scs.session->absEndTime());
}
else
{scs.duration = scs.session->playEndTime() - scs.session->playStartTime();
rtspClient->sendPlayCommand(*scs.session, continueAfterPLAY);
}
}
正文完