diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-06-15 17:26:15 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-08-13 16:38:53 +0200 |
commit | e882e1b533661cfb48e25ab170716a2fea55d6ba (patch) | |
tree | 365fc6c3944a6566472911a5278948511f2f5154 /plugins | |
parent | 73e27fb0173a9d5464597f0469c50f2a3294652d (diff) |
queue2: don't try to write 0 bytes
Diffstat (limited to 'plugins')
-rw-r--r-- | 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 c79c32763e..6d374f0a9d 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 */ |