Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITADataSources
Commits
74604554
Commit
74604554
authored
Mar 23, 2017
by
Anne Heimes
Browse files
bugfixes server
parent
65752f4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/ITANetAudioStreamingServer.cpp
View file @
74604554
...
...
@@ -115,7 +115,7 @@ bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort
m_pServerLogger
->
setOutputFile
(
paras
);
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_SERVER_OPEN
);
m_pMessage
->
Write
StreamingParameters
(
m_oServerParams
);
m_pMessage
->
Write
Double
(
dTimeIntervalCientSendStatus
);
m_pMessage
->
WriteMessage
(
);
m_sfTempTransmitBuffer
.
init
(
m_pInputStream
->
GetNumberOfChannels
(
),
m_oServerParams
.
iRingBufferSize
,
true
);
...
...
@@ -135,28 +135,28 @@ bool CITANetAudioStreamingServer::LoopBody( )
oLog
.
uiBlockId
=
++
iServerBlockId
;
int
iMsgType
;
// Sending Samples
unsigned
int
u
iBlockLength
=
m_pInputStream
->
GetBlocklength
(
);
int
iBlockLength
=
m_pInputStream
->
GetBlocklength
(
);
int
iClientRingBufferTargetLatencyFreeSamples
=
m_iClientRingBufferFreeSamples
-
(
m_oServerParams
.
iRingBufferSize
-
m_oServerParams
.
iTargetSampleLatency
);
if
(
iClientRingBufferTargetLatencyFreeSamples
>=
u
iBlockLength
)
if
(
iClientRingBufferTargetLatencyFreeSamples
>=
iBlockLength
)
{
// Send Samples
int
iSendBlocks
=
iClientRingBufferTargetLatencyFreeSamples
/
u
iBlockLength
;
int
iSendBlocks
=
iClientRingBufferTargetLatencyFreeSamples
/
iBlockLength
;
bAskClient
=
true
;
if
(
m_sfTempTransmitBuffer
.
GetLength
(
)
!=
iSendBlocks
*
u
iBlockLength
)
m_sfTempTransmitBuffer
.
init
(
m_pInputStream
->
GetNumberOfChannels
(
),
iSendBlocks
*
u
iBlockLength
,
false
);
if
(
m_sfTempTransmitBuffer
.
GetLength
(
)
!=
iSendBlocks
*
iBlockLength
)
m_sfTempTransmitBuffer
.
init
(
m_pInputStream
->
GetNumberOfChannels
(
),
iSendBlocks
*
iBlockLength
,
false
);
for
(
int
j
=
0
;
j
<
iSendBlocks
;
j
++
)
{
for
(
int
i
=
0
;
i
<
int
(
m_pInputStream
->
GetNumberOfChannels
(
)
);
i
++
)
{
ITAStreamInfo
oStreamInfo
;
oStreamInfo
.
nSamples
=
u
iBlockLength
;
oStreamInfo
.
nSamples
=
iBlockLength
;
const
float
*
pfData
=
m_pInputStream
->
GetBlockPointer
(
i
,
&
oStreamInfo
);
if
(
pfData
!=
0
)
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
u
iBlockLength
,
j
*
u
iBlockLength
);
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
iBlockLength
,
j
*
iBlockLength
);
}
m_pInputStream
->
IncrementBlockPointer
(
);
}
...
...
@@ -164,7 +164,7 @@ bool CITANetAudioStreamingServer::LoopBody( )
m_pMessage
->
SetMessageType
(
iMsgType
);
m_pMessage
->
WriteSampleFrame
(
&
m_sfTempTransmitBuffer
);
m_pMessage
->
WriteMessage
();
m_iClientRingBufferFreeSamples
-=
iSendBlocks
*
u
iBlockLength
;
m_iClientRingBufferFreeSamples
-=
iSendBlocks
*
iBlockLength
;
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr
::
out
()
<<
"[ITANetAudioStreamingServer] Transmitted "
<<
iSendSamples
<<
" samples for "
<<
m_pInputStream
->
GetNumberOfChannels
()
<<
" channels"
<<
std
::
endl
;
...
...
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
View file @
74604554
...
...
@@ -30,7 +30,7 @@ int main(int argc, char** argv)
oStreamingServer
.
SetInputStream
(
&
oMuliplier
);
cout
<<
"Starting net audio server and waiting for connections on '"
<<
sServerName
<<
"' on port "
<<
iServerPort
<<
endl
;
oStreamingServer
.
Start
(
sServerName
,
iServerPort
,
100
);
oStreamingServer
.
Start
(
sServerName
,
iServerPort
,
0.1
);
while
(
!
oStreamingServer
.
IsClientConnected
())
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment