}
}
+static GstBuffer *
+gst_rtp_h264_complete_au (GstRtpH264Depay * rtph264depay,
+ GstClockTime * out_timestamp, gboolean * out_keyframe)
+{
+ guint outsize;
+ GstBuffer *outbuf;
+
+ /* we had a picture in the adapter and we completed it */
+ GST_DEBUG_OBJECT (rtph264depay, "taking completed AU");
+ outsize = gst_adapter_available (rtph264depay->picture_adapter);
+ outbuf = gst_adapter_take_buffer (rtph264depay->picture_adapter, outsize);
+
+ *out_timestamp = rtph264depay->last_ts;
+ *out_keyframe = rtph264depay->last_keyframe;
+
+ rtph264depay->last_keyframe = FALSE;
+ rtph264depay->picture_start = FALSE;
+
+ return outbuf;
+}
+
/* SPS/PPS/IDR considered key, all others DELTA;
* so downstream waiting for keyframe can pick up at SPS/PPS/IDR */
#define NAL_TYPE_IS_KEY(nt) (((nt) == 5) || ((nt) == 7) || ((nt) == 8))
static gboolean
gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
- GstClockTime in_timestamp)
+ GstClockTime in_timestamp, gboolean marker)
{
GstBaseRTPDepayload *depayload = GST_BASE_RTP_DEPAYLOAD (rtph264depay);
gint nal_type;
}
GST_DEBUG_OBJECT (depayload, "start %d, complete %d", start, complete);
- if (complete && rtph264depay->picture_start) {
- guint outsize;
-
- /* we had a picture in the adapter and we completed it */
- GST_DEBUG_OBJECT (depayload, "taking completed AU");
- outsize = gst_adapter_available (rtph264depay->picture_adapter);
- outbuf = gst_adapter_take_buffer (rtph264depay->picture_adapter, outsize);
-
- out_timestamp = rtph264depay->last_ts;
- out_keyframe = rtph264depay->last_keyframe;
-
- rtph264depay->last_keyframe = FALSE;
- rtph264depay->picture_start = FALSE;
- }
+ if (complete && rtph264depay->picture_start)
+ outbuf = gst_rtp_h264_complete_au (rtph264depay, &out_timestamp,
+ &out_keyframe);
/* add to adapter */
GST_DEBUG_OBJECT (depayload, "adding NAL to picture adapter");
rtph264depay->last_ts = in_timestamp;
rtph264depay->last_keyframe |= keyframe;
rtph264depay->picture_start |= start;
+
+ if (marker)
+ outbuf = gst_rtp_h264_complete_au (rtph264depay, &out_timestamp,
+ &out_keyframe);
} else {
/* no merge, output is input nal */
GST_DEBUG_OBJECT (depayload, "using NAL as output");
guint8 *outdata;
guint outsize, nalu_size;
GstClockTime timestamp;
+ gboolean marker;
timestamp = GST_BUFFER_TIMESTAMP (buf);
payload_len = gst_rtp_buffer_get_payload_len (buf);
payload = gst_rtp_buffer_get_payload (buf);
+ marker = gst_rtp_buffer_get_marker (buf);
GST_DEBUG_OBJECT (rtph264depay, "receiving %d bytes", payload_len);
outsize = gst_adapter_available (rtph264depay->adapter);
outbuf = gst_adapter_take_buffer (rtph264depay->adapter, outsize);
- gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp);
+ gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp, marker);
break;
}
case 26:
outdata[2] = (outsize >> 8);
outdata[3] = (outsize);
}
- gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp);
+ gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp,
+ marker);
}
break;
}
outdata += sizeof (sync_bytes);
memcpy (outdata, payload, nalu_size);
- gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp);
+ gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp, marker);
break;
}
}