From a0ffc95d5d1526595533109c4480c0603927d45c Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 4 Apr 2006 11:15:00 +0000 Subject: [PATCH] gst/videorate/gstvideorate.c (gst_video_rate_flush_prev): Properly handle the case where you get EOS before any buffe... Original commit message from CVS: 2006-04-04 Andy Wingo * 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 | 4 ++++ gst/videorate/gstvideorate.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5ec5a14e7..96c265ee08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-04-04 Andy Wingo + * 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. diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c index e92cf82a22..43b8d2e9ef 100644 --- a/gst/videorate/gstvideorate.c +++ b/gst/videorate/gstvideorate.c @@ -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: {