[gst-cvs] gst-plugins-good: avidemux: only use stream' s pad after having checked it exists
Mark Nauwelaerts
mnauw at kemper.freedesktop.org
Mon Aug 10 05:47:56 PDT 2009
Module: gst-plugins-good
Branch: master
Commit: f67db2a0894d421521ca4247b804f554711b18fb
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=f67db2a0894d421521ca4247b804f554711b18fb
Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date: Tue Aug 4 19:45:43 2009 +0200
avidemux: only use stream's pad after having checked it exists
---
gst/avi/gstavidemux.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c
index 1f00b14..ad351bb 100644
--- a/gst/avi/gstavidemux.c
+++ b/gst/avi/gstavidemux.c
@@ -4242,11 +4242,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
GST_BUFFER_SIZE (buf) = size;
avi->offset += 8 + ((size + 1) & ~1);
- /* get time of this buffer */
stream = &avi->stream[stream_nr];
- gst_pad_query_position (stream->pad, &format, (gint64 *) & next_ts);
- if (G_UNLIKELY (format != GST_FORMAT_TIME))
- goto wrong_format;
/* set delay (if any)
if (stream->strh->init_frames == stream->current_frame &&
@@ -4257,12 +4253,19 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
stream->current_frame++;
stream->current_byte += size;
+ /* parsing of corresponding header may have failed */
if (G_UNLIKELY (!stream->pad)) {
- GST_WARNING ("No pad.");
+ GST_WARNING_OBJECT (avi, "no pad for stream ID %" GST_FOURCC_FORMAT,
+ GST_FOURCC_ARGS (tag));
gst_buffer_unref (buf);
} else {
GstClockTime dur_ts = 0;
+ /* get time of this buffer */
+ gst_pad_query_position (stream->pad, &format, (gint64 *) & next_ts);
+ if (G_UNLIKELY (format != GST_FORMAT_TIME))
+ goto wrong_format;
+
/* invert the picture if needed */
buf = gst_avi_demux_invert (stream, buf);
More information about the Gstreamer-commits
mailing list