Disable RTP probation zone by default
It makes more sense to disable it by default, especially when it's not platform-independent and has negative side effects (larger memory footprint)
This commit is contained in:
parent
3577b87379
commit
c4de5397fb
|
|
@ -28,7 +28,8 @@ Windows
|
|||
|
||||
Use `__RTP_SILENT__` to disable all prints
|
||||
|
||||
Use `__RTP_NO_PROBATION_ZONE__` to disable the probation zone allocation for RTP frames
|
||||
Use `__RTP_USE_PROBATION_ZONE__` to enable the probation zone allocation for RTP frames
|
||||
* See src/frame.hh for more details
|
||||
|
||||
Use `NDEBUG` to disable `LOG_DEBUG` which is the most verbose level of logging
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ kvz_rtp::frame::rtp_frame *kvz_rtp::frame::alloc_rtp_frame()
|
|||
std::memset(frame, 0, sizeof(kvz_rtp::frame::rtp_frame));
|
||||
|
||||
frame->payload = nullptr;
|
||||
|
||||
#if defined(__linux__) && defined(__RTP_USE_PROBATION_ZONE__)
|
||||
frame->probation = nullptr;
|
||||
#endif
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
|
@ -30,7 +33,7 @@ kvz_rtp::frame::rtp_frame *kvz_rtp::frame::alloc_rtp_frame(size_t payload_len)
|
|||
if ((frame = kvz_rtp::frame::alloc_rtp_frame()) == nullptr)
|
||||
return nullptr;
|
||||
|
||||
#if defined(__linux__) && !defined(__RTP_NO_PROBATION_ZONE__)
|
||||
#if defined(__linux__) && defined(__RTP_USE_PROBATION_ZONE__)
|
||||
frame->probation = new uint8_t[PROBATION_MAX_PKTS * MAX_PAYLOAD + payload_len];
|
||||
frame->probation_len = PROBATION_MAX_PKTS * MAX_PAYLOAD;
|
||||
frame->probation_off = 0;
|
||||
|
|
@ -56,8 +59,10 @@ rtp_error_t kvz_rtp::frame::dealloc_frame(kvz_rtp::frame::rtp_frame *frame)
|
|||
if (frame->ext)
|
||||
delete frame->ext;
|
||||
|
||||
#if defined(__linux__) && defined(__RTP_USE_PROBATION_ZONE__)
|
||||
if (frame->probation)
|
||||
delete[] frame->probation;
|
||||
#endif
|
||||
|
||||
else if (frame->payload)
|
||||
delete[] frame->payload;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace kvz_rtp {
|
|||
size_t padding_len; /* non-zero if frame is padded */
|
||||
size_t payload_len; /* payload_len: total_len - header_len - padding length (if padded) */
|
||||
|
||||
#if defined(__linux__) && !defined(__RTP_NO_PROBATION_ZONE__)
|
||||
#if defined(__linux__) && defined(__RTP_USE_PROBATION_ZONE__)
|
||||
/* Probation zone is a small area of free-to-use memory for the frame receiver
|
||||
* when handling fragments. For example HEVC fragments that belong to future frames
|
||||
* but cannot be relocated there (start sequence missing) are copied to probation
|
||||
|
|
@ -71,9 +71,7 @@ namespace kvz_rtp {
|
|||
* NOTE 1: Probation zone will increase the memory usage and will increase
|
||||
* the internal fragmentation as this memory is not usable for anything else
|
||||
*
|
||||
* NOTE 2: This is a Linux-only optimization
|
||||
*
|
||||
* Use -D__RTP_NO_PROBATION_ZONE__ to disable the optimization */
|
||||
* NOTE 2: This is a Linux-only optimization */
|
||||
size_t probation_len;
|
||||
size_t probation_off;
|
||||
uint8_t *probation;
|
||||
|
|
|
|||
Loading…
Reference in New Issue