Update for GFE 2.2.2+

This commit is contained in:
Cameron Gutman
2015-01-22 16:55:08 -05:00
parent 8671e4e7ae
commit 41d823923b
5 changed files with 20 additions and 102 deletions

View File

@@ -6,7 +6,6 @@
#define FIRST_FRAME_MAX 1500
#define RTP_PORT 47998
#define FIRST_FRAME_PORT 47996
static DECODER_RENDERER_CALLBACKS callbacks;
static STREAM_CONFIGURATION configuration;
@@ -14,7 +13,6 @@ static IP_ADDRESS remoteHost;
static PCONNECTION_LISTENER_CALLBACKS listenerCallbacks;
static SOCKET rtpSocket = INVALID_SOCKET;
static SOCKET firstFrameSocket = INVALID_SOCKET;
static PLT_THREAD udpPingThread;
static PLT_THREAD receiveThread;
@@ -110,37 +108,6 @@ static void DecoderThreadProc(void* context) {
}
}
/* Read the first frame of the video stream */
int readFirstFrame(void) {
char* firstFrame;
SOCK_RET err;
int offset = 0;
firstFrame = (char*) malloc(FIRST_FRAME_MAX);
if (firstFrame == NULL) {
return -1;
}
Limelog("Waiting for first frame\n");
for (;;) {
err = recv(firstFrameSocket, &firstFrame[offset], FIRST_FRAME_MAX - offset, 0);
if (err <= 0) {
break;
}
offset += err;
}
Limelog("Read %d bytes\n", offset);
// We can just ignore this data for now. It's the act of reading
// it that matters. If this changes, we'll need to move this call before
// starting the receive thread to avoid state corruption in the depacketizer.
free(firstFrame);
return 0;
}
/* Terminate the video stream */
void stopVideoStream(void) {
callbacks.stop();
@@ -149,10 +116,6 @@ void stopVideoStream(void) {
PltInterruptThread(&receiveThread);
PltInterruptThread(&decoderThread);
if (firstFrameSocket != INVALID_SOCKET) {
closesocket(firstFrameSocket);
firstFrameSocket = INVALID_SOCKET;
}
if (rtpSocket != INVALID_SOCKET) {
closesocket(rtpSocket);
rtpSocket = INVALID_SOCKET;
@@ -193,21 +156,9 @@ int startVideoStream(void* rendererContext, int drFlags) {
return err;
}
// Connect this socket to open port 47998 for our ping thread
firstFrameSocket = connectTcpSocket(remoteHost, FIRST_FRAME_PORT);
if (firstFrameSocket == INVALID_SOCKET) {
return LastSocketError();
}
// Start pinging before reading the first frame so GFE knows where
// to send UDP data
err = PltCreateThread(UdpPingThreadProc, NULL, &udpPingThread);
if (err != 0) {
return err;
}
// Read the first frame to start the flow of video
err = readFirstFrame();
if (err != 0) {
return err;
}