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
ea17bf32
Commit
ea17bf32
authored
Feb 20, 2017
by
Anne Heimes
Browse files
bugfixes server
parent
7ee2ae14
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ITANetAudioStreamingServer.cpp
View file @
ea17bf32
...
...
@@ -102,6 +102,9 @@ bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort
m_pMessage
->
WriteBool
(
bOK
);
m_pMessage
->
WriteMessage
(
);
m_sfTempTransmitBuffer
.
init
(
m_pInputStream
->
GetNumberOfChannels
(
),
m_oServerParams
.
iRingBufferSize
,
true
);
if
(
bOK
)
Run
(
);
...
...
@@ -115,30 +118,27 @@ bool CITANetAudioStreamingServer::LoopBody( )
oLog
.
uiBlockId
=
++
iServerBlockId
;
int
iMsgType
;
// Sending Samples
if
(
m_iClientRingBufferFreeSamples
>=
int
(
m_pInputStream
->
GetBlocklength
(
)
)
)
if
(
m_iClientRingBufferFreeSamples
>=
int
(
m_pInputStream
->
GetBlocklength
()
)
)
{
// Send Samples
while
(
m_iClientRingBufferFreeSamples
>=
int
(
m_pInputStream
->
GetBlocklength
(
)
)
)
for
(
int
i
=
0
;
i
<
int
(
m_pInputStream
->
GetNumberOfChannels
(
)
);
i
++
)
{
for
(
int
i
=
0
;
i
<
int
(
m_pInputStream
->
GetNumberOfChannels
(
)
);
i
++
)
{
ITAStreamInfo
oStreamInfo
;
oStreamInfo
.
nSamples
=
m_sfTempTransmitBuffer
.
GetLength
(
);
const
float
*
pfData
=
m_pInputStream
->
GetBlockPointer
(
i
,
&
oStreamInfo
);
if
(
pfData
!=
0
)
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
m_sfTempTransmitBuffer
.
GetLength
(
)
);
}
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
(
);
ITAStreamInfo
oStreamInfo
;
oStreamInfo
.
nSamples
=
m_sfTempTransmitBuffer
.
GetLength
(
);
const
float
*
pfData
=
m_pInputStream
->
GetBlockPointer
(
i
,
&
oStreamInfo
);
if
(
pfData
!=
0
)
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
m_sfTempTransmitBuffer
.
GetLength
(
)
);
}
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
(
);
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr
::
out
(
)
<<
"[ITANetAudioStreamingServer] Transmitted "
<<
m_sfTempTransmitBuffer
.
GetLength
(
)
<<
" samples for "
<<
m_pInputStream
->
GetNumberOfChannels
(
)
<<
" channels"
<<
std
::
endl
;
vstr
::
out
(
)
<<
"[ITANetAudioStreamingServer] Transmitted "
<<
m_sfTempTransmitBuffer
.
GetLength
(
)
<<
" samples for "
<<
m_pInputStream
->
GetNumberOfChannels
(
)
<<
" channels"
<<
std
::
endl
;
#endif
}
}
else
{
...
...
@@ -158,7 +158,6 @@ bool CITANetAudioStreamingServer::LoopBody( )
m_pServerLogger
->
log
(
oLog
);
// Try to Empfange Daten
//m_pMessage->SetConnection( m_pConnection );
m_pMessage
->
ResetMessage
(
);
if
(
m_pMessage
->
ReadMessage
(
1
)
)
...
...
@@ -175,8 +174,8 @@ bool CITANetAudioStreamingServer::LoopBody( )
}
case
CITANetAudioProtocol
::
NP_CLIENT_CLOSE
:
{
//
m_pMessage->Set
Answer
Type( CITANetAudioProtocol::NP_SERVER_CLOSE );
//
m_pMessage->Write
Answer(
);
m_pMessage
->
Set
Message
Type
(
CITANetAudioProtocol
::
NP_SERVER_CLOSE
);
m_pMessage
->
Write
Message
(
);
StopGently
(
false
);
m_pConnection
=
NULL
;
Stop
(
);
...
...
@@ -204,7 +203,6 @@ void CITANetAudioStreamingServer::SetInputStream( ITADatasource* pInStream )
ITA_EXCEPT1
(
MODAL_EXCEPTION
,
"Streaming loop already running, can not change input stream"
);
m_pInputStream
=
pInStream
;
m_sfTempTransmitBuffer
.
init
(
m_pInputStream
->
GetNumberOfChannels
(
),
m_pInputStream
->
GetBlocklength
(
),
true
);
m_oServerParams
.
dSampleRate
=
m_pInputStream
->
GetSampleRate
(
);
m_oServerParams
.
iBlockSize
=
m_pInputStream
->
GetBlocklength
(
);
m_oServerParams
.
iChannels
=
m_pInputStream
->
GetNumberOfChannels
(
);
...
...
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