Commit a37247be authored by Anne Heimes's avatar Anne Heimes

für 32 bit + serverLog update + bugfix ReadMessage

parent eac2e0db
......@@ -3,7 +3,7 @@
#include <VistaInterProcComm/Connections/VistaConnectionIP.h>
#include <VistaBase/VistaExceptionBase.h>
#include <VistaBase/VistaStreamUtils.h>
#include <VistaBase/VistaStreamUtils.h>
#include <ITAClock.h>
#include <cstring>
......@@ -124,7 +124,8 @@ bool CITANetAudioMessage::ReadMessage( int timeout)
if ( nIncomingBytes == -1)
return false;
nIncomingBytes = m_pConnection->WaitForIncomingData( 0 );
if (timeout != 0)
nIncomingBytes = m_pConnection->WaitForIncomingData( 0 );
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "CITANetAudioMessage [ Reading ] " << nIncomingBytes << " bytes incoming" << std::endl;
#endif
......@@ -135,8 +136,10 @@ bool CITANetAudioMessage::ReadMessage( int timeout)
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "CITANetAudioMessage [ Reading ] Expecting " << nMessagePayloadSize << " bytes message payload" << std::endl;
#endif
if (nMessagePayloadSize <= 2 * sizeof(VistaType::sint32))
int i = 34;
// we need at least the two protocol ints
assert( nMessagePayloadSize >= 2 * sizeof( VistaType::sint32 ) );
//assert( nMessagePayloadSize >= 2 * sizeof( VistaType::sint32 ) );
if( nMessagePayloadSize > ( int ) m_vecIncomingBuffer.size() )
m_vecIncomingBuffer.resize( nMessagePayloadSize );
......@@ -165,6 +168,7 @@ bool CITANetAudioMessage::ReadMessage( int timeout)
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "CITANetAudioMessage [ Reading ] Finished receiving " << m_nMessageType << " (id=" << std::setw( 4 ) << m_nMessageId << ")" << std::endl;
#endif
return true;
}
int CITANetAudioMessage::GetMessageType() const
......
This diff is collapsed.
......@@ -72,10 +72,10 @@ vista_install_all_dlls( bin )
set_property( TARGET ITANetAudioTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
if( NOT DEFINED ITA_NETAUDIO_SERVER_WITH_TESTS )
set( ITA_NETAUDIO_SERVER_WITH_TESTS "default value" CACHE STRING "localhost 12480 44100 1024 2" )
set( ITA_NETAUDIO_SERVER_WITH_TESTS "default value" CACHE STRING "localhost 12480 44100 32 2" )
endif( )
if( NOT DEFINED ITA_NETAUDIO_CLIENT_WITH_TESTS )
set( ITA_NETAUDIO_CLIENT_WITH_TESTS "default value" CACHE STRING "localhost 12480 44100 1024 2 1024" )
set( ITA_NETAUDIO_CLIENT_WITH_TESTS "default value" CACHE STRING "localhost 12480 44100 32 2 3200" )
endif( )
vista_set_target_msvc_arguments( ITANetAudioStreamingPortaudioClientTest ITA_NETAUDIO_CLIENT_WITH_TESTS )
......
......@@ -18,13 +18,6 @@ int main(int argc, char* argv[])
if (argc != 7)
{
cout << "argc = " << argc << endl;
cout << "sServerName = " << argv[1] << endl;
cout << "iServerPort = " << argv[2] << endl;
cout << "dSampleRate = " << argv[3] << endl;
cout << "iBlockLength = " << argv[4] << endl;
cout << "iChannels = " << argv[5] << endl;
cout << "iBufferSize = " << argv[6] << endl;
fprintf(stderr, "Fehler: Syntax = ServerName ServerPort SampleRate BufferSize Channel RingBufferSize!\n");
}
......
......@@ -2,7 +2,7 @@
close all;
clear all;
ChannelVec = [2];
BlockSize = '1024';
BlockSize = '32';
NetAudioLogClient = dir(['NetAudioLogClient_BS' BlockSize '*.txt']);
NetAudioLogClient = {NetAudioLogClient.name};
NetAudioLogClientTab = readtable(NetAudioLogClient{1}, 'FileType', 'text', 'Delimiter', '\t');
......
%% Einlesen der Logs
close all;
clear all;
NetAudioLogNet = readtable( 'NetAudioLogNet_BS1024_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t');
NetAudioLogStream = readtable( 'NetAudioLogStream_BS1024_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t')
NetAudioLogClient = readtable( 'NetAudioLogClient_BS1024_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t' );
NetAudioLogBaseData = readtable( 'NetAudioLogBaseData_BS1024_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t' );
NetAudioLogNet = readtable( 'NetAudioLogNet_BS32_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t');
NetAudioLogStream = readtable( 'NetAudioLogStream_BS32_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t')
NetAudioLogClient = readtable( 'NetAudioLogClient_BS32_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t' );
NetAudioLogBaseData = readtable( 'NetAudioLogBaseData_BS32_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t' );
% Save Base Data
Channel = NetAudioLogBaseData.Channel(1);
......
%% Einlesen der Logs
close all;
clear all;
BlockSize = '1024';
BlockSize = '32';
NetAudioLogServer = dir(['NetAudioLogServer_BS' BlockSize '*.txt']);
NetAudioLogServer = {NetAudioLogServer.name};
NetAudioLogServerTab = readtable(NetAudioLogServer{1}, 'FileType', 'text', 'Delimiter', '\t');
......@@ -18,34 +18,51 @@ for k=2:numel(NetAudioLogServer)
end
NetAudioLogServerTab.WorldTimeStamp = NetAudioLogServerTab.WorldTimeStamp - minTime;
% NetAudioLogClient = dir(['NetAudioLogClient_BS' BlockSize '*.txt']);
% NetAudioLogClient = {NetAudioLogClient.name};
% NetAudioLogClientTab = readtable(NetAudioLogClient{1}, 'FileType', 'text', 'Delimiter', '\t');
% minTime = NetAudioLogClientTab.WorldTimeStamp(1);
% maxTime = NetAudioLogClientTab.WorldTimeStamp(end);
% for k=2:numel(NetAudioLogClient)
% temp = readtable(NetAudioLogClient{k}, 'FileType', 'text', 'Delimiter', '\t');
% NetAudioLogClientTab = [NetAudioLogClientTab; temp];
% minTime = min(minTime, temp.WorldTimeStamp(1));
% maxTime = max(maxTime, temp.WorldTimeStamp(end));
% end
NetAudioLogClient = dir(['NetAudioLogClient_BS' BlockSize '*.txt']);
NetAudioLogClient = {NetAudioLogClient.name};
NetAudioLogClientTab = readtable(NetAudioLogClient{1}, 'FileType', 'text', 'Delimiter', '\t');
minTime = NetAudioLogClientTab.WorldTimeStamp(1);
maxTime = NetAudioLogClientTab.WorldTimeStamp(end);
for k=2:numel(NetAudioLogClient)
temp = readtable(NetAudioLogClient{k}, 'FileType', 'text', 'Delimiter', '\t');
NetAudioLogClientTab = [NetAudioLogClientTab; temp];
minTime = min(minTime, temp.WorldTimeStamp(1));
maxTime = max(maxTime, temp.WorldTimeStamp(end));
end
%% Protocolstatus ersetzten
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'};
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
Time100 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 100));
Time101 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 101));
Time111 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 111));
Time200 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 200));
Time201 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 201));
Time211 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 211));
Time222 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 222));
Time = {Time100 Time101 Time111 Time200 Time201 Time211 Time222};
%% Plot Protocol
plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.ProtocolStatus)
%plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.ProtocolStatus)
hold on;
%plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.FreeSamples)
plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.FreeSamples)
legende = {};
legende{1} = 'Freie Samples';
i = 2;
for k = (1:7)
if size(Time{k}, 1) ~= 0
plot(Time{k}, k* 100 * ones(size(Time{k})),'.')
legende{i} = Protocol{k,2};
i = i + 1;
end
end
legend(legende);
legend('show');
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment