Bug in recording fixed.

This commit is contained in:
marek
2015-11-06 19:13:43 +01:00
parent 57291f3d5b
commit 51129eaf30
4 changed files with 25 additions and 11 deletions
+13 -4
View File
@@ -232,11 +232,12 @@ namespace KinectServer
} }
} }
public void GetStoredFrame(List<List<byte>> lFramesRGB, List<List<Single>> lFramesVerts) public bool GetStoredFrame(List<List<byte>> lFramesRGB, List<List<Single>> lFramesVerts)
{ {
bool bNoMoreStoredFrames;
lFramesRGB.Clear(); lFramesRGB.Clear();
lFramesVerts.Clear(); lFramesVerts.Clear();
lock (oFrameRequestLock) lock (oFrameRequestLock)
{ {
//Request frames //Request frames
@@ -248,10 +249,10 @@ namespace KinectServer
//Wait till frames received //Wait till frames received
bool allGathered = false; bool allGathered = false;
bNoMoreStoredFrames = false;
while (!allGathered) while (!allGathered)
{ {
allGathered = true; allGathered = true;
lock (oClientSocketLock) lock (oClientSocketLock)
{ {
for (int i = 0; i < lClientSockets.Count; i++) for (int i = 0; i < lClientSockets.Count; i++)
@@ -261,6 +262,9 @@ namespace KinectServer
allGathered = false; allGathered = false;
break; break;
} }
if (lClientSockets[i].bNoMoreStoredFrames)
bNoMoreStoredFrames = true;
} }
} }
} }
@@ -275,6 +279,11 @@ namespace KinectServer
} }
} }
} }
if (bNoMoreStoredFrames)
return false;
else
return true;
} }
public void GetLatestFrame(List<List<byte>> lFramesRGB, List<List<Single>> lFramesVerts, List<List<Body>> lFramesBody) public void GetLatestFrame(List<List<byte>> lFramesRGB, List<List<Single>> lFramesVerts, List<List<Body>> lFramesBody)
+6 -1
View File
@@ -31,6 +31,7 @@ namespace KinectServer
public bool bFrameCaptured = false; public bool bFrameCaptured = false;
public bool bLatestFrameReceived = false; public bool bLatestFrameReceived = false;
public bool bStoredFrameReceived = false; public bool bStoredFrameReceived = false;
public bool bNoMoreStoredFrames = true;
public bool bCalibrated = false; public bool bCalibrated = false;
//The pose of the sensor in the scene (used by the OpenGLWindow to show the sensor) //The pose of the sensor in the scene (used by the OpenGLWindow to show the sensor)
public AffineTransform oCameraPose = new AffineTransform(); public AffineTransform oCameraPose = new AffineTransform();
@@ -85,6 +86,7 @@ namespace KinectServer
{ {
byteToSend[0] = 3; byteToSend[0] = 3;
SendByte(); SendByte();
bNoMoreStoredFrames = false;
bStoredFrameReceived = false; bStoredFrameReceived = false;
} }
@@ -170,8 +172,11 @@ namespace KinectServer
nToRead = BitConverter.ToInt32(buffer, 0); nToRead = BitConverter.ToInt32(buffer, 0);
if (nToRead == 0) if (nToRead == -1)
{
bNoMoreStoredFrames = true;
return; return;
}
buffer = new byte[nToRead]; buffer = new byte[nToRead];
int nAlreadyRead = 0; int nAlreadyRead = 0;
+5 -5
View File
@@ -191,7 +191,11 @@ namespace KinectServer
List<List<byte>> lFrameRGBAllDevices = new List<List<byte>>(); List<List<byte>> lFrameRGBAllDevices = new List<List<byte>>();
List<List<float>> lFrameVertsAllDevices = new List<List<float>>(); List<List<float>> lFrameVertsAllDevices = new List<List<float>>();
oServer.GetStoredFrame(lFrameRGBAllDevices, lFrameVertsAllDevices); bool success = oServer.GetStoredFrame(lFrameRGBAllDevices, lFrameVertsAllDevices);
//This indicates that there are no more stored frames.
if (!success)
break;
nFrames++; nFrames++;
int nVerticesTotal = 0; int nVerticesTotal = 0;
@@ -200,10 +204,6 @@ namespace KinectServer
nVerticesTotal += lFrameVertsAllDevices[i].Count; nVerticesTotal += lFrameVertsAllDevices[i].Count;
} }
//This indicates that there are no more stored frames.
if (nVerticesTotal == 0)
break;
List<byte> lFrameRGB = new List<byte>(); List<byte> lFrameRGB = new List<byte>();
List<Single> lFrameVerts = new List<Single>(); List<Single> lFrameVerts = new List<Single>();
+1 -1
View File
@@ -519,7 +519,7 @@ void LiveScanClient::HandleSocket()
} }
else else
{ {
int size = 0; int size = -1;
m_pClientSocket->SendBytes((char*)&size, 4); m_pClientSocket->SendBytes((char*)&size, 4);
} }
} }