Skip to content

Commit

Permalink
hot fix: close client on verifying connection (will keep client open)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Jan 3, 2024
1 parent e74d2aa commit 3ae43eb
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions machinery/src/capture/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,17 +564,23 @@ func VerifyCamera(c *gin.Context) {
}
}

if videoIdx > -1 {
c.JSON(200, models.APIResponse{
Message: "All good, detected a H264 codec.",
Data: streams,
})
err := rtspClient.Close()
if err == nil {
if videoIdx > -1 {
c.JSON(200, models.APIResponse{
Message: "All good, detected a H264 codec.",
Data: streams,
})
} else {
c.JSON(400, models.APIResponse{
Message: "Stream doesn't have a H264 codec, we only support H264 so far.",
})
}
} else {
c.JSON(400, models.APIResponse{
Message: "Stream doesn't have a H264 codec, we only support H264 so far.",
Message: "Something went wrong while closing the connection " + err.Error(),
})
}

} else {
c.JSON(400, models.APIResponse{
Message: err.Error(),
Expand Down

0 comments on commit 3ae43eb

Please sign in to comment.