GST_STATIC_CAPS ("application/x-rtp, "
"media = (string) \"video\", "
"clock-rate = (int) 90000, " "encoding-name = (string) \"H264\"")
- /** optional parameters **/
+ /* optional parameters */
/* "profile-level-id = (string) ANY, " */
/* "max-mbps = (string) ANY, " */
/* "max-fs = (string) ANY, " */
gst_adapter_clear (rtph264depay->adapter);
rtph264depay->wait_start = TRUE;
rtph264depay->current_fu_type = 0;
+ rtph264depay->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;
rtph264depay->current_fu_type = nal_unit_type;
rtph264depay->fu_timestamp = timestamp;
+ rtph264depay->last_fu_seqnum = gst_rtp_buffer_get_seq (rtp);
rtph264depay->wait_start = FALSE;
/* and assemble in the adapter */
gst_adapter_push (rtph264depay->adapter, outbuf);
} else {
+ if (rtph264depay->current_fu_type == 0) {
+ /* previous FU packet missing start bit? */
+ GST_WARNING_OBJECT (rtph264depay, "missing FU start bit on an "
+ "earlier packet. Dropping.");
+ gst_adapter_clear (rtph264depay->adapter);
+ return NULL;
+ }
+ if (gst_rtp_buffer_compare_seqnum (rtph264depay->last_fu_seqnum,
+ gst_rtp_buffer_get_seq (rtp)) != 1) {
+ /* jump in sequence numbers within an FU is cause for discarding */
+ GST_WARNING_OBJECT (rtph264depay, "Jump in sequence numbers from "
+ "%u to %u within Fragmentation Unit. Data was lost, dropping "
+ "stored.", rtph264depay->last_fu_seqnum,
+ gst_rtp_buffer_get_seq (rtp));
+ gst_adapter_clear (rtph264depay->adapter);
+ return NULL;
+ }
+ rtph264depay->last_fu_seqnum = gst_rtp_buffer_get_seq (rtp);
+
/* strip off FU indicator and FU header bytes */
payload += 2;
payload_len -= 2;