Commit 1bfecbc7 authored by Anne Heimes's avatar Anne Heimes

anpassung für latenz auf dem server - Client

parent c1f56f7a
...@@ -65,6 +65,7 @@ public: ...@@ -65,6 +65,7 @@ public:
double dSampleRate; double dSampleRate;
int iBlockSize; int iBlockSize;
int iRingBufferSize; int iRingBufferSize;
int iTargetSampleLatency;
inline StreamingParameters() inline StreamingParameters()
{ {
...@@ -72,11 +73,16 @@ public: ...@@ -72,11 +73,16 @@ public:
dSampleRate = 0.0f; dSampleRate = 0.0f;
iBlockSize = 0; iBlockSize = 0;
iRingBufferSize = 0; iRingBufferSize = 0;
iTargetSampleLatency = 0;
}; };
inline bool operator==( const StreamingParameters& rhs ) inline bool operator==( const StreamingParameters& rhs )
{ {
if ( ( iChannels == rhs.iChannels ) && ( dSampleRate == rhs.dSampleRate ) && ( iBlockSize == rhs.iBlockSize ) && ( iRingBufferSize == rhs.iRingBufferSize ) ) if ( ( iChannels == rhs.iChannels )
&& ( dSampleRate == rhs.dSampleRate )
&& (iBlockSize == rhs.iBlockSize)
&& (iRingBufferSize == rhs.iRingBufferSize)
&& (iTargetSampleLatency == rhs.iTargetSampleLatency))
return true; return true;
else else
return false; return false;
......
...@@ -204,7 +204,7 @@ private: ...@@ -204,7 +204,7 @@ private:
int m_iWriteCursor; //!< Cursor where samples will be fed into ring buffer from net audio producer (always ahead) int m_iWriteCursor; //!< Cursor where samples will be fed into ring buffer from net audio producer (always ahead)
bool m_bRingBufferFull; //!< Indicator if ring buffer is full (and read cursor equals write cursor) bool m_bRingBufferFull; //!< Indicator if ring buffer is full (and read cursor equals write cursor)
ITASampleFrame m_sfRingBuffer; //!< Ring buffer ITASampleFrame m_sfRingBuffer; //!< Ring buffer
int m_iTargetSampleLatency; //!< Maximum allowed samples / target sample latency int m_iTargetSampleLatencyServer; //!< Maximum allowed samples / target sample latency
int m_iStreamingStatus; //!< Current streaming status int m_iStreamingStatus; //!< Current streaming status
double m_dLastStreamingTimeCode; double m_dLastStreamingTimeCode;
......
...@@ -124,7 +124,7 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int ...@@ -124,7 +124,7 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int
, m_bRingBufferFull( false ) , m_bRingBufferFull( false )
, m_iStreamingStatus( INVALID ) , m_iStreamingStatus( INVALID )
, m_dLastStreamingTimeCode( 0.0f ) , m_dLastStreamingTimeCode( 0.0f )
, m_iTargetSampleLatency( iRingBufferCapacity ) , m_iTargetSampleLatencyServer( iRingBufferCapacity )
{ {
m_bRingBufferFull = false; m_bRingBufferFull = false;
if( iBufferSize > iRingBufferCapacity ) if( iBufferSize > iRingBufferCapacity )
...@@ -157,7 +157,7 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int ...@@ -157,7 +157,7 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int
oLog.dSampleRate = m_dSampleRate; oLog.dSampleRate = m_dSampleRate;
oLog.iBufferSize = GetBlocklength(); oLog.iBufferSize = GetBlocklength();
oLog.iRingBufferSize = GetRingBufferSize(); oLog.iRingBufferSize = GetRingBufferSize();
oLog.iTargetSampleLatency = m_iTargetSampleLatency; oLog.iTargetSampleLatency = m_iTargetSampleLatencyServer;
m_pAudioLogger->log( oLog ); m_pAudioLogger->log( oLog );
} }
...@@ -202,17 +202,17 @@ void CITANetAudioStream::SetAllowedLatencySamples( int iLatencySamples ) ...@@ -202,17 +202,17 @@ void CITANetAudioStream::SetAllowedLatencySamples( int iLatencySamples )
if( iLatencySamples > GetMaximumLatencySamples() ) if( iLatencySamples > GetMaximumLatencySamples() )
ITA_EXCEPT1( INVALID_PARAMETER, "Can not set latency greater than the maximum possible" ); ITA_EXCEPT1( INVALID_PARAMETER, "Can not set latency greater than the maximum possible" );
m_iTargetSampleLatency = iLatencySamples; m_iTargetSampleLatencyServer = iLatencySamples;
} }
float CITANetAudioStream::GetAllowedLatencySeconds() const float CITANetAudioStream::GetAllowedLatencySeconds() const
{ {
return float( m_iTargetSampleLatency / GetSampleRate() ); return float(m_iTargetSampleLatencyServer / GetSampleRate());
} }
int CITANetAudioStream::GetAllowedLatencySamples() const int CITANetAudioStream::GetAllowedLatencySamples() const
{ {
return m_iTargetSampleLatency; return m_iTargetSampleLatencyServer;
} }
int CITANetAudioStream::GetMinimumLatencySamples() const int CITANetAudioStream::GetMinimumLatencySamples() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment