mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 12:10:37 +00:00
plugins/elements/: Emit RESOURCE_NO_SPACE_LEFT error here as well when there's no space left on the device.
Original commit message from CVS: * plugins/elements/gstfdsink.c: (gst_fd_sink_render): * plugins/elements/gstfilesink.c: (gst_file_sink_render): Emit RESOURCE_NO_SPACE_LEFT error here as well when there's no space left on the device.
This commit is contained in:
parent
61ce17d6f3
commit
22482e1bbd
3 changed files with 40 additions and 12 deletions
|
@ -1,3 +1,10 @@
|
|||
2006-03-11 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* plugins/elements/gstfdsink.c: (gst_fd_sink_render):
|
||||
* plugins/elements/gstfilesink.c: (gst_file_sink_render):
|
||||
Emit RESOURCE_NO_SPACE_LEFT error here as well when
|
||||
there's no space left on the device.
|
||||
|
||||
2006-03-10 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/gstclock.h:
|
||||
|
|
|
@ -278,15 +278,13 @@ gst_fd_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
|
||||
GST_DEBUG ("writing %d bytes to file descriptor %d",
|
||||
GST_BUFFER_SIZE (buffer), fdsink->fd);
|
||||
/* FIXME: short writes are perfectly valid and may happen; also,
|
||||
* we should probably handle EINTR and EAGAIN in a non-fatal way */
|
||||
bytes_written =
|
||||
write (fdsink->fd, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer));
|
||||
fdsink->bytes_written += bytes_written;
|
||||
if (bytes_written != GST_BUFFER_SIZE (buffer)) {
|
||||
GST_ELEMENT_ERROR (fdsink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file descriptor \"%d\"."), fdsink->fd),
|
||||
("%s", g_strerror (errno)));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
if (bytes_written != GST_BUFFER_SIZE (buffer))
|
||||
goto write_error;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
@ -305,6 +303,21 @@ stopped:
|
|||
return GST_FLOW_WRONG_STATE;
|
||||
}
|
||||
#endif
|
||||
|
||||
write_error:
|
||||
{
|
||||
switch (errno) {
|
||||
case ENOSPC:
|
||||
GST_ELEMENT_ERROR (fdsink, RESOURCE, NO_SPACE_LEFT, (NULL), (NULL));
|
||||
break;
|
||||
default:{
|
||||
GST_ELEMENT_ERROR (fdsink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file descriptor \"%d\"."), fdsink->fd),
|
||||
("%s", g_strerror (errno)));
|
||||
}
|
||||
}
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -420,12 +420,20 @@ gst_file_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
return GST_FLOW_OK;
|
||||
|
||||
handle_error:
|
||||
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
("%s", g_strerror (errno)));
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
{
|
||||
switch (errno) {
|
||||
case ENOSPC:{
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, NO_SPACE_LEFT, (NULL), (NULL));
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||
("%s", g_strerror (errno)));
|
||||
}
|
||||
}
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue