summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2002-07-15 11:06:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2002-07-15 11:06:33 +0000
commit65a3d403916da3822eb634551c7f1b5ba066ad63 (patch)
treeb50730cf009a4e5caf59943651fefa9e69ac5497
parent6bdb41d5ec4a55de0357cc95664ba16262753202 (diff)
downloadgst-plugins-bad-65a3d403916da3822eb634551c7f1b5ba066ad63.tar.gz
gst-plugins-bad-65a3d403916da3822eb634551c7f1b5ba066ad63.tar.bz2
gst-plugins-bad-65a3d403916da3822eb634551c7f1b5ba066ad63.zip
avoid division by zero and add warning
Original commit message from CVS: avoid division by zero and add warning
-rw-r--r--gst-libs/gst/audio/audio.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c
index 56beb6dd..3494d3c0 100644
--- a/gst-libs/gst/audio/audio.c
+++ b/gst-libs/gst/audio/audio.c
@@ -25,7 +25,8 @@ gst_audio_frame_byte_size (GstPad* pad)
/* calculate byte size of an audio frame
* this should be moved closer to the gstreamer core
* and be implemented for every mime type IMO
- * returns 0 if there's an error, or the byte size if everything's ok
+ * returns -1 if there's an error (to avoid division by zero),
+ * or the byte size if everything's ok
*/
int width = 0;
@@ -37,8 +38,11 @@ gst_audio_frame_byte_size (GstPad* pad)
caps = GST_PAD_CAPS (pad);
if (caps == NULL)
+ {
/* ERROR: could not get caps of pad */
+ g_error ("gstaudio: warning: could not get caps of pad %p\n", pad);
return 0;
+ }
gst_caps_get_int (caps, "width", &width);
gst_caps_get_int (caps, "channels", &channels);