[gst-cvs] gst-plugins-base: theora: Add assertions that functions don't fail
Sebastian Dröge
slomo at kemper.freedesktop.org
Wed Sep 9 07:46:16 PDT 2009
Module: gst-plugins-base
Branch: master
Commit: 9d4f72f2faca7ee4793870e52d62d99a87b47f36
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=9d4f72f2faca7ee4793870e52d62d99a87b47f36
Author: Benjamin Otte <otte at gnome.org>
Date: Fri Sep 4 14:06:09 2009 +0200
theora: Add assertions that functions don't fail
Some functions in libtheora can return an error, but that error cannot
ever happen inside theoraenc. In those cases assert that it doesn't.
---
ext/theora/theoraenc.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ext/theora/theoraenc.c b/ext/theora/theoraenc.c
index fec96b1..f7ab79c 100644
--- a/ext/theora/theoraenc.c
+++ b/ext/theora/theoraenc.c
@@ -351,8 +351,12 @@ theora_enc_finalize (GObject * object)
static void
theora_enc_reset (GstTheoraEnc * enc)
{
+ int result;
+
theora_clear (&enc->state);
- theora_encode_init (&enc->state, &enc->info);
+ result = theora_encode_init (&enc->state, &enc->info);
+ /* We ensure this function cannot fail. */
+ g_assert (result == 0);
#ifdef TH_ENCCTL_SET_SPLEVEL
theora_control (&enc->state, TH_ENCCTL_SET_SPLEVEL, &enc->speed_level,
sizeof (enc->speed_level));
@@ -1062,6 +1066,8 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
}
res = theora_encode_YUVin (&enc->state, &yuv);
+ /* none of the failure cases can happen here */
+ g_assert (res == 0);
ret = GST_FLOW_OK;
while (theora_encode_packetout (&enc->state, 0, &op)) {
More information about the Gstreamer-commits
mailing list