mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 04:52:28 +00:00
kateenc: Don't error on empty input buffers
This commit is contained in:
parent
c92efe38e9
commit
6786f8c7bf
1 changed files with 17 additions and 19 deletions
|
@ -952,10 +952,15 @@ gst_kate_enc_chain_text (GstKateEnc * ke, GstBuffer * buf,
|
||||||
rflow = GST_FLOW_ERROR;
|
rflow = GST_FLOW_ERROR;
|
||||||
} else {
|
} else {
|
||||||
const char *text = (const char *) GST_BUFFER_DATA (buf);
|
const char *text = (const char *) GST_BUFFER_DATA (buf);
|
||||||
if (text) {
|
|
||||||
size_t text_len = GST_BUFFER_SIZE (buf);
|
size_t text_len = GST_BUFFER_SIZE (buf);
|
||||||
kate_float t0 = start / (double) GST_SECOND;
|
kate_float t0 = start / (double) GST_SECOND;
|
||||||
kate_float t1 = stop / (double) GST_SECOND;
|
kate_float t1 = stop / (double) GST_SECOND;
|
||||||
|
|
||||||
|
if (text == NULL) {
|
||||||
|
text = "";
|
||||||
|
text_len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (ke, "Encoding text: %*.*s (%u bytes) from %f to %f",
|
GST_LOG_OBJECT (ke, "Encoding text: %*.*s (%u bytes) from %f to %f",
|
||||||
(int) text_len, (int) text_len, GST_BUFFER_DATA (buf),
|
(int) text_len, (int) text_len, GST_BUFFER_DATA (buf),
|
||||||
GST_BUFFER_SIZE (buf), t0, t1);
|
GST_BUFFER_SIZE (buf), t0, t1);
|
||||||
|
@ -965,14 +970,7 @@ gst_kate_enc_chain_text (GstKateEnc * ke, GstBuffer * buf,
|
||||||
("Failed to encode text: %d", ret));
|
("Failed to encode text: %d", ret));
|
||||||
rflow = GST_FLOW_ERROR;
|
rflow = GST_FLOW_ERROR;
|
||||||
} else {
|
} else {
|
||||||
rflow =
|
rflow = gst_kate_enc_chain_push_packet (ke, &kp, start, stop - start + 1);
|
||||||
gst_kate_enc_chain_push_packet (ke, &kp, start, stop - start + 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* FIXME: this should not be an error, we should ignore it and move on */
|
|
||||||
GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
|
|
||||||
("no text in text packet"));
|
|
||||||
rflow = GST_FLOW_ERROR;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue