libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] chunked encoding & mjpeg stream


From: folkert
Subject: [libmicrohttpd] chunked encoding & mjpeg stream
Date: Sun, 27 Feb 2022 23:06:31 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

Hello,

Some browsers (like chrome and firefox) get confused when showing an
mjpeg-stream when produced by libmicrohttpd. Most likely this is caused
by the chunked encoding.

An MJPEG stream consists of a "multipart/x-mixed-replace" http-stream of
jpeg images. After every jpeg frame, a multipart-header is added -
regular ascii with \r\n.
E.g.:

\r\n
--myboundary123\r\n
Content-Type: image/jpeg\r\n
Content-Length: 1234\r\n
\r\n
[... data ...]

Chunked encoding adds some data to it:

[pid 27739] sendto(7, "3A74\r\n\r\n--12345\r\nContent-Type: 
image/jpeg\r\nContent-Length: 83519\r\n\r\n\
                       ^^^^^^^^
and because of that, the browser often displays no video-frames at all
or only partially.

If I use a http-server which does not produce chunked encoding, things
work fine.

I would like to suggest to add a switch of some sort to disable chunked
encoding. I don't believe it is neccessary for things like mjpeg as the
size of each segment is already included ("Content-Length: 83519\r\n") in
multipart-scheme.


Regards



reply via email to

[Prev in Thread] Current Thread [Next in Thread]