Only set the delta flag when all of the units in the packet are delta units.
Based on patch from Olivier CrĂȘte <olivier.crete@collabora.co.uk>
Fixes #632945
guint8 *data;
GstBuffer *outbuf = NULL;
GstClockTime out_timestamp;
guint8 *data;
GstBuffer *outbuf = NULL;
GstClockTime out_timestamp;
- gboolean delta, out_delta;
+ gboolean keyframe, out_keyframe;
size = GST_BUFFER_SIZE (nal);
if (G_UNLIKELY (size < 5))
size = GST_BUFFER_SIZE (nal);
if (G_UNLIKELY (size < 5))
nal_type = data[4] & 0x1f;
GST_DEBUG_OBJECT (rtph264depay, "handle NAL type %d", nal_type);
nal_type = data[4] & 0x1f;
GST_DEBUG_OBJECT (rtph264depay, "handle NAL type %d", nal_type);
- delta = !NAL_TYPE_IS_KEY (nal_type);
+ keyframe = NAL_TYPE_IS_KEY (nal_type);
+ out_keyframe = keyframe;
out_timestamp = in_timestamp;
if (rtph264depay->merge) {
out_timestamp = in_timestamp;
if (rtph264depay->merge) {
outbuf = gst_adapter_take_buffer (rtph264depay->picture_adapter, outsize);
out_timestamp = rtph264depay->last_ts;
outbuf = gst_adapter_take_buffer (rtph264depay->picture_adapter, outsize);
out_timestamp = rtph264depay->last_ts;
- out_delta = rtph264depay->last_delta;
+ out_keyframe = rtph264depay->last_keyframe;
- rtph264depay->last_delta = FALSE;
+ rtph264depay->last_keyframe = FALSE;
rtph264depay->picture_start = FALSE;
}
rtph264depay->picture_start = FALSE;
}
GST_DEBUG_OBJECT (depayload, "adding NAL to picture adapter");
gst_adapter_push (rtph264depay->picture_adapter, nal);
rtph264depay->last_ts = in_timestamp;
GST_DEBUG_OBJECT (depayload, "adding NAL to picture adapter");
gst_adapter_push (rtph264depay->picture_adapter, nal);
rtph264depay->last_ts = in_timestamp;
- rtph264depay->last_delta |= delta;
+ rtph264depay->last_keyframe |= keyframe;
rtph264depay->picture_start |= start;
} else {
/* no merge, output is input nal */
rtph264depay->picture_start |= start;
} else {
/* no merge, output is input nal */
GST_DEBUG_OBJECT (depayload, "prepending codec_data");
outbuf = gst_buffer_join (rtph264depay->codec_data, outbuf);
rtph264depay->codec_data = NULL;
GST_DEBUG_OBJECT (depayload, "prepending codec_data");
outbuf = gst_buffer_join (rtph264depay->codec_data, outbuf);
rtph264depay->codec_data = NULL;
}
outbuf = gst_buffer_make_metadata_writable (outbuf);
GST_BUFFER_TIMESTAMP (outbuf) = out_timestamp;
}
outbuf = gst_buffer_make_metadata_writable (outbuf);
GST_BUFFER_TIMESTAMP (outbuf) = out_timestamp;
- if (out_delta)
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
- else
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
+ else
+ GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
rtph264depay->wait_start = TRUE;
gst_adapter_clear (rtph264depay->picture_adapter);
rtph264depay->picture_start = FALSE;
rtph264depay->wait_start = TRUE;
gst_adapter_clear (rtph264depay->picture_adapter);
rtph264depay->picture_start = FALSE;
- rtph264depay->last_delta = FALSE;
+ rtph264depay->last_keyframe = FALSE;
GstAdapter *picture_adapter;
gboolean picture_start;
GstClockTime last_ts;
GstAdapter *picture_adapter;
gboolean picture_start;
GstClockTime last_ts;
+ gboolean last_keyframe;
};
struct _GstRtpH264DepayClass
};
struct _GstRtpH264DepayClass