diff options
author | Benjamin Otte <otte@gnome.org> | 2009-09-04 14:06:09 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-09-09 16:45:53 +0200 |
commit | 9d4f72f2faca7ee4793870e52d62d99a87b47f36 (patch) | |
tree | 7fdba1d87698590e2991ffa294c63556681f7650 | |
parent | 7ba0a36a07bf19025866e490bab30a029bc092a9 (diff) |
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.
-rw-r--r-- | 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 fec96b14a..f7ab79cf8 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)) { |