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 <matt@pcmus.com>

* Improve and fix generic cams


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Stop dahua IntelliFrame logging


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Catch IllegalStateException


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Trial reusing channels.


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Tidy up


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* cleanup 2


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Cleanup 3


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Disable checking connection with event stream.


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Bug fix


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* more cleanup


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* more cleanup

Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Reduce logging to only whats needed.


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* fix offline detection.


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* fixes to ipcamera.mjpeg


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* reverse some connection checks


Signed-off-by: Matthew Skinner <matt@pcmus.com>

* Fix Hikvision Digest stops ipcamera.mjpeg


Signed-off-by: Matthew Skinner <matt@pcmus.com>
  • Loading branch information
Skinah authored and Nemer_Daud committed Jan 28, 2022
1 parent e2b3de3 commit a93a9b1
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 a93a9b1

Please sign in to comment.