mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
No code with side-effects inside g_assert() please
This commit is contained in:
parent
b4ff570532
commit
4de8bd004c
4 changed files with 20 additions and 15 deletions
|
@ -1316,15 +1316,17 @@ invalid_yuvrgbgrayscale:
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_jpeg_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
|
gst_jpeg_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstBufferPool *pool;
|
GstBufferPool *pool = NULL;
|
||||||
GstStructure *config;
|
GstStructure *config;
|
||||||
|
|
||||||
if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (bdec, query))
|
if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (bdec, query))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
g_assert (gst_query_get_n_allocation_pools (query) > 0);
|
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
|
gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
|
||||||
g_assert (pool != NULL);
|
|
||||||
|
if (pool == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
|
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
|
||||||
|
|
|
@ -394,15 +394,17 @@ beach:
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_pngdec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
|
gst_pngdec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstBufferPool *pool;
|
GstBufferPool *pool = NULL;
|
||||||
GstStructure *config;
|
GstStructure *config;
|
||||||
|
|
||||||
if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (bdec, query))
|
if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (bdec, query))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
g_assert (gst_query_get_n_allocation_pools (query) > 0);
|
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
|
gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL);
|
||||||
g_assert (pool != NULL);
|
|
||||||
|
if (pool == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
|
if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
|
||||||
|
|
|
@ -362,7 +362,8 @@ gst_qt_moov_recover_change_state (GstElement * element,
|
||||||
gst_task_join (qtmr->task);
|
gst_task_join (qtmr->task);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
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);
|
gst_object_unref (qtmr->task);
|
||||||
qtmr->task = NULL;
|
qtmr->task = NULL;
|
||||||
g_rec_mutex_clear (&qtmr->task_mutex);
|
g_rec_mutex_clear (&qtmr->task_mutex);
|
||||||
|
|
|
@ -37,9 +37,7 @@ int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
#ifndef G_DISABLE_ASSERT
|
GstState state;
|
||||||
GstState state, pending;
|
|
||||||
#endif
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
@ -55,9 +53,11 @@ main (int argc, char **argv)
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
/* lets check it gets to PLAYING */
|
/* lets check it gets to PLAYING */
|
||||||
g_assert (gst_element_get_state (pipeline, &state, &pending,
|
if (gst_element_get_state (pipeline, &state, NULL,
|
||||||
GST_CLOCK_TIME_NONE) != GST_STATE_CHANGE_FAILURE);
|
GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_FAILURE ||
|
||||||
g_assert (state == GST_STATE_PLAYING || pending == GST_STATE_PLAYING);
|
state != GST_STATE_PLAYING) {
|
||||||
|
g_warning ("State change to playing failed");
|
||||||
|
}
|
||||||
|
|
||||||
/* We want to get out after 5 seconds */
|
/* We want to get out after 5 seconds */
|
||||||
g_timeout_add (5000, (GSourceFunc) terminate_playback, pipeline);
|
g_timeout_add (5000, (GSourceFunc) terminate_playback, pipeline);
|
||||||
|
|
Loading…
Reference in a new issue