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
908d1e5a
Commit
908d1e5a
authored
Feb 17, 2017
by
Anne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add serverlogs
parent
24cde1b3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
10 deletions
+107
-10
include/ITANetAudioStreamingServer.h
include/ITANetAudioStreamingServer.h
+5
-0
src/ITANetAudioStreamingClient.cpp
src/ITANetAudioStreamingClient.cpp
+0
-1
src/ITANetAudioStreamingServer.cpp
src/ITANetAudioStreamingServer.cpp
+63
-9
tests/NetAudio/NetAudioServerLog.m
tests/NetAudio/NetAudioServerLog.m
+39
-0
No files found.
include/ITANetAudioStreamingServer.h
View file @
908d1e5a
...
...
@@ -39,6 +39,8 @@ class CITANetAudioProtocol;
class
CITANetAudioServer
;
class
CITANetAudioMessage
;
class
VistaTCPSocket
;
class
ITABufferedDataLoggerImplServer
;
//! Network audio sample server (for connecting a net audio stream)
/**
...
...
@@ -88,6 +90,9 @@ private:
CITANetAudioProtocol
::
StreamingParameters
m_oServerParams
;
CITANetAudioMessage
*
m_pMessage
;
int
iServerBlockId
;
ITABufferedDataLoggerImplServer
*
m_pServerLogger
;
int
m_iUpdateStrategy
;
int
m_iClientRingBufferFreeSamples
;
...
...
src/ITANetAudioStreamingClient.cpp
View file @
908d1e5a
...
...
@@ -75,7 +75,6 @@ CITANetAudioStreamingClient::~CITANetAudioStreamingClient()
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_CLIENT_CLOSE
);
m_pMessage
->
WriteMessage
();
m_pClient
->
Disconnect
();
//Disconnect();
}
//}
//catch (ITAException e){
...
...
src/ITANetAudioStreamingServer.cpp
View file @
908d1e5a
...
...
@@ -6,7 +6,8 @@
#include <ITADataSource.h>
#include <ITANetAudioMessage.h>
#include <ITAException.h>
#include <ITAStreamInfo.h>
#include <ITAStreamInfo.h>
#include <ITAClock.h>
// Vista includes
#include <VistaInterProcComm/Concurrency/VistaThreadLoop.h>
...
...
@@ -14,18 +15,50 @@
#include <VistaInterProcComm/IPNet/VistaTCPSocket.h>
#include <VistaBase/VistaTimeUtils.h>
#include <VistaInterProcComm/IPNet/VistaIPAddress.h>
#include <VistaBase/VistaStreamUtils.h>
#include <VistaBase/VistaStreamUtils.h>
#include <ITADataLog.h>
// STL
#include <cmath>
#include <cassert>
struct
ITAServerLog
:
public
ITALogDataBase
{
inline
static
std
::
ostream
&
outputDesc
(
std
::
ostream
&
os
)
{
os
<<
"BlockId"
;
os
<<
"
\t
"
<<
"WorldTimeStamp"
;
os
<<
"
\t
"
<<
"ProtocolStatus"
;
os
<<
"
\t
"
<<
"FreeSamples"
;
os
<<
std
::
endl
;
return
os
;
};
inline
std
::
ostream
&
outputData
(
std
::
ostream
&
os
)
const
{
os
<<
uiBlockId
;
os
<<
"
\t
"
<<
std
::
setprecision
(
12
)
<<
dWorldTimeStamp
;
os
<<
"
\t
"
<<
iProtocolStatus
;
os
<<
"
\t
"
<<
iFreeSamples
;
os
<<
std
::
endl
;
return
os
;
};
unsigned
int
uiBlockId
;
//!< Block identifier (audio streaming)
double
dWorldTimeStamp
;
int
iProtocolStatus
;
//!< ... usw
int
iFreeSamples
;
};
class
ITABufferedDataLoggerImplServer
:
public
ITABufferedDataLogger
<
ITAServerLog
>
{};
CITANetAudioStreamingServer
::
CITANetAudioStreamingServer
(
)
:
m_pInputStream
(
NULL
)
,
m_iUpdateStrategy
(
AUTO
)
,
m_pConnection
(
NULL
)
,
m_pNetAudioServer
(
new
CITANetAudioServer
(
)
)
{
{
iServerBlockId
=
0
;
}
bool
CITANetAudioStreamingServer
::
Start
(
const
std
::
string
&
sAddress
,
int
iPort
)
...
...
@@ -48,6 +81,7 @@ bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort
bool
bOK
=
false
;
m_oServerParams
.
iRingBufferSize
=
oClientParams
.
iRingBufferSize
;
m_iClientRingBufferFreeSamples
=
m_oServerParams
.
iRingBufferSize
;
if
(
m_oServerParams
==
oClientParams
)
{
bOK
=
true
;
...
...
@@ -59,6 +93,10 @@ bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort
vstr
::
out
()
<<
"[ITANetAudioStreamingServer] Server and client parameters mismatch detected. Will notify client and stop."
<<
std
::
endl
;
#endif
}
std
::
string
paras
=
std
::
string
(
"NetAudioLogServer"
)
+
std
::
string
(
"_BS"
)
+
std
::
to_string
(
m_oServerParams
.
iBlockSize
)
+
std
::
string
(
"_Ch"
)
+
std
::
to_string
(
m_oServerParams
.
iChannels
)
+
std
::
string
(
".txt"
);
m_pServerLogger
=
new
ITABufferedDataLoggerImplServer
(
);
m_pServerLogger
->
setOutputFile
(
paras
);
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_SERVER_OPEN
);
m_pMessage
->
WriteBool
(
bOK
);
...
...
@@ -72,6 +110,9 @@ bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort
bool
CITANetAudioStreamingServer
::
LoopBody
(
)
{
ITAServerLog
oLog
;
oLog
.
uiBlockId
=
++
iServerBlockId
;
int
iMsgType
;
// Sending Samples
if
(
m_iClientRingBufferFreeSamples
>=
int
(
m_pInputStream
->
GetBlocklength
(
)
)
)
{
...
...
@@ -85,7 +126,8 @@ bool CITANetAudioStreamingServer::LoopBody( )
m_sfTempTransmitBuffer
[
i
].
write
(
pfData
,
m_sfTempTransmitBuffer
.
GetLength
(
)
);
}
m_pInputStream
->
IncrementBlockPointer
(
);
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_SERVER_SENDING_SAMPLES
);
iMsgType
=
CITANetAudioProtocol
::
NP_SERVER_SENDING_SAMPLES
;
m_pMessage
->
SetMessageType
(
iMsgType
);
m_pMessage
->
WriteSampleFrame
(
&
m_sfTempTransmitBuffer
);
m_pMessage
->
WriteMessage
(
);
m_iClientRingBufferFreeSamples
-=
m_sfTempTransmitBuffer
.
GetLength
(
);
...
...
@@ -97,14 +139,19 @@ bool CITANetAudioStreamingServer::LoopBody( )
else
{
// Waiting for Trigger
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_SERVER_GET_RINGBUFFER_FREE_SAMPLES
);
iMsgType
=
CITANetAudioProtocol
::
NP_SERVER_GET_RINGBUFFER_FREE_SAMPLES
;
m_pMessage
->
SetMessageType
(
iMsgType
);
m_pMessage
->
WriteMessage
(
);
#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
);
// Try to Empfange Daten
//m_pMessage->SetConnection( m_pConnection );
...
...
@@ -112,6 +159,8 @@ bool CITANetAudioStreamingServer::LoopBody( )
if
(
m_pMessage
->
ReadMessage
(
1
)
)
{
ITAServerLog
oLog
;
oLog
.
uiBlockId
=
++
iServerBlockId
;
int
iMsgType
=
m_pMessage
->
GetMessageType
(
);
switch
(
iMsgType
)
{
...
...
@@ -127,16 +176,20 @@ bool CITANetAudioStreamingServer::LoopBody( )
StopGently
(
false
);
m_pConnection
=
NULL
;
Stop
(
);
return
false
;
break
;
}
default:
{
vstr
::
out
(
)
<<
"[ITANetAudioStreamingServer] Unkown protocol type : "
<<
iMsgType
<<
std
::
endl
;
break
;
}
}
}
oLog
.
iFreeSamples
=
m_iClientRingBufferFreeSamples
;
oLog
.
iProtocolStatus
=
iMsgType
;
oLog
.
dWorldTimeStamp
=
ITAClock
::
getDefaultClock
(
)
->
getTime
(
);
m_pServerLogger
->
log
(
oLog
);
}
}
return
false
;
}
...
...
@@ -190,5 +243,6 @@ int CITANetAudioStreamingServer::GetNetworkPort( ) const
void
CITANetAudioStreamingServer
::
Stop
(
)
{
delete
m_pServerLogger
;
m_pNetAudioServer
->
Stop
(
);
}
tests/NetAudio/NetAudioServerLog.m
0 → 100644
View file @
908d1e5a
%% Einlesen der Logs
close
all
;
clear
all
;
BlockSize
=
'1024'
;
NetAudioLogServer
=
dir
([
'NetAudioLogServer_BS'
BlockSize
'*.txt'
]);
NetAudioLogServer
=
{
NetAudioLogServer
.
name
};
NetAudioLogServerTab
=
readtable
(
NetAudioLogServer
{
1
},
'FileType'
,
'text'
,
'Delimiter'
,
'\t'
);
minTime
=
NetAudioLogServerTab
.
WorldTimeStamp
(
1
);
maxTime
=
NetAudioLogServerTab
.
WorldTimeStamp
(
end
);
channel
=
NetAudioLogServer
{
1
}(
28
:
end
-
4
);
for
k
=
2
:
numel
(
NetAudioLogServer
)
temp
=
readtable
(
NetAudioLogServer
{
k
},
'FileType'
,
'text'
,
'Delimiter'
,
'\t'
);
NetAudioLogServerTab
=
[
NetAudioLogServerTab
;
temp
];
minTime
=
min
(
minTime
,
temp
.
WorldTimeStamp
(
1
));
maxTime
=
max
(
maxTime
,
temp
.
WorldTimeStamp
(
end
));
channel
=
[
channel
;
NetAudioLogServer
{
k
}(
28
:
end
-
4
)];
end
NetAudioLogServerTab
.
WorldTimeStamp
=
NetAudioLogServerTab
.
WorldTimeStamp
-
minTime
;
%% Protocolstatus ersetzten
hallo
=
[
1
2
;
3
4
];
Protocol
=
{
'100'
,
'NP_CLIENT_OPEN'
;
...
'101'
,
'NP_CLIENT_CLOSE'
;
...
'111'
,
'NP_CLIENT_SENDING_RINGBUFFER_FREE_SAMPLES'
;
...
'200'
,
'NP_SERVER_OPEN'
;
...
'201'
,
'NP_SERVER_CLOSE'
;
...
'211'
,
'NP_SERVER_GET_RINGBUFFER_FREE_SAMPLES'
;
...
'222'
,
'NP_SERVER_SENDING_SAMPLES'
};
%NumPro = zeros(size(NetAudioLogServerTab.ProtocolStatus));
for
k
=
(
1
:
size
(
Protocol
,
1
))
%NumPro( NetAudioLogServerTab.ProtocolStatus == 211) = 'NP_SERVER_GET_RINGBUFFER_FREE_SAMPLES';
end
%% Plot Protocol
plot
(
NetAudioLogServerTab
.
WorldTimeStamp
,
NetAudioLogServerTab
.
ProtocolStatus
)
hold
on
;
plot
(
NetAudioLogServerTab
.
WorldTimeStamp
,
NetAudioLogServerTab
.
FreeSamples
)
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