ccconverter: also copy buffer metadata when draining

Fixes buffers without PTS/DTS/meta/etc when receiving an EOS with data
still stored in the internal scratch buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1318>
This commit is contained in:
Matthew Waters 2020-06-02 17:35:00 +10:00 committed by GStreamer Merge Bot
parent 00bbaff371
commit bfd03537f0

View file

@ -2195,6 +2195,7 @@ reset_counters (GstCCConverter * self)
static GstFlowReturn
drain_input (GstCCConverter * self)
{
GstBaseTransformClass *bclass = GST_BASE_TRANSFORM_GET_CLASS (self);
GstBaseTransform *trans = GST_BASE_TRANSFORM (self);
GstFlowReturn ret = GST_FLOW_OK;
@ -2202,8 +2203,22 @@ drain_input (GstCCConverter * self)
|| self->scratch_cea608_2_len > 0 || can_generate_output (self)) {
GstBuffer *outbuf;
if (!self->previous_buffer) {
GST_WARNING_OBJECT (self, "Attempt to draining without a previous "
"buffer. Aborting");
return GST_FLOW_OK;
}
outbuf = gst_buffer_new_allocate (NULL, MAX_CDP_PACKET_LEN, NULL);
if (bclass->copy_metadata) {
if (!bclass->copy_metadata (trans, self->previous_buffer, outbuf)) {
/* something failed, post a warning */
GST_ELEMENT_WARNING (self, STREAM, NOT_IMPLEMENTED,
("could not copy metadata"), (NULL));
}
}
ret = gst_cc_converter_transform (self, NULL, outbuf);
if (gst_buffer_get_size (outbuf) <= 0) {
/* try to move the output along */