Ejemplo n.º 1
0
void addBinocularsSubstream0(void*)
{
    binocularsStream = new FrameStreamState;
    binocularsStream->content = binoculars->getContent();
    
    Port rtpPort(BINOCULARS_RTP_PORT_NUM);
    Groupsock* rtpGroupsock = new Groupsock(*env, destinationAddress, rtpPort, TTL);
    //rtpGroupsock->multicastSendOnly(); // we're a SSM source
    
    // Create a 'H264 Video RTP' sink from the RTP 'groupsock':
    binocularsStream->sink = H264VideoRTPSink::createNew(*env, rtpGroupsock, 96);
    
    ServerMediaSubsession* subsession = PassiveServerMediaSubsession::createNew(*binocularsStream->sink);
    
    binocularsSMS->addSubsession(subsession);
    
    binocularsStream->source = H264VideoStreamDiscreteFramer::createNew(*env,
                                                                        RawPixelSource::createNew(*env,
                                                                                                  binocularsStream->content,
                                                                                                  avgBitRate));
    binocularsStream->sink->startPlaying(*binocularsStream->source, NULL, NULL);
    
    std::cout << "Streaming binoculars ..." << std::endl;
    
    announceStream(rtspServer, binocularsSMS, binocularsStreamName);
}
Ejemplo n.º 2
0
bool ElcRTSPServer::setSource(const string& url, const string& iname)
{
	LOG_INFO("ElcRTSPServer::setSource -url="<<url<<" -name="<<iname);
	mUrl = url;
	mName = iname;
	Boolean reuseFirstSource = true;
	if(!rtspServer)
	{
		LOG_ERROR("ElcRTSPServer::setSource failed! Rtspserver does not created propertly");
		return false;
	}
	mediaSession = ServerMediaSession::createNew(*mEnv, mName.c_str(), mName.c_str(), "ELC");
	if(!mediaSession)
		return false;

	// if multicast streaming
	if(Config::isMulticast)
	{
		struct in_addr destinationAddress;
		if(Config::streamingDestinationIp == "default" || Config::streamingDestinationIp =="")
			destinationAddress.s_addr = chooseRandomIPv4SSMAddress(*mEnv);
		else
			destinationAddress.s_addr = our_inet_addr(Config::streamingDestinationIp.c_str());

		Port rtpPort(Config::rtpPortNum);
		Port rtcpPort(Config::rtcpPortNum);

		rtpGroupsock = new Groupsock(*mEnv, destinationAddress, rtpPort, 255/*Config::ttl*/);
		rtpGroupsock->multicastSendOnly(); // we're a SSM source
		rtcpGroupsock = new Groupsock(*mEnv, destinationAddress, rtcpPort, 255/*Config::ttl*/);
		rtcpGroupsock->multicastSendOnly(); // we're a SSM source

		videoSink = MPEG4ESVideoRTPSink::createNew(*mEnv, rtpGroupsock, 96);

		const unsigned estimatedSessionBandwidth = 500; // in kbps; for RTCP b/w share
		const unsigned maxCNAMElen = 100;
		unsigned char CNAME[maxCNAMElen+1];
		gethostname((char*)CNAME, maxCNAMElen);
		CNAME[maxCNAMElen] = '\0'; // just in case

		rtcp = RTCPInstance::createNew(*mEnv, rtcpGroupsock,
						estimatedSessionBandwidth, CNAME,
						videoSink, NULL /* we're a server*/ ,
						True /* we're a SSM source */);

		mediaSession->addSubsession(PassiveServerMediaSubsession::createNew(*videoSink, rtcp));
		rtspServer->addServerMediaSession(mediaSession);

		LOG_INFO("ElcRTSPServer::setSource OK");
	}
	else // unicast streaming
	{
		mediaSubSession = Mpeg4LiveServerMediaSubSession::createNew(*mEnv, reuseFirstSource, mUrl);
		mediaSession->addSubsession(mediaSubSession);
		rtspServer->addServerMediaSession(mediaSession);
		LOG_INFO("ElcRTSPServer::setSource OK");
	}

	return true;
}
void UT_CMccRtcpReceiver::UT_CMccRtcpReceiver_NonRTPDataReceivedL()
    {
    TUint dummyPort( 5000 );
    TBool rtpPort( ETrue );
    TBuf8<5> data;
    data.Append( _L8( "foo42" ) );
    
    // This should not do anything
    iRtcpReceiver->NonRTPDataReceived( dummyPort, rtpPort, data );

    rtpPort = EFalse;

    // This should do something
    iExpectedPackets++;
    iRtcpReceiver->NonRTPDataReceived( dummyPort, rtpPort, data );
    }
Ejemplo n.º 4
0
void addFaceSubstreams0(void*)
{
	int portCounter = 0;
	for (int j = 0; j < cubemap->getEyesCount(); j++)
	{
		Cubemap* eye = cubemap->getEye(j);

		for (int i = 0; i < eye->getFacesCount(); i++)
		{
			faceStreams.push_back(FrameStreamState());
			FrameStreamState* state = &faceStreams.back();

			state->content = eye->getFace(i)->getContent();

			Port rtpPort(FACE0_RTP_PORT_NUM + portCounter);
			portCounter += 2;
			Groupsock* rtpGroupsock = new Groupsock(*env, destinationAddress, rtpPort, TTL);
			//rtpGroupsock->multicastSendOnly(); // we're a SSM source

			setReceiveBufferTo(*env, rtpGroupsock->socketNum(), bufferSize);

			// Create a 'H264 Video RTP' sink from the RTP 'groupsock':
			state->sink = H264VideoRTPSink::createNew(*env, rtpGroupsock, 96);

			ServerMediaSubsession* subsession = PassiveServerMediaSubsession::createNew(*state->sink);

			cubemapSMS->addSubsession(subsession);

			RawPixelSource* source = RawPixelSource::createNew(*env,
				state->content,
				avgBitRate);

			source->setOnSentNALU    (boost::bind(&onSentNALU,     _1, _2, _3, j, i));
			source->setOnEncodedFrame(boost::bind(&onEncodedFrame, _1, j, i));

			state->source = H264VideoStreamDiscreteFramer::createNew(*env,
				source);

			state->sink->startPlaying(*state->source, NULL, NULL);

			std::cout << "Streaming face " << i << " (" << ((j == 0) ? "left" : "right") << ") on port " << ntohs(rtpPort.num()) << " ..." << std::endl;
		}
	}
    
    announceStream(rtspServer, cubemapSMS, cubemapStreamName);
}