ONVIF™ – 16 – Streaming – Ver. 23.06
Otherwise (at least an empty header extension as specified above is present in the initial packet of a frame),
the following rules apply for each such frame:
•
If the initial packet of a frame does not contain an entropy-encoded scan data segment, but contains a
header extension as specified above, then decoders shall concatenate its header extension payload
with (possibly empty or not existing) header extension payload(s) conforming to this specification of
the subsequent packets up to and including the first packet with the RTP marker bit set or containing
an entropy-encoded scan data segment.
•
The concatenated initial RTP header extension payload (sequence) shall be logically prepended with
a JPEG SOI marker (0xFFD8).
•
If the Q-value of the RTP/JPEG scan header within the initial packet of a frame is not zero, the quan-
tization tables shall be pre-initialized according to the rules of [RFC 2435]. If Q is equal to zero the
quantization tables shall be copied from the previous frame, allowing for DQT markers within this initial
header extension payload (sequence) to override them.
•
If this frame is the initial frame of a sequence, the Huffman tables shall be pre-initialized according to
[RFC 2435]. The Huffman tables for all subsequent frames shall be copied from the previous frame,
allowing the frames to be overridden by DHT markers within the initial header extension payload (se-
quence).
•
If the initial RTP header extension payload (sequence) supplies no DRI marker, but the RTP/JPEG
header of the initial packet of a frame contains an RTP/JPEG restart marker, a DRI marker correspond-
ing to the rules of [RFC 2435] shall be appended to the initial header extension payload (sequence).
Otherwise, if the initial RTP header extension (sequence) supplies a DRI marker, the marker shall take
precedence over any other RTP/JPEG restart marker according to [RFC 2435] for the same frame.
However, for compatibility with decoders conforming to [RFC 2435] only, encoders normally should
use an RTP/JPEG restart marker with consistent values, if restart intervals are to be used.
•
DRI markers shall NOT be derived from previous frames.
•
If the initial RTP header extension payload (sequence) supplies no SOF marker, which otherwise takes
precedence, a SOF marker shall be appended to it with the following values:
○ If both the width and height field of the RTP/JPEG header are zero, the SOF marker of the
previous frame shall be used.
○ Otherwise it shall be derived according to the rules of [RFC 2435].
However, as long as the (rounded up) image size fits within the range as specified in [RFC 2435],
encoders should specify the image size within the RTP/JPEG header consistent with the values of an
additional SOF header.
•
If the initial header extension payload (sequence) supplies no SOS marker, a corresponding marker
shall be derived according to [RFC 2435] and appended to it, otherwise the SOS marker in the exten-
sion takes precedence.
An SOS marker shall NOT be derived from previous frames.
If the SOS marker is present and not followed by entropy-encoded scan data within the extension, the
marker shall be the final marker within the initial extension payload (sequence) of a frame. Necessary
padding with 0xFF-octets shall NOT follow this marker but MAY precede it.
•
The remaining entropy-encoded scan data and header extensions payloads shall be logically append-
ed in the same order as they occur within the RTP stream up to the end of the frame as indicated by
the RTP marker bit. A final EOI marker shall also be added if it is not yet present within the logical
sequence for this frame,.
For each frame, the resulting sequence up to and including the first (possibly added) EOI marker shall
be a valid (possibly abbreviated) JPEG stream, resulting in one complete image from the decoding