source/Sources/AirPlayReceiverSession.c
static Boolean	_GeneralAudioTrackDups( AirPlayReceiverSessionRef inSession, uint16_t inSeq )
{
	size_t		i;
	int			diff;
	
	if( inSession->rtpAudioDupsInitialized )
	{
		diff = Mod16_Cmp( inSeq, inSession->rtpAudioDupsLastSeq );
		if(      diff  > 0 )						{}
		else if( diff == 0 )						goto dup;
		else if( diff <= -kAirTunesDupWindowSize )	goto dup;
		
		i = inSeq % kAirTunesDupWindowSize;
		if( inSession->rtpAudioDupsArray[ i ] == inSeq ) goto dup;
		inSession->rtpAudioDupsArray[ i ] = inSeq;
	}
	else
	{
		for( i = 0; i < kAirTunesDupWindowSize; ++i )
		{
			inSession->rtpAudioDupsArray[ i ] = inSeq;
		}
		inSession->rtpAudioDupsInitialized = true;
	}
	inSession->rtpAudioDupsLastSeq = inSeq;
	return( false );
	
dup:
	if( !inSession->redundantAudio )
	{
		atr_stats_ulog( kLogLevelInfo, "### Duplicate packet seq %u\n", inSeq );
	}
	return( true );
}
//===========================================================================================================================
//	_GeneralAudioTrackDups
//
//	Warning: Assumes the AirTunes lock is held.
//===========================================================================================================================
_GeneralAudioTrackDups
Warning: Assumes the AirTunes lock is held.
_GeneralAudioTrackDups Warning : Assumes the AirTunes lock is held .
static Boolean	_GeneralAudioTrackDups( AirPlayReceiverSessionRef inSession, uint16_t inSeq )
{
	size_t		i;
	int			diff;
	if( inSession->rtpAudioDupsInitialized )
	{
		diff = Mod16_Cmp( inSeq, inSession->rtpAudioDupsLastSeq );
		if(      diff  > 0 )						{}
		else if( diff == 0 )						goto dup;
		else if( diff <= -kAirTunesDupWindowSize )	goto dup;
		i = inSeq % kAirTunesDupWindowSize;
		if( inSession->rtpAudioDupsArray[ i ] == inSeq ) goto dup;
		inSession->rtpAudioDupsArray[ i ] = inSeq;
	}
	else
	{
		for( i = 0; i < kAirTunesDupWindowSize; ++i )
		{
			inSession->rtpAudioDupsArray[ i ] = inSeq;
		}
		inSession->rtpAudioDupsInitialized = true;
	}
	inSession->rtpAudioDupsLastSeq = inSeq;
	return( false );
dup:
	if( !inSession->redundantAudio )
	{
		atr_stats_ulog( kLogLevelInfo, "### Duplicate packet seq %u\n", inSeq );
	}
	return( true );
}
static Boolean _GeneralAudioTrackDups ( AirPlayReceiverSessionRef inSession , uint16_t inSeq ) { size_t i ; int diff ; if ( inSession -> rtpAudioDupsInitialized ) { diff = Mod16_Cmp ( inSeq , inSession -> rtpAudioDupsLastSeq ) ; if ( diff > 0 ) { } else if ( diff == 0 ) goto dup ; else if ( diff <= - kAirTunesDupWindowSize ) goto dup ; i = inSeq % kAirTunesDupWindowSize ; if ( inSession -> rtpAudioDupsArray [ i ] == inSeq ) goto dup ; inSession -> rtpAudioDupsArray [ i ] = inSeq ; } else { for ( i = 0 ; i < kAirTunesDupWindowSize ; ++ i ) { inSession -> rtpAudioDupsArray [ i ] = inSeq ; } inSession -> rtpAudioDupsInitialized = true ; } inSession -> rtpAudioDupsLastSeq = inSeq ; return ( false ) ; dup : if ( ! inSession -> redundantAudio ) { atr_stats_ulog ( kLogLevelInfo , " \n " , inSeq ) ; } return ( true ) ; }
_GeneralAudioTrackDups
Warning: Assumes the AirTunes lock is held.
_GeneralAudioTrackDups Warning : Assumes the AirTunes lock is held .