In particular, handle the case of an empty packet with size 0 bytes.
Partially fixes: #712643
switch (dvdspu->spu_input_type) {
case SPU_INPUT_TYPE_VOBSUB:
switch (dvdspu->spu_input_type) {
case SPU_INPUT_TYPE_VOBSUB:
guint8 header[2];
guint16 packet_size;
guint8 header[2];
guint16 packet_size;
if (packet_size == size) {
submit_new_spu_packet (dvdspu, dvdspu->partial_spu);
dvdspu->partial_spu = NULL;
if (packet_size == size) {
submit_new_spu_packet (dvdspu, dvdspu->partial_spu);
dvdspu->partial_spu = NULL;
+ } else if (packet_size == 0) {
+ GST_LOG_OBJECT (dvdspu, "Discarding empty SPU buffer");
+ gst_buffer_unref (dvdspu->partial_spu);
+ dvdspu->partial_spu = NULL;
} else if (packet_size < size) {
/* Somehow we collected too much - something is wrong. Drop the
* packet entirely and wait for a new one */
} else if (packet_size < size) {
/* Somehow we collected too much - something is wrong. Drop the
* packet entirely and wait for a new one */