[gst-cvs] gstreamer: queue2: don't try to write 0 bytes
Wim Taymans
wtay at kemper.freedesktop.org
Fri Aug 13 07:41:03 PDT 2010
Module: gstreamer
Branch: master
Commit: e882e1b533661cfb48e25ab170716a2fea55d6ba
URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=e882e1b533661cfb48e25ab170716a2fea55d6ba
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date: Tue Jun 15 17:26:15 2010 +0200
queue2: don't try to write 0 bytes
---
plugins/elements/gstqueue2.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c
index c79c327..6d374f0 100644
--- a/plugins/elements/gstqueue2.c
+++ b/plugins/elements/gstqueue2.c
@@ -1630,6 +1630,7 @@ gst_queue2_write_buffer_to_ring_buffer (GstQueue2 * queue, GstBuffer * buffer)
goto seek_failed;
if (new_writing_pos > writing_pos) {
+ GST_INFO_OBJECT (queue, "writing %u bytes", buf_size);
/* no wrapping, just write */
if (fwrite (data, buf_size, 1, queue->temp_file) != 1)
goto handle_error;
@@ -1640,16 +1641,22 @@ gst_queue2_write_buffer_to_ring_buffer (GstQueue2 * queue, GstBuffer * buffer)
block_one = rb_size - writing_pos;
block_two = buf_size - block_one;
- /* write data to end of ring buffer */
- if (fwrite (data, block_one, 1, queue->temp_file) != 1)
- goto handle_error;
+ if (block_one > 0) {
+ GST_INFO_OBJECT (queue, "writing %u bytes", block_one);
+ /* write data to end of ring buffer */
+ if (fwrite (data, block_one, 1, queue->temp_file) != 1)
+ goto handle_error;
+ }
if (FSEEK_FILE (queue->temp_file, 0))
goto seek_failed;
- data += block_one;
- if (fwrite (data, block_two, 1, queue->temp_file) != 1)
- goto handle_error;
+ if (block_two > 0) {
+ GST_INFO_OBJECT (queue, "writing %u bytes", block_two);
+ data += block_one;
+ if (fwrite (data, block_two, 1, queue->temp_file) != 1)
+ goto handle_error;
+ }
}
/* update the writing positions */
More information about the Gstreamer-commits
mailing list