mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
dvbsrc: pass the reason for failed read as GstFlowReturn
Make the _read_device function return a GstFlowReturn so that we can propagate this to the caller. This allows us to differentiate between poll errors and flushing state. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=674219
This commit is contained in:
parent
06b62e00ae
commit
a8af5334eb
1 changed files with 21 additions and 19 deletions
|
@ -897,8 +897,8 @@ gst_dvbsrc_plugin_init (GstPlugin * plugin)
|
||||||
GST_TYPE_DVBSRC);
|
GST_TYPE_DVBSRC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstFlowReturn
|
||||||
gst_dvbsrc_read_device (GstDvbSrc * object, int size)
|
gst_dvbsrc_read_device (GstDvbSrc * object, int size, GstBuffer ** buffer)
|
||||||
{
|
{
|
||||||
gint count = 0;
|
gint count = 0;
|
||||||
gint ret_val = 0;
|
gint ret_val = 0;
|
||||||
|
@ -906,10 +906,10 @@ gst_dvbsrc_read_device (GstDvbSrc * object, int size)
|
||||||
GstClockTime timeout = object->timeout * GST_USECOND;
|
GstClockTime timeout = object->timeout * GST_USECOND;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_BUFFER (buf), NULL);
|
g_return_val_if_fail (GST_IS_BUFFER (buf), GST_FLOW_ERROR);
|
||||||
|
|
||||||
if (object->fd_dvr < 0)
|
if (object->fd_dvr < 0)
|
||||||
return NULL;
|
return GST_FLOW_ERROR;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||||
while (count < size) {
|
while (count < size) {
|
||||||
|
@ -943,20 +943,25 @@ gst_dvbsrc_read_device (GstDvbSrc * object, int size)
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (buf, &map);
|
||||||
gst_buffer_resize (buf, 0, count);
|
gst_buffer_resize (buf, 0, count);
|
||||||
|
|
||||||
return buf;
|
*buffer = buf;
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
stopped:
|
stopped:
|
||||||
GST_DEBUG_OBJECT (object, "stop called");
|
{
|
||||||
gst_buffer_unmap (buf, &map);
|
GST_DEBUG_OBJECT (object, "stop called");
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unmap (buf, &map);
|
||||||
return NULL;
|
gst_buffer_unref (buf);
|
||||||
|
return GST_FLOW_WRONG_STATE;
|
||||||
|
}
|
||||||
select_error:
|
select_error:
|
||||||
GST_ELEMENT_ERROR (object, RESOURCE, READ, (NULL),
|
{
|
||||||
("select error %d: %s (%d)", ret_val, g_strerror (errno), errno));
|
GST_ELEMENT_ERROR (object, RESOURCE, READ, (NULL),
|
||||||
gst_buffer_unmap (buf, &map);
|
("select error %d: %s (%d)", ret_val, g_strerror (errno), errno));
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unmap (buf, &map);
|
||||||
return NULL;
|
gst_buffer_unref (buf);
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
@ -979,10 +984,7 @@ gst_dvbsrc_create (GstPushSrc * element, GstBuffer ** buf)
|
||||||
if (object->fd_dvr > -1) {
|
if (object->fd_dvr > -1) {
|
||||||
/* --- Read TS from DVR device --- */
|
/* --- Read TS from DVR device --- */
|
||||||
GST_DEBUG_OBJECT (object, "Reading from DVR device");
|
GST_DEBUG_OBJECT (object, "Reading from DVR device");
|
||||||
*buf = gst_dvbsrc_read_device (object, buffer_size);
|
retval = gst_dvbsrc_read_device (object, buffer_size, buf);
|
||||||
if (*buf != NULL) {
|
|
||||||
retval = GST_FLOW_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object->stats_interval != 0 &&
|
if (object->stats_interval != 0 &&
|
||||||
++object->stats_counter == object->stats_interval) {
|
++object->stats_counter == object->stats_interval) {
|
||||||
|
|
Loading…
Reference in a new issue