GST_STATIC_CAPS ("application/x-rtp, "
"media = (string) \"video\", "
"clock-rate = (int) 90000, " "encoding-name = (string) \"H265\"")
- /** optional parameters **/
+ /* optional parameters */
/* "profile-space = (int) [ 0, 3 ], " */
/* "profile-id = (int) [ 0, 31 ], " */
/* "tier-flag = (int) [ 0, 1 ], " */
gst_adapter_clear (rtph265depay->adapter);
rtph265depay->wait_start = TRUE;
rtph265depay->current_fu_type = 0;
+ rtph265depay->last_fu_seqnum = 0;
}
{
nalu_size = (payload[0] << 8) | payload[1];
- /* dont include nalu_size */
+ /* don't include nalu_size */
if (nalu_size > (payload_len - 2))
nalu_size = payload_len - 2;
rtph265depay->current_fu_type = nal_unit_type;
rtph265depay->fu_timestamp = timestamp;
+ rtph265depay->last_fu_seqnum = gst_rtp_buffer_get_seq (rtp);
rtph265depay->wait_start = FALSE;
/* and assemble in the adapter */
gst_adapter_push (rtph265depay->adapter, outbuf);
} else {
+ if (rtph265depay->current_fu_type == 0) {
+ /* previous FU packet missing start bit? */
+ GST_WARNING_OBJECT (rtph265depay, "missing FU start bit on an "
+ "earlier packet. Dropping.");
+ gst_adapter_clear (rtph265depay->adapter);
+ return NULL;
+ }
+ if (gst_rtp_buffer_compare_seqnum (rtph265depay->last_fu_seqnum,
+ gst_rtp_buffer_get_seq (rtp)) != 1) {
+ /* jump in sequence numbers within an FU is cause for discarding */
+ GST_WARNING_OBJECT (rtph265depay, "Jump in sequence numbers from "
+ "%u to %u within Fragmentation Unit. Data was lost, dropping "
+ "stored.", rtph265depay->last_fu_seqnum,
+ gst_rtp_buffer_get_seq (rtp));
+ gst_adapter_clear (rtph265depay->adapter);
+ return NULL;
+ }
+ rtph265depay->last_fu_seqnum = gst_rtp_buffer_get_seq (rtp);
GST_DEBUG_OBJECT (rtph265depay,
"Following part of Fragmentation Unit");