mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:16:13 +00:00
timecodestamper: Improve error handling and don't crash
Post a bus message explaining that input buffers must have timestamps and return GST_FLOW_ERROR, instead of a confusing NOT-NEGOTIATED Also remove an errant buffer unref in the error handling that would lead to crashes after. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5935>
This commit is contained in:
parent
e3fe89aba8
commit
5e4e57ddb3
1 changed files with 13 additions and 4 deletions
|
@ -1119,10 +1119,19 @@ gst_timecodestamper_transform_ip (GstBaseTransform * vfilter,
|
||||||
GstFlowReturn flow_ret = GST_FLOW_OK;
|
GstFlowReturn flow_ret = GST_FLOW_OK;
|
||||||
GstVideoTimeCodeFlags tc_flags = 0;
|
GstVideoTimeCodeFlags tc_flags = 0;
|
||||||
|
|
||||||
if (timecodestamper->fps_n == 0 || timecodestamper->fps_d == 0
|
if (timecodestamper->fps_n == 0 || timecodestamper->fps_d == 0) {
|
||||||
|| !GST_BUFFER_PTS_IS_VALID (buffer)) {
|
/* This can't actually happen I think - the caps template requires a framerate,
|
||||||
gst_buffer_unref (buffer);
|
* so we'd have to receive a buffer without prior caps */
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
GST_ELEMENT_ERROR (timecodestamper, STREAM, FAILED,
|
||||||
|
("Can't process without a framerate"),
|
||||||
|
("Received a video buffer without framerate"));
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
if (!GST_BUFFER_PTS_IS_VALID (buffer)) {
|
||||||
|
GST_ELEMENT_ERROR (timecodestamper, STREAM, FAILED,
|
||||||
|
("Input video buffer has no timestamp"),
|
||||||
|
("Video buffers must have timestamps"));
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
#if HAVE_LTC
|
#if HAVE_LTC
|
||||||
if (timecodestamper->video_latency == -1
|
if (timecodestamper->video_latency == -1
|
||||||
|
|
Loading…
Reference in a new issue