Skip to content
GitLab
Menu
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
17506775
Commit
17506775
authored
Feb 20, 2017
by
Anne Heimes
Browse files
bugfixes server
parent
21eb6780
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ITANetAudioStreamingServer.cpp
View file @
17506775
...
...
@@ -59,6 +59,7 @@ CITANetAudioStreamingServer::CITANetAudioStreamingServer( )
,
m_pNetAudioServer
(
new
CITANetAudioServer
(
)
)
{
iServerBlockId
=
0
;
m_iClientRingBufferFreeSamples
=
0
;
}
bool
CITANetAudioStreamingServer
::
Start
(
const
std
::
string
&
sAddress
,
int
iPort
)
...
...
@@ -124,36 +125,34 @@ bool CITANetAudioStreamingServer::LoopBody( )
for
(
int
i
=
0
;
i
<
int
(
m_pInputStream
->
GetNumberOfChannels
(
)
);
i
++
)
{
ITAStreamInfo
oStreamInfo
;
oStreamInfo
.
nSamples
=
m_
sfTempTransmitBuffer
.
GetLength
(
)
;
oStreamInfo
.
nSamples
=
m_
iClientRingBufferFreeSamples
;
const
float
*
pfData
=
m_pInputStream
->
GetBlockPointer
(
i
,
&
oStreamInfo
);
if
(
pfData
!=
0
)
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
m_
sfTempTransmitBuffer
.
GetLength
(
)
);
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
m_
iClientRingBufferFreeSamples
);
}
m_pInputStream
->
IncrementBlockPointer
(
);
iMsgType
=
CITANetAudioProtocol
::
NP_SERVER_SENDING_SAMPLES
;
m_pMessage
->
SetMessageType
(
iMsgType
);
m_pMessage
->
WriteSampleFrame
(
&
m_sfTempTransmitBuffer
);
m_pMessage
->
WriteMessage
(
);
m_iClientRingBufferFreeSamples
-=
m_
sfTempTransmitBuffer
.
GetLength
(
)
;
m_iClientRingBufferFreeSamples
-=
m_
iClientRingBufferFreeSamples
;
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr
::
out
(
)
<<
"[ITANetAudioStreamingServer] Transmitted "
<<
m_sfTempTransmitBuffer
.
GetLength
(
)
<<
" samples for "
<<
m_pInputStream
->
GetNumberOfChannels
(
)
<<
" channels"
<<
std
::
endl
;
#endif
}
else
{
// Waiting for Trigger
iMsgType
=
CITANetAudioProtocol
::
NP_SERVER_GET_RINGBUFFER_FREE_SAMPLES
;
m_pMessage
->
SetMessageType
(
iMsgType
);
m_pMessage
->
WriteMessage
(
);
oLog
.
iProtocolStatus
=
iMsgType
;
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr
::
out
(
)
<<
"[ITANetAudioStreamingServer] Not enough free samples in client buffer, requesting a trigger when more free samples available"
<<
std
::
endl
;
#endif
}
oLog
.
iFreeSamples
=
m_iClientRingBufferFreeSamples
;
oLog
.
iProtocolStatus
=
iMsgType
;
oLog
.
dWorldTimeStamp
=
ITAClock
::
getDefaultClock
(
)
->
getTime
(
);
m_pServerLogger
->
log
(
oLog
);
...
...
@@ -174,8 +173,6 @@ bool CITANetAudioStreamingServer::LoopBody( )
}
case
CITANetAudioProtocol
::
NP_CLIENT_CLOSE
:
{
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_SERVER_CLOSE
);
m_pMessage
->
WriteMessage
(
);
StopGently
(
false
);
m_pConnection
=
NULL
;
Stop
(
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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