formats/media: Adjust fragment buffer offset correctly

Fragmented generic frames whose sequence numbers crossed the overflow
boundary were incorrectly reconstructed as the last fragments of the
frame were in the beginning of the buffer.
This commit is contained in:
Aaro Altonen 2021-04-23 08:55:47 +03:00
parent 4bbabba8c0
commit c7216c02a4
2 changed files with 7 additions and 2 deletions

View File

@ -19,7 +19,7 @@ namespace uvgrtp {
uint32_t e_seq;
size_t npkts;
size_t size;
std::map<uint16_t, uvgrtp::frame::rtp_frame *> fragments;
std::map<uint32_t, uvgrtp::frame::rtp_frame *> fragments;
} media_info_t;
typedef struct media_frame_info {

View File

@ -107,8 +107,13 @@ rtp_error_t uvgrtp::formats::media::packet_handler(void *arg, int flags, uvgrtp:
if (minfo->frames.find(ts) != minfo->frames.end()) {
minfo->frames[ts].npkts++;
minfo->frames[ts].fragments[seq] = frame;
minfo->frames[ts].size += frame->payload_len;
if (seq < minfo->frames[ts].s_seq)
minfo->frames[ts].fragments[seq + 0x10000] = frame;
else
minfo->frames[ts].fragments[seq] = frame;
*out = nullptr;
if (frame->header.marker)