gst/videorate/gstvideorate.c (gst_video_rate_flush_prev): Properly handle the case...
authorAndy Wingo <wingo@pobox.com>
Tue, 4 Apr 2006 11:15:00 +0000 (11:15 +0000)
committerAndy Wingo <wingo@pobox.com>
Tue, 4 Apr 2006 11:15:00 +0000 (11:15 +0000)
Original commit message from CVS:
2006-04-04  Andy Wingo  <wingo@pobox.com>

* gst/videorate/gstvideorate.c (gst_video_rate_flush_prev):
Properly handle the case where you get EOS before any buffers are
received. Use gst_buffer_make_metadata_writable where appropriate.

ChangeLog
gst/videorate/gstvideorate.c

index c5ec5a1..96c265e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-04-04  Andy Wingo  <wingo@pobox.com>
 
+       * gst/videorate/gstvideorate.c (gst_video_rate_flush_prev):
+       Properly handle the case where you get EOS before any buffers are
+       received. Use gst_buffer_make_metadata_writable where appropriate.
+
        * ext/theora/theoradec.c (theora_handle_data_packet): This value
        is often negative -- make it signed so as not to wrap around.
        Fixes segfaults introduced on 9 March.
index e92cf82..43b8d2e 100644 (file)
@@ -405,10 +405,11 @@ gst_video_rate_flush_prev (GstVideoRate * videorate)
   GstBuffer *outbuf;
   GstClockTime push_ts;
 
+  if (!videorate->prevbuf)
+    goto eos_before_buffers;
+
   /* make sure we can write to the metadata */
-  outbuf =
-      gst_buffer_create_sub (videorate->prevbuf, 0,
-      GST_BUFFER_SIZE (videorate->prevbuf));
+  outbuf = gst_buffer_make_metadata_writable (videorate->prevbuf);
 
   /* this is the timestamp we put on the buffer */
   push_ts = videorate->next_ts;
@@ -436,6 +437,12 @@ gst_video_rate_flush_prev (GstVideoRate * videorate)
 
   return res;
 
+  /* WARNINGS */
+eos_before_buffers:
+  {
+    GST_INFO_OBJECT (videorate, "got EOS before any buffer was received");
+    return GST_FLOW_OK;
+  }
   /* ERRORS */
 push_error:
   {