gint error = CELT_OK;
/* get the header */
- celt_header_from_packet ((const unsigned char *) GST_BUFFER_DATA (buf),
+ error =
+ celt_header_from_packet ((const unsigned char *) GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf), &dec->header);
+ if (error < 0)
+ goto invalid_header;
if (memcmp (dec->header.codec_id, "CELT ", 8) != 0)
goto invalid_header;
unsigned char *data = g_malloc (header_size);
/* create header buffer */
- celt_header_to_packet (&enc->header, data, header_size);
+ int error = celt_header_to_packet (&enc->header, data, header_size);
+ if (error < 0) {
+ g_free (data);
+ goto no_header;
+ }
buf1 = gst_celt_enc_buffer_from_data (enc, data, header_size, 0);
/* create comment buffer */
goto done;
}
+no_header:
+ {
+ GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL),
+ ("Failed to encode header"));
+ ret = GST_FLOW_ERROR;
+ goto done;
+ }
}