rtph265depay: Factor out the code that push

This will be needed to implement draining on EOS.
This commit is contained in:
Nicolas Dufresne 2018-12-18 12:50:40 -05:00
parent e694e2752a
commit 65b01d5f02

View file

@ -1057,6 +1057,35 @@ gst_rtp_h265_complete_au (GstRtpH265Depay * rtph265depay,
#define NAL_TYPE_IS_KEY(nt) (NAL_TYPE_IS_PARAMETER_SET(nt) || NAL_TYPE_IS_IRAP(nt))
static void
gst_rtp_h265_depay_push (GstRtpH265Depay * rtph265depay, GstBuffer * outbuf,
gboolean keyframe, GstClockTime timestamp, gboolean marker)
{
/* prepend codec_data */
if (rtph265depay->codec_data) {
GST_DEBUG_OBJECT (rtph265depay, "prepending codec_data");
gst_rtp_copy_video_meta (rtph265depay, rtph265depay->codec_data, outbuf);
outbuf = gst_buffer_append (rtph265depay->codec_data, outbuf);
rtph265depay->codec_data = NULL;
keyframe = TRUE;
}
outbuf = gst_buffer_make_writable (outbuf);
gst_rtp_drop_non_video_meta (rtph265depay, outbuf);
GST_BUFFER_PTS (outbuf) = timestamp;
if (keyframe)
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
else
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
if (marker)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_MARKER);
gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtph265depay), outbuf);
}
static void
gst_rtp_h265_depay_handle_nal (GstRtpH265Depay * rtph265depay, GstBuffer * nal,
GstClockTime in_timestamp, gboolean marker)
@ -1151,29 +1180,8 @@ gst_rtp_h265_depay_handle_nal (GstRtpH265Depay * rtph265depay, GstBuffer * nal,
}
if (outbuf) {
/* prepend codec_data */
if (rtph265depay->codec_data) {
GST_DEBUG_OBJECT (depayload, "prepending codec_data");
gst_rtp_copy_video_meta (rtph265depay, rtph265depay->codec_data, outbuf);
outbuf = gst_buffer_append (rtph265depay->codec_data, outbuf);
rtph265depay->codec_data = NULL;
out_keyframe = TRUE;
}
outbuf = gst_buffer_make_writable (outbuf);
gst_rtp_drop_non_video_meta (rtph265depay, outbuf);
GST_BUFFER_PTS (outbuf) = out_timestamp;
if (out_keyframe)
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
else
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
if (marker)
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_MARKER);
gst_rtp_base_depayload_push (depayload, outbuf);
gst_rtp_h265_depay_push (rtph265depay, outbuf, out_keyframe, out_timestamp,
marker);
}
return;