summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2012-08-08 10:56:51 +0100
committerTim-Philipp Müller <tim@centricular.net>2012-08-08 11:07:55 +0100
commit4de8bd004c78630b1a025f5c7e93e415ae19276c (patch)
tree370fb152bcaa2f522bd0f450c5ee949985c7a288
parentb4ff570532c73986d133f6c3041eec09a9e9c60a (diff)
downloadgstreamer-plugins-good-4de8bd004c78630b1a025f5c7e93e415ae19276c.tar.gz
No code with side-effects inside g_assert() please
-rw-r--r--ext/jpeg/gstjpegdec.c10
-rw-r--r--ext/libpng/gstpngdec.c10
-rw-r--r--gst/isomp4/gstqtmoovrecover.c3
-rw-r--r--tests/icles/ximagesrc-test.c12
4 files changed, 20 insertions, 15 deletions
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index bf542f2b5..54abe4ec1 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -1316,15 +1316,17 @@ invalid_yuvrgbgrayscale:
static gboolean
gst_jpeg_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
{
- GstBufferPool *pool;
+ GstBufferPool *pool = NULL;
GstStructure *config;
if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (bdec, query))
return FALSE;
- g_assert (gst_query_get_n_allocation_pools (query) > 0);
- gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
- g_assert (pool != NULL);
+ if (gst_query_get_n_allocation_pools (query) > 0)
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
+
+ if (pool == NULL)
+ return FALSE;
config = gst_buffer_pool_get_config (pool);
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
diff --git a/ext/libpng/gstpngdec.c b/ext/libpng/gstpngdec.c
index c173343fa..11789584a 100644
--- a/ext/libpng/gstpngdec.c
+++ b/ext/libpng/gstpngdec.c
@@ -394,15 +394,17 @@ beach:
static gboolean
gst_pngdec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
{
- GstBufferPool *pool;
+ GstBufferPool *pool = NULL;
GstStructure *config;
if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (bdec, query))
return FALSE;
- g_assert (gst_query_get_n_allocation_pools (query) > 0);
- gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
- g_assert (pool != NULL);
+ if (gst_query_get_n_allocation_pools (query) > 0)
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
+
+ if (pool == NULL)
+ return FALSE;
config = gst_buffer_pool_get_config (pool);
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
diff --git a/gst/isomp4/gstqtmoovrecover.c b/gst/isomp4/gstqtmoovrecover.c
index 343678cfa..07fd35a6f 100644
--- a/gst/isomp4/gstqtmoovrecover.c
+++ b/gst/isomp4/gstqtmoovrecover.c
@@ -362,7 +362,8 @@ gst_qt_moov_recover_change_state (GstElement * element,
gst_task_join (qtmr->task);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
- g_assert (gst_task_get_state (qtmr->task) == GST_TASK_STOPPED);
+ if (gst_task_get_state (qtmr->task) != GST_TASK_STOPPED)
+ GST_ERROR ("task %p should be stopped by now", qtmr->task);
gst_object_unref (qtmr->task);
qtmr->task = NULL;
g_rec_mutex_clear (&qtmr->task_mutex);
diff --git a/tests/icles/ximagesrc-test.c b/tests/icles/ximagesrc-test.c
index a01bf656b..12ec0dc98 100644
--- a/tests/icles/ximagesrc-test.c
+++ b/tests/icles/ximagesrc-test.c
@@ -37,9 +37,7 @@ int
main (int argc, char **argv)
{
GstElement *pipeline;
-#ifndef G_DISABLE_ASSERT
- GstState state, pending;
-#endif
+ GstState state;
GError *error = NULL;
gst_init (&argc, &argv);
@@ -55,9 +53,11 @@ main (int argc, char **argv)
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* lets check it gets to PLAYING */
- g_assert (gst_element_get_state (pipeline, &state, &pending,
- GST_CLOCK_TIME_NONE) != GST_STATE_CHANGE_FAILURE);
- g_assert (state == GST_STATE_PLAYING || pending == GST_STATE_PLAYING);
+ if (gst_element_get_state (pipeline, &state, NULL,
+ GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_FAILURE ||
+ state != GST_STATE_PLAYING) {
+ g_warning ("State change to playing failed");
+ }
/* We want to get out after 5 seconds */
g_timeout_add (5000, (GSourceFunc) terminate_playback, pipeline);