Skip to content

Commit

Permalink
[ipcamera] Fix Hikvision digest stopping ipcamera.mjpeg (openhab#11457)
Browse files Browse the repository at this point in the history
* Stop hik logging 401 with digest.

Signed-off-by: Matthew Skinner <[email protected]>

* Improve and fix generic cams


Signed-off-by: Matthew Skinner <[email protected]>

* Stop dahua IntelliFrame logging


Signed-off-by: Matthew Skinner <[email protected]>

* Catch IllegalStateException


Signed-off-by: Matthew Skinner <[email protected]>

* Trial reusing channels.


Signed-off-by: Matthew Skinner <[email protected]>

* Tidy up


Signed-off-by: Matthew Skinner <[email protected]>

* cleanup 2


Signed-off-by: Matthew Skinner <[email protected]>

* Cleanup 3


Signed-off-by: Matthew Skinner <[email protected]>

* Disable checking connection with event stream.


Signed-off-by: Matthew Skinner <[email protected]>

* Bug fix


Signed-off-by: Matthew Skinner <[email protected]>

* more cleanup


Signed-off-by: Matthew Skinner <[email protected]>

* more cleanup

Signed-off-by: Matthew Skinner <[email protected]>

* Reduce logging to only whats needed.


Signed-off-by: Matthew Skinner <[email protected]>

* fix offline detection.


Signed-off-by: Matthew Skinner <[email protected]>

* fixes to ipcamera.mjpeg


Signed-off-by: Matthew Skinner <[email protected]>

* reverse some connection checks


Signed-off-by: Matthew Skinner <[email protected]>

* Fix Hikvision Digest stops ipcamera.mjpeg


Signed-off-by: Matthew Skinner <[email protected]>
  • Loading branch information
Skinah authored Oct 30, 2021
1 parent 4039bdc commit c8a7861
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,22 @@ public void channelRead(@Nullable ChannelHandlerContext ctx, @Nullable Object ms
incomingJpeg = new byte[bytesToRecieve];
}
}
} else {
// 401 errors already handled in pipeline by MyNettyAuthHandler.java
return;
}
}
if (msg instanceof HttpContent) {
if (mjpegUri.equals(requestUrl)) {
HttpContent content = (HttpContent) msg;
if (mjpegUri.equals(requestUrl) && !(content instanceof LastHttpContent)) {
// multiple MJPEG stream packets come back as this.
HttpContent content = (HttpContent) msg;
byte[] chunkedFrame = new byte[content.content().readableBytes()];
content.content().getBytes(content.content().readerIndex(), chunkedFrame);
CameraServlet localServlet = servlet;
if (localServlet != null) {
localServlet.openStreams.queueFrame(chunkedFrame);
}
} else {
HttpContent content = (HttpContent) msg;
// Found some cameras use Content-Type: image/jpg instead of image/jpeg
if (contentType.contains("image/jp")) {
for (int i = 0; i < content.content().capacity(); i++) {
Expand Down

0 comments on commit c8a7861

Please sign in to comment.