From f95f1524391b1534926236cd31a1141dfd176d6c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 31 Jul 2015 00:05:22 -0700 Subject: [PATCH] Fix a bug that could cause the cleanup() callback to be erroneously invoked without a prior call to setup() or init() --- limelight-common/AudioStream.c | 4 ++-- limelight-common/VideoStream.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/limelight-common/AudioStream.c b/limelight-common/AudioStream.c index 4aca21b..30ae434 100644 --- a/limelight-common/AudioStream.c +++ b/limelight-common/AudioStream.c @@ -49,8 +49,6 @@ static void freePacketList(PLINKED_BLOCKING_QUEUE_ENTRY entry) { /* Tear down the audio stream once we're done with it */ void destroyAudioStream(void) { - AudioCallbacks.cleanup(); - freePacketList(LbqDestroyLinkedBlockingQueue(&packetQueue)); RtpqCleanupQueue(&rtpReorderQueue); } @@ -191,6 +189,8 @@ static void DecoderThreadProc(void* context) { } void stopAudioStream(void) { + AudioCallbacks.cleanup(); + PltInterruptThread(&udpPingThread); PltInterruptThread(&receiveThread); PltInterruptThread(&decoderThread); diff --git a/limelight-common/VideoStream.c b/limelight-common/VideoStream.c index d7adadf..0c9af3a 100644 --- a/limelight-common/VideoStream.c +++ b/limelight-common/VideoStream.c @@ -31,8 +31,6 @@ void initializeVideoStream(void) { /* Clean up the video stream */ void destroyVideoStream(void) { - VideoCallbacks.cleanup(); - destroyVideoDepacketizer(); RtpqCleanupQueue(&rtpQueue); } @@ -150,6 +148,8 @@ int readFirstFrame(void) { /* Terminate the video stream */ void stopVideoStream(void) { + VideoCallbacks.cleanup(); + PltInterruptThread(&udpPingThread); PltInterruptThread(&receiveThread); PltInterruptThread(&decoderThread);