Skip to content

Commit

Permalink
Resolve deadlock in resetStream (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nomidia authored Dec 31, 2020
1 parent c020b49 commit 0c255bb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/client/src/Stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,7 @@ STATUS resetStream(PKinesisVideoStream pKinesisVideoStream)
{
ENTERS();
STATUS retStatus = STATUS_SUCCESS;
BOOL streamLocked = FALSE;

PKinesisVideoClient pKinesisVideoClient = NULL;

Expand All @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0c255bb

Please sign in to comment.