ossrs / srs-gb28181

GB28181 server based on SRS
https://ossrs.net
MIT License
83 stars 41 forks source link

BUG报告,void SrsRtpFrameBuffer::ShiftSubsequentPackets 如果packets_为空会出现异常 #37

Open vicent-q opened 2 years ago

vicent-q commented 2 years ago

修正如下:

void SrsRtpFrameBuffer::ShiftSubsequentPackets(PacketIterator it, int steps_toshift) { if (it != packets.end()) { ++it; } if (it == packets_.end()) { return; }

uint8_t* first_packet_ptr = const_cast<uint8_t*>((*it).dataPtr);
int shift_length = 0;

// Calculate the total move length and move the data pointers in advance.
for (; it != packets_.end(); ++it) {
    shift_length += (*it).sizeBytes;

    if ((*it).dataPtr != NULL) {
        (*it).dataPtr += steps_to_shift;
    }
}

memmove(first_packet_ptr + steps_to_shift, first_packet_ptr, shift_length);

}