]> git.basschouten.com Git - openhab-addons.git/commitdiff
[ipcamera] Fix Hikvision digest stopping ipcamera.mjpeg (#11457)
authorMatthew Skinner <matt@pcmus.com>
Sat, 30 Oct 2021 16:00:34 +0000 (03:00 +1100)
committerGitHub <noreply@github.com>
Sat, 30 Oct 2021 16:00:34 +0000 (18:00 +0200)
* 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>
bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/handler/IpCameraHandler.java

index b96ff172083e37e96b5bde5e58cfc797c56f2167..f88f669094841aefb7d8fc36c7f852badb6efa06 100644 (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++) {