mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-01 01:33:52 +00:00
Make filesink fail with some grace, see #114614
Original commit message from CVS: Make filesink fail with some grace, see #114614
This commit is contained in:
parent
1c17e4700b
commit
63bc38c519
2 changed files with 30 additions and 16 deletions
|
@ -365,7 +365,6 @@ static void
|
||||||
gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
GstFileSink *filesink;
|
GstFileSink *filesink;
|
||||||
gint bytes_written = 0;
|
|
||||||
|
|
||||||
g_return_if_fail (pad != NULL);
|
g_return_if_fail (pad != NULL);
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
|
@ -381,13 +380,21 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))
|
if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))
|
||||||
{
|
{
|
||||||
bytes_written = fwrite (GST_BUFFER_DATA (buf), 1,
|
size_t bytes_written = 0;
|
||||||
GST_BUFFER_SIZE (buf), filesink->file);
|
do {
|
||||||
if (bytes_written < GST_BUFFER_SIZE (buf))
|
size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1,
|
||||||
{
|
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||||
g_warning ("filesink: %d bytes should be written, only %d bytes written\n",
|
filesink->file);
|
||||||
GST_BUFFER_SIZE (buf), bytes_written);
|
if (wrote <= 0) {
|
||||||
}
|
gst_element_error (GST_ELEMENT (filesink),
|
||||||
|
"Only %d of %d bytes written: %s",
|
||||||
|
bytes_written, GST_BUFFER_SIZE (buf),
|
||||||
|
strerror (errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bytes_written += wrote;
|
||||||
|
} while (bytes_written < GST_BUFFER_SIZE (buf));
|
||||||
|
|
||||||
filesink->data_written += bytes_written;
|
filesink->data_written += bytes_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,6 @@ static void
|
||||||
gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
GstFileSink *filesink;
|
GstFileSink *filesink;
|
||||||
gint bytes_written = 0;
|
|
||||||
|
|
||||||
g_return_if_fail (pad != NULL);
|
g_return_if_fail (pad != NULL);
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
|
@ -381,13 +380,21 @@ gst_filesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))
|
if (GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))
|
||||||
{
|
{
|
||||||
bytes_written = fwrite (GST_BUFFER_DATA (buf), 1,
|
size_t bytes_written = 0;
|
||||||
GST_BUFFER_SIZE (buf), filesink->file);
|
do {
|
||||||
if (bytes_written < GST_BUFFER_SIZE (buf))
|
size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1,
|
||||||
{
|
GST_BUFFER_SIZE (buf) - bytes_written,
|
||||||
g_warning ("filesink: %d bytes should be written, only %d bytes written\n",
|
filesink->file);
|
||||||
GST_BUFFER_SIZE (buf), bytes_written);
|
if (wrote <= 0) {
|
||||||
}
|
gst_element_error (GST_ELEMENT (filesink),
|
||||||
|
"Only %d of %d bytes written: %s",
|
||||||
|
bytes_written, GST_BUFFER_SIZE (buf),
|
||||||
|
strerror (errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bytes_written += wrote;
|
||||||
|
} while (bytes_written < GST_BUFFER_SIZE (buf));
|
||||||
|
|
||||||
filesink->data_written += bytes_written;
|
filesink->data_written += bytes_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue