Remember dropped frames
Store the timestamps of dropped frames so if later on a late packet is received, a new frame entry is not created for it
This commit is contained in:
parent
d28ceba7bb
commit
0ca027f0f7
|
|
@ -246,6 +246,12 @@ rtp_error_t __hevc_receiver(kvz_rtp::receiver *receiver)
|
||||||
/* initialize new frame */
|
/* initialize new frame */
|
||||||
if (finfo.find(c_ts) == finfo.end()) {
|
if (finfo.find(c_ts) == finfo.end()) {
|
||||||
|
|
||||||
|
/* make sure we haven't discarded the frame "c_ts" before */
|
||||||
|
if (dropped.find(c_ts) != dropped.end()) {
|
||||||
|
LOG_WARN("packet belonging to a dropped frame was received!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* when initializing a new frame, we need to keep twothings in mind:
|
/* when initializing a new frame, we need to keep twothings in mind:
|
||||||
* 1) new intra frame will supersede older intra frame
|
* 1) new intra frame will supersede older intra frame
|
||||||
* 2) new inter fame is accepted only if current intra has been returned
|
* 2) new inter fame is accepted only if current intra has been returned
|
||||||
|
|
@ -259,8 +265,10 @@ rtp_error_t __hevc_receiver(kvz_rtp::receiver *receiver)
|
||||||
|
|
||||||
/* drop old intra if a new one is received */
|
/* drop old intra if a new one is received */
|
||||||
if (nal_type == NT_INTRA) {
|
if (nal_type == NT_INTRA) {
|
||||||
if (intra != INVALID_TS)
|
if (intra != INVALID_TS) {
|
||||||
__drop_frame(finfo, intra);
|
__drop_frame(finfo, intra);
|
||||||
|
dropped.insert(intra);
|
||||||
|
}
|
||||||
intra = c_ts;
|
intra = c_ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,8 +344,10 @@ rtp_error_t __hevc_receiver(kvz_rtp::receiver *receiver)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__frame_late(finfo.at(c_ts))) {
|
if (__frame_late(finfo.at(c_ts))) {
|
||||||
if (nal_type != NT_INTRA || (nal_type == NT_INTRA && !enable_idelay))
|
if (nal_type != NT_INTRA || (nal_type == NT_INTRA && !enable_idelay)) {
|
||||||
__drop_frame(finfo, c_ts);
|
__drop_frame(finfo, c_ts);
|
||||||
|
dropped.insert(c_ts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (ret == RTP_OK);
|
} while (ret == RTP_OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue