diff --git a/src/client/src/Stream.c b/src/client/src/Stream.c index ca576d862..9133e0531 100644 --- a/src/client/src/Stream.c +++ b/src/client/src/Stream.c @@ -3206,6 +3206,7 @@ STATUS resetStream(PKinesisVideoStream pKinesisVideoStream) { ENTERS(); STATUS retStatus = STATUS_SUCCESS; + BOOL streamLocked = FALSE; PKinesisVideoClient pKinesisVideoClient = NULL; @@ -3221,6 +3222,7 @@ STATUS resetStream(PKinesisVideoStream pKinesisVideoStream) // Lock the stream pKinesisVideoClient->clientCallbacks.lockMutexFn(pKinesisVideoClient->clientCallbacks.customData, pKinesisVideoStream->base.lock); + streamLocked = TRUE; // Reset the current view item MEMSET(&pKinesisVideoStream->curViewItem, 0x00, SIZEOF(CurrentViewItem)); @@ -3324,8 +3326,14 @@ STATUS resetStream(PKinesisVideoStream pKinesisVideoStream) // Unlock the stream pKinesisVideoClient->clientCallbacks.unlockMutexFn(pKinesisVideoClient->clientCallbacks.customData, pKinesisVideoStream->base.lock); + streamLocked = FALSE; CleanUp: + + if (streamLocked) { + pKinesisVideoClient->clientCallbacks.unlockMutexFn(pKinesisVideoClient->clientCallbacks.customData, pKinesisVideoStream->base.lock); + } + LEAVES(); return retStatus; }