gentlsrc: try again if we get a non-image payload type

This commit is contained in:
Joshua M. Doe 2021-05-26 10:59:06 -04:00
parent 92b43c3e0a
commit 0068a0f4b0

View File

@ -1471,6 +1471,9 @@ gst_gentlsrc_get_buffer (GstGenTlSrc * src)
GstClockTime unix_ts;
uint64_t buf_timestamp_ticks;
/* sometimes we get non-image payloads, try several times for an image */
for (int i = 0; i < 5; ++i) {
datasize = sizeof (new_buffer_data);
ret =
GTL_EventGetData (src->hNewBufferEvent, &new_buffer_data, &datasize,
@ -1482,6 +1485,14 @@ gst_gentlsrc_get_buffer (GstGenTlSrc * src)
GTL_DSGetBufferInfo (src->hDS, new_buffer_data.BufferHandle,
BUFFER_INFO_PAYLOADTYPE, &datatype, &payload_type, &datasize);
HANDLE_GTL_ERROR ("Failed to get payload type");
if (payload_type != PAYLOAD_TYPE_IMAGE) {
GST_WARNING_OBJECT (src, "Non-image payload type, trying again");
continue;
} else {
break;
}
}
if (payload_type != PAYLOAD_TYPE_IMAGE) {
GST_ELEMENT_ERROR (src, STREAM, TOO_LAZY,
("Unsupported payload type: %d", payload_type), (NULL));