[ipcamera] Fix Hikvision digest stopping ipcamera.mjpeg (#11457)

* 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>
This commit is contained in:
Matthew Skinner 2021-10-31 03:00:34 +11:00 committed by GitHub
parent 5ee3a08d42
commit 73b4dbe14f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -252,12 +252,15 @@ public class IpCameraHandler extends BaseThingHandler {
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;
@ -265,7 +268,6 @@ public class IpCameraHandler extends BaseThingHandler {
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++) {