Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 18 commits into from
Oct 30, 2021
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