mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
No statements with side-effects in g_assert() or g_return_*() please
This commit is contained in:
parent
6422f2d085
commit
17c839c8a1
5 changed files with 25 additions and 12 deletions
|
@ -1209,7 +1209,8 @@ gst_ogg_mux_make_fishead (GstOggMux * mux, ogg_stream_state * os)
|
|||
static void
|
||||
gst_ogg_mux_byte_writer_put_string_utf8 (GstByteWriter * bw, const char *s)
|
||||
{
|
||||
g_assert (gst_byte_writer_put_data (bw, (const guint8 *) s, strlen (s)));
|
||||
if (!gst_byte_writer_put_data (bw, (const guint8 *) s, strlen (s)))
|
||||
GST_ERROR ("put_data failed");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -513,7 +513,9 @@ gst_tag_list_from_vorbiscomment_buffer (GstBuffer * buffer,
|
|||
GstTagList *res;
|
||||
GstMapInfo info;
|
||||
|
||||
g_assert (gst_buffer_map (buffer, &info, GST_MAP_READ));
|
||||
if (!gst_buffer_map (buffer, &info, GST_MAP_READ))
|
||||
g_return_val_if_reached (NULL);
|
||||
|
||||
res =
|
||||
gst_tag_list_from_vorbiscomment (info.data, info.size, id_data,
|
||||
id_data_length, vendor_string);
|
||||
|
|
|
@ -662,7 +662,9 @@ gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
|
|||
/* pick first buffer from list */
|
||||
head = GST_BUFFER (mhclient->sending->data);
|
||||
|
||||
g_assert (gst_buffer_map (head, &info, GST_MAP_READ));
|
||||
if (!gst_buffer_map (head, &info, GST_MAP_READ))
|
||||
g_return_val_if_reached (FALSE);
|
||||
|
||||
data = info.data;
|
||||
maxsize = info.size - mhclient->bufoffset;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ run_capsfilter_renegotiation (const gchar * launch_line)
|
|||
|
||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||
|
||||
g_assert (gst_element_set_state (pipeline, GST_STATE_PLAYING) !=
|
||||
fail_unless (gst_element_set_state (pipeline, GST_STATE_PLAYING) !=
|
||||
GST_STATE_CHANGE_FAILURE);
|
||||
|
||||
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
|
||||
|
|
|
@ -62,8 +62,10 @@ message_handler (GstBus * bus, GstMessage * message, gpointer user_data)
|
|||
("prerolled, starting synchronized playback and recording\n");
|
||||
/* returns ASYNC because the sink linked to the live source is not
|
||||
* prerolled */
|
||||
g_assert (gst_element_set_state (pipeline,
|
||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_ASYNC);
|
||||
if (gst_element_set_state (pipeline,
|
||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_ASYNC) {
|
||||
g_warning ("State change failed");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -139,19 +141,25 @@ main (int argc, char *argv[])
|
|||
|
||||
g_print ("going to PAUSED\n");
|
||||
/* returns NO_PREROLL because we have a live element */
|
||||
g_assert (gst_element_set_state (pipeline,
|
||||
GST_STATE_PAUSED) == GST_STATE_CHANGE_NO_PREROLL);
|
||||
if (gst_element_set_state (pipeline,
|
||||
GST_STATE_PAUSED) != GST_STATE_CHANGE_NO_PREROLL) {
|
||||
g_warning ("Expected state change NO_PREROLL result");
|
||||
}
|
||||
|
||||
g_print ("waiting for playback preroll\n");
|
||||
#ifndef ASYNC_VERSION
|
||||
/* sync wait for preroll on the playback bin and then go to PLAYING */
|
||||
g_assert (gst_element_get_state (play_bin, NULL, NULL,
|
||||
GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_SUCCESS);
|
||||
if (gst_element_get_state (play_bin, NULL, NULL,
|
||||
GST_CLOCK_TIME_NONE) != GST_STATE_CHANGE_SUCCESS) {
|
||||
g_warning ("Error while waiting for state change");
|
||||
}
|
||||
g_print ("prerolled, starting synchronized playback and recording\n");
|
||||
/* returns ASYNC because the sink linked to the live source is not
|
||||
* prerolled */
|
||||
g_assert (gst_element_set_state (pipeline,
|
||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_ASYNC);
|
||||
if (gst_element_set_state (pipeline,
|
||||
GST_STATE_PLAYING) != GST_STATE_CHANGE_ASYNC) {
|
||||
g_warning ("Expected state change NO_PREROLL result");
|
||||
}
|
||||
#endif
|
||||
|
||||
g_main_loop_run (loop);
|
||||
|
|
Loading…
Reference in a new issue