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
05621b8b
Commit
05621b8b
authored
Dec 20, 2016
by
Anne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ITANetAudioStreaminingServer send via ITANetAudioMassage
parent
6f51069f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
34 deletions
+52
-34
include/ITANetAudioServer.h
include/ITANetAudioServer.h
+6
-2
include/ITANetAudioStreamingClient.h
include/ITANetAudioStreamingClient.h
+1
-2
include/ITANetAudioStreamingServer.h
include/ITANetAudioStreamingServer.h
+10
-2
src/ITANetAudioServer.cpp
src/ITANetAudioServer.cpp
+5
-2
src/ITANetAudioStreamingClient.cpp
src/ITANetAudioStreamingClient.cpp
+3
-4
src/ITANetAudioStreamingServer.cpp
src/ITANetAudioStreamingServer.cpp
+24
-18
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
+3
-4
No files found.
include/ITANetAudioServer.h
View file @
05621b8b
...
...
@@ -21,6 +21,8 @@
#include <ITADataSourcesDefinitions.h>
#include <ITANetAudioProtocol.h>
#include <ITASampleFrame.h>
...
...
@@ -44,8 +46,9 @@ public:
std
::
string
GetServerAddress
()
const
;
int
GetNetworkPort
()
const
;
bool
Start
(
const
std
::
string
&
sAddress
,
int
iPort
);
VistaTCPSocket
*
GetSocket
()
const
;
bool
Start
(
const
std
::
string
&
sAddress
,
int
iPort
);
VistaConnectionIP
*
GetConnetion
()
const
;
void
Disconnect
();
bool
IsConnected
()
const
;
...
...
@@ -53,6 +56,7 @@ public:
private:
VistaTCPServer
*
m_pServer
;
VistaTCPSocket
*
m_pSocket
;
VistaConnectionIP
*
m_pConnection
;
int
m_iServerPort
;
std
::
string
m_sServerAddress
;
...
...
include/ITANetAudioStreamingClient.h
View file @
05621b8b
...
...
@@ -64,8 +64,7 @@ private:
ITASampleFrame
m_sfReceivingBuffer
;
//!< Buffer incoming data
CITANetAudioProtocol
::
StreamingParameters
m_oClientParams
;
CITANetAudioProtocol
::
StreamingParameters
m_oServerParams
;
CITANetAudioProtocol
::
StreamingParameters
m_oParams
;
bool
m_bStopIndicated
;
...
...
include/ITANetAudioStreamingServer.h
View file @
05621b8b
...
...
@@ -24,12 +24,15 @@
#include <string>
#include <vector>
#include <ITANetAudioProtocol.h>
#include <VistaInterProcComm/Concurrency/VistaThreadLoop.h>
#include <ITASampleFrame.h>
class
ITADatasource
;
class
CITANetAudioMessage
;
class
CITANetAudioProtocol
;
class
CITANetAudioServer
;
class
VistaTCPSocket
;
//! Network audio sample server (for connecting a net audio stream)
/**
...
...
@@ -74,7 +77,12 @@ private:
CITANetAudioServer
*
m_pNetAudioServer
;
ITASampleFrame
m_sfTempTransmitBuffer
;
ITADatasource
*
m_pInputStream
;
VistaTCPSocket
*
m_pSocket
;
CITANetAudioProtocol
*
m_pProtocol
;
CITANetAudioMessage
*
m_pMessage
;
VistaConnectionIP
*
m_pConnection
;
CITANetAudioProtocol
::
StreamingParameters
m_oServerParams
;
int
m_iUpdateStrategy
;
int
m_iClientRingBufferFreeSamples
;
...
...
src/ITANetAudioServer.cpp
View file @
05621b8b
...
...
@@ -23,6 +23,7 @@ CITANetAudioServer::CITANetAudioServer()
:
m_pServer
(
NULL
)
,
m_pSocket
(
NULL
)
,
m_iServerPort
(
-
1
)
,
m_pConnection
(
NULL
)
{
};
...
...
@@ -51,14 +52,16 @@ bool CITANetAudioServer::Start(const std::string& sAddress, int iPort)
// blocking wait for connection
m_pSocket
=
m_pServer
->
GetNextClient
();
if
(
m_pSocket
!=
NULL
)
m_pConnection
=
new
VistaConnectionIP
(
m_pSocket
);
return
true
;
return
false
;
}
Vista
TCPSocket
*
CITANetAudioServer
::
GetSocket
()
const
Vista
ConnectionIP
*
CITANetAudioServer
::
GetConnetion
()
const
{
return
m_p
Socket
;
return
m_p
Connection
;
}
...
...
src/ITANetAudioStreamingClient.cpp
View file @
05621b8b
...
...
@@ -43,14 +43,13 @@ bool CITANetAudioStreamingClient::Connect( const std::string& sAddress, int iPor
// Validate streaming parameters of server and client
m_pMessage
->
ResetMessage
();
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_CLIENT_OPEN
);
m_pMessage
->
WriteStreamingParameters
(
m_o
Client
Params
);
m_pMessage
->
WriteStreamingParameters
(
m_oParams
);
m_pMessage
->
WriteMessage
();
m_pMessage
->
ReadAnswer
();
// NOTE: Wieso speichern wir beie paras, nach einmal vergleichen, sollten doch sowieso beide gleich sein
CITANetAudioProtocol
::
StreamingParameters
oServerParams
=
m_pMessage
->
ReadStreamingParameters
();
if
(
oServerParams
==
m_oClientParams
)
m_oServerParams
=
oServerParams
;
else
if
(
!
(
oServerParams
==
m_oParams
))
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"Streaming parameters of network audio server and client do not match."
);
Run
();
...
...
src/ITANetAudioStreamingServer.cpp
View file @
05621b8b
...
...
@@ -2,7 +2,8 @@
#include <ITANetAudioServer.h>
// ITA includes
#include <ITADataSource.h>
#include <ITADataSource.h>
#include <ITANetAudioMessage.h>
#include <ITAException.h>
#include <ITAStreamInfo.h>
...
...
@@ -21,7 +22,7 @@
CITANetAudioStreamingServer
::
CITANetAudioStreamingServer
()
:
m_pInputStream
(
NULL
)
,
m_iUpdateStrategy
(
AUTO
)
,
m_p
Socket
(
NULL
)
,
m_p
Connection
(
NULL
)
{
m_pNetAudioServer
=
new
CITANetAudioServer
();
// TODO: Init members
...
...
@@ -30,22 +31,27 @@ CITANetAudioStreamingServer::CITANetAudioStreamingServer()
bool
CITANetAudioStreamingServer
::
Start
(
const
std
::
string
&
sAddress
,
int
iPort
)
{
// TODO: vorrckgabe noch anfangen zu senden (Samples)
if
(
m_pNetAudioServer
->
Start
(
sAddress
,
iPort
))
{
m_pSocket
=
m_pNetAudioServer
->
GetSocket
();
// TODO: Init neu mit Netmessage
long
nIncomingBytes
=
m_pSocket
->
WaitForIncomingData
(
0
);
m_iClientRingBufferFreeSamples
=
m_iClientRingBufferFreeSamples
;
int
iMessageID
=
1
;
m_pSocket
->
SendRaw
(
&
iMessageID
,
sizeof
(
int
));
Run
();
return
true
;
return
true
;
}
return
false
;
if
(
!
m_pNetAudioServer
->
Start
(
sAddress
,
iPort
))
return
false
;
m_pConnection
=
m_pNetAudioServer
->
GetConnetion
();
m_pMessage
->
SetConnection
(
m_pConnection
);
// Get Streaming Parameters from Client
m_pMessage
->
ReadAnswer
();
CITANetAudioProtocol
::
StreamingParameters
m_oServerParams
=
m_pMessage
->
ReadStreamingParameters
();
// Send Streaming Parameters from Client back
m_pMessage
->
ResetMessage
();
m_pMessage
->
SetMessageType
(
CITANetAudioProtocol
::
NP_SERVER_OPEN
);
m_pMessage
->
WriteStreamingParameters
(
m_oServerParams
);
m_pMessage
->
WriteMessage
();
Run
();
return
true
;
}
bool
CITANetAudioStreamingServer
::
IsClientConnected
()
const
...
...
tests/NetAudio/ITANetAudioStreamingServerTest.cpp
View file @
05621b8b
...
...
@@ -16,12 +16,11 @@ int main( int , char** )
{
ITAStreamFunctionGenerator
oGenerator
(
1
,
g_dSampleRate
,
g_iBlockLength
,
ITAStreamFunctionGenerator
::
SINE
,
456.78
f
,
0.81
f
,
true
);
CITANetAudioStreamingServer
oStreamingServer
;
oStreamingServer
.
SetInputStream
(
&
oGenerator
);
//CITANetAudioStream
oStreamingServer;
//
oStreamingServer.SetInputStream( &oGenerator );
CITANetAudioServer
oServer
(
&
oStreamingServer
);
cout
<<
"Starting server and waiting for connections on '"
<<
g_sServerName
<<
"' on port "
<<
g_iServerPort
<<
endl
;
oServer
.
Start
(
g_sServerName
,
g_iServerPort
);
//oStreamingServer.Start(g_sServerName, g_iServerPort
);
int
iKey
;
cin
>>
iKey
;
...
...
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