示例#1
0
RelaySession::~RelaySession()
{   
    QTSS_Object sessionObject;
    UInt32 len = sizeof(QTSS_Object);

    for (int x = 0; QTSS_GetValue(relayModuleAttributesObject, sRelaySessionObjectID, x, &sessionObject, &len) == QTSS_NoErr; x++)
    {
        Assert(sessionObject != NULL);
        Assert(len == sizeof(QTSS_Object));

        if (sessionObject == fRelaySessionObject)   
        {
            (void)QTSS_RemoveValue(relayModuleAttributesObject, sRelaySessionObjectID, x);
            break;
        }
    }
}
示例#2
0
RelayOutput::~RelayOutput()
{
	OSMutexLocker locker(&sQueueMutex);
	sRelayOutputQueue.Remove(&fQueueElem);

	if (fClientSocket)
		delete fClientSocket;
	if (fClient)
		delete fClient;

	delete[] fStreamCookieArray;

	delete fOutgoingSDP;
	fOutgoingSDP = NULL;

	if (fAnnounceTask != NULL)
		fAnnounceTask->fOutput = NULL;

	if (fRTSPOutputInfo != NULL)
		delete fRTSPOutputInfo;

	QTSS_Object outputObject;
	UInt32 len = sizeof(QTSS_Object);

	for (int x = 0; QTSS_GetValue(fRelaySessionObject, RelaySession::sRelayOutputObject, x, &outputObject, &len) == QTSS_NoErr; x++)
	{
		Assert(outputObject != NULL);
		Assert(len == sizeof(QTSS_Object));

		if (outputObject == fRelayOutputObject)
		{
			(void)QTSS_RemoveValue(fRelaySessionObject, RelaySession::sRelayOutputObject, x);
			break;
		}
	}
}
示例#3
0
QTSS_Error  RTPSessionOutput::TrackRTPPackets(QTSS_RTPStreamObject *theStreamPtr, StrPtrLen* inPacketStrPtr, SInt64 *currentTimePtr, UInt32 inFlags, SInt64* packetLatenessInMSec, SInt64* timeToSendThisPacketAgain, UInt64* packetIDPtr, SInt64* arrivalTimeMSecPtr)
{
    QTSS_Error writeErr = QTSS_NoErr;

    Assert(inFlags & qtssWriteFlagsIsRTP);

    if (!(inFlags & qtssWriteFlagsIsRTP))
        return QTSS_NoErr;
    
    ReflectorPacket packetContainer;
    packetContainer.SetPacketData(inPacketStrPtr->Ptr, inPacketStrPtr->Len);
    packetContainer.fIsRTCP = false;
    SInt64 *theTimePtr = NULL;
    UInt32 theLen = 0;
    
    if (QTSS_NoErr != QTSS_GetValuePtr(*theStreamPtr, sFirstRTPArrivalTimeAttr, 0, (void**)&theTimePtr, &theLen))
    {                   
        UInt32 theSSRC = packetContainer.GetSSRC(packetContainer.fIsRTCP);
        (void) QTSS_SetValue(*theStreamPtr, sStreamSSRCAttr, 0, &theSSRC, sizeof(theSSRC));
        
        UInt32 rtpTime = packetContainer.GetPacketRTPTime();
        writeErr = QTSS_SetValue(*theStreamPtr, sFirstRTPTimeStampAttr, 0, &rtpTime, sizeof(rtpTime));
        Assert(writeErr == QTSS_NoErr);
        
        writeErr = QTSS_SetValue(*theStreamPtr, sFirstRTPArrivalTimeAttr, 0, arrivalTimeMSecPtr, sizeof(SInt64));
        Assert(writeErr == QTSS_NoErr);
        
        writeErr = QTSS_SetValue(*theStreamPtr, sFirstRTPCurrentTimeAttr, 0, currentTimePtr, sizeof(SInt64));
        Assert(writeErr == QTSS_NoErr);

        UInt32 initValue = 0;
        writeErr = QTSS_SetValue(*theStreamPtr, sStreamByteCountAttr, 0, &initValue, sizeof(UInt32));
        Assert(writeErr == QTSS_NoErr);
        
        //printf("first rtp on stream stream=%"_U32BITARG_" ssrc=%"_U32BITARG_" rtpTime=%"_U32BITARG_" arrivalTimeMSecPtr=%qd currentTime=%qd\n",(UInt32) theStreamPtr, theSSRC, rtpTime, *arrivalTimeMSecPtr, *currentTimePtr);
        
    }
    else
    {
        UInt32* packetCountPtr = NULL;
        UInt32* byteCountPtr = NULL;
        UInt32 theLen = 0;
                
        writeErr = QTSS_GetValuePtr(*theStreamPtr, sStreamByteCountAttr, 0, (void**) &byteCountPtr,&theLen);
        if (writeErr == QTSS_NoErr && theLen > 0)
            *byteCountPtr += inPacketStrPtr->Len - 12;// 12 header bytes
            
            
       UInt32* theSSRCPtr = 0;
        (void) QTSS_GetValuePtr(*theStreamPtr, sStreamSSRCAttr, 0, (void**)&theSSRCPtr, &theLen);
        if (*theSSRCPtr != packetContainer.GetSSRC(packetContainer.fIsRTCP))
        {    

           
           (void) QTSS_RemoveValue(*theStreamPtr,sFirstRTPArrivalTimeAttr,0);
           (void) QTSS_RemoveValue(*theStreamPtr,sFirstRTPTimeStampAttr,0);
           (void) QTSS_RemoveValue(*theStreamPtr,sFirstRTPCurrentTimeAttr,0);
           (void) QTSS_RemoveValue(*theStreamPtr,sStreamPacketCountAttr,0);
           (void) QTSS_RemoveValue(*theStreamPtr,sStreamByteCountAttr,0);
           fMustSynch = true;
           
           //printf("found different ssrc =%"_U32BITARG_" packetssrc=%"_U32BITARG_"\n",*theSSRCPtr, packetContainer.GetSSRC(packetContainer.fIsRTCP));
           
        }
        
              
            
    } 
    
    return writeErr; 

}