Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
ITADataSources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITADataSources
Commits
8eb85966
Commit
8eb85966
authored
Feb 03, 2017
by
Anne Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
not running -> disconnect ist unsauber
parent
1d03a0d7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
18 deletions
+30
-18
src/ITANetAudioMessage.cpp
src/ITANetAudioMessage.cpp
+5
-5
src/ITANetAudioStreamingClient.cpp
src/ITANetAudioStreamingClient.cpp
+13
-8
tests/NetAudio/ITANetAudioStreamingClientTest.cpp
tests/NetAudio/ITANetAudioStreamingClientTest.cpp
+2
-3
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
+10
-2
No files found.
src/ITANetAudioMessage.cpp
View file @
8eb85966
...
...
@@ -4,9 +4,9 @@
#include <VistaInterProcComm/Connections/VistaConnectionIP.h>
#include <VistaBase/VistaExceptionBase.h>
#include <VistaBase/VistaStreamUtils.h>
#include <cstring>
#include <algorithm>
#include <cstring>
#include <algorithm>
#include <cassert>
#include <iostream>
#include <iomanip>
...
...
@@ -140,7 +140,7 @@ void CITANetAudioMessage::ReadMessage()
int
iIncommingBytes
=
m_pConnection
->
WaitForIncomingData
(
0
);
int
iBytesReceived
=
m_pConnection
->
Receive
(
&
m_vecIncomingBuffer
[
iBytesReceivedTotal
],
iIncommingBytes
);
iBytesReceivedTotal
+=
iBytesReceived
;
#if NET_AUDIO_SHOW_TRAFFIC
#if NET_AUDIO_SHOW_TRAFFIC
vstr
::
out
()
<<
"[ CITANetAudioMessage ] "
<<
std
::
setw
(
3
)
<<
std
::
floor
(
iBytesReceivedTotal
/
float
(
nMessagePayloadSize
)
*
100.0
f
)
<<
"% transmitted"
<<
std
::
endl
;
#endif
}
...
...
@@ -225,7 +225,7 @@ void CITANetAudioMessage::ReadAnswer()
int
iIncommingBytes
=
m_pConnection
->
WaitForIncomingData
(
0
);
int
iBytesReceived
=
m_pConnection
->
Receive
(
&
m_vecIncomingBuffer
[
iBytesReceivedTotal
],
iIncommingBytes
);
iBytesReceivedTotal
+=
iBytesReceived
;
#if NET_AUDIO_SHOW_TRAFFIC
#if NET_AUDIO_SHOW_TRAFFIC
vstr
::
out
()
<<
"[ CITANetAudioMessage ] "
<<
std
::
setw
(
3
)
<<
std
::
floor
(
iBytesReceivedTotal
/
float
(
nMessagePayloadSize
)
*
100.0
f
)
<<
"% of answer transmitted"
<<
std
::
endl
;
#endif
}
...
...
src/ITANetAudioStreamingClient.cpp
View file @
8eb85966
...
...
@@ -61,14 +61,19 @@ CITANetAudioStreamingClient::CITANetAudioStreamingClient( CITANetAudioStream* pP
CITANetAudioStreamingClient
::~
CITANetAudioStreamingClient
()
{
if
(
m_pConnection
)
{
m_pMessage
->
ResetMessage
();
m_pMessage
->
SetConnection
(
m_pConnection
);
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_CLIENT_CLOSE
);
m_pMessage
->
WriteMessage
();
m_pClient
->
Disconnect
();
}
//try{
if
(
m_pConnection
->
GetIsOpen
())
{
m_pMessage
->
ResetMessage
();
m_pMessage
->
SetConnection
(
m_pConnection
);
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_CLIENT_CLOSE
);
//m_pMessage->WriteMessage();
m_pClient
->
Disconnect
();
}
//}
//catch (ITAException e){
// std::cout << e << std::endl;
//}
delete
m_pClientLogger
;
}
...
...
tests/NetAudio/ITANetAudioStreamingClientTest.cpp
View file @
8eb85966
...
...
@@ -16,7 +16,7 @@ using namespace std;
int
main
(
int
argc
,
char
*
argv
[])
{
//
if (argc != 7)
if
(
argc
!=
7
)
{
cout
<<
"argc = "
<<
argc
<<
endl
;
cout
<<
"sServerName = "
<<
argv
[
1
]
<<
endl
;
...
...
@@ -36,7 +36,7 @@ int main(int argc, char* argv[])
int
iChannels
=
atoi
(
argv
[
5
]);
int
iBufferSize
=
atoi
(
argv
[
6
]);
cout
<<
"Channel"
<<
iChannels
<<
endl
;
cout
<<
"Channel
"
<<
iChannels
<<
endl
;
CITANetAudioStream
oNetAudioStream
(
iChannels
,
dSampleRate
,
iBlockLength
,
1
*
iBufferSize
);
...
...
@@ -142,7 +142,6 @@ int main(int argc, char* argv[])
}
ITAsioFinalizeLibrary
();
return
0
;
}
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
View file @
8eb85966
...
...
@@ -6,6 +6,7 @@
#include <ITAStreamFunctionGenerator.h>
#include <ITAStreamMultiplier1N.h>
#include <ITAFileDatasource.h>
#include <VistaBase\VistaTimeUtils.h>
using
namespace
std
;
...
...
@@ -31,8 +32,15 @@ int main(int argc, char** argv)
cout
<<
"Starting net audio server and waiting for connections on '"
<<
sServerName
<<
"' on port "
<<
iServerPort
<<
endl
;
oStreamingServer
.
Start
(
sServerName
,
iServerPort
);
int
iKey
;
std
::
cin
>>
iKey
;
while
(
!
oStreamingServer
.
IsClientConnected
())
{
VistaTimeUtils
::
Sleep
(
100
);
}
while
(
oStreamingServer
.
IsClientConnected
())
{
VistaTimeUtils
::
Sleep
(
100
);
}
VistaTimeUtils
::
Sleep
(
1000
);
return
0
;
}
Write
Preview
Markdown
is supported
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