From e13ff2521cb3df681d38d8091ea48fbaea6a9e02 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 5 Oct 2011 15:29:54 +0100 Subject: [PATCH 1/8] valgrind: add ALSA leaks fixed by snd_config_update_free_global If they go when calling snd_config_update_free_global, they're not really bug leaks, but more like intentional ones we don't want to get told about. https://bugzilla.gnome.org/show_bug.cgi?id=615342 --- tests/check/gst-plugins-base.supp | 120 ++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/tests/check/gst-plugins-base.supp b/tests/check/gst-plugins-base.supp index 0d0705d417..718b63d9ff 100644 --- a/tests/check/gst-plugins-base.supp +++ b/tests/check/gst-plugins-base.supp @@ -387,3 +387,123 @@ obj:/usr/lib/libfontconfig.so.* fun:FcFontRenderPrepare } +# ALSA leaks which are fixed by calling snd_config_update_free_global +{ + + Memcheck:Leak + fun:malloc + fun:strdup + obj:/usr/lib/libasound.so.2.0.0 + obj:/usr/lib/libasound.so.2.0.0 + fun:gst_alsa_get_device_list + fun:gst_alsa_device_property_probe_get_values + fun:gst_property_probe_get_values + fun:gst_property_probe_probe_and_get_values + fun:gst_property_probe_probe_and_get_values_name + fun:test_device_property_probe + fun:srunner_run_all + fun:gst_check_run_suite + fun:main +} +{ + + Memcheck:Leak + fun:malloc + obj:/usr/lib/libasound.so.2.0.0 + obj:/usr/lib/libasound.so.2.0.0 + fun:gst_alsa_get_device_list + fun:gst_alsa_device_property_probe_get_values + fun:gst_property_probe_get_values + fun:gst_property_probe_probe_and_get_values + fun:gst_property_probe_probe_and_get_values_name + fun:test_device_property_probe + fun:srunner_run_all + fun:gst_check_run_suite + fun:main +} +{ + + Memcheck:Leak + fun:malloc + fun:_dl_close_worker + fun:_dl_close + fun:_dl_catch_error + fun:_dlerror_run + fun:dlclose + obj:/usr/lib/libasound.so.2.0.0 + fun:snd_config_searcha_hooks + fun:snd_config_searchva_hooks + obj:/usr/lib/libasound.so.2.0.0 + fun:snd_config_search_definition + obj:/usr/lib/libasound.so.2.0.0 + fun:gst_alsa_get_device_list + fun:gst_alsa_device_property_probe_get_values + fun:gst_property_probe_get_values + fun:gst_property_probe_probe_and_get_values + fun:gst_property_probe_probe_and_get_values_name + fun:test_device_property_probe + fun:srunner_run_all + fun:gst_check_run_suite +} +{ + + Memcheck:Leak + fun:malloc + fun:strdup + obj:/usr/lib/libasound.so.2.0.0 + obj:/usr/lib/libasound.so.2.0.0 + fun:snd_hctl_open + fun:snd_mixer_attach + fun:gst_alsa_mixer_open + fun:gst_alsa_mixer_new + fun:gst_alsa_mixer_element_change_state + fun:gst_element_change_state + fun:gst_element_set_state_func + fun:test_alsa_mixer_track + fun:srunner_run_all + fun:gst_check_run_suite + fun:main +} +{ + + Memcheck:Leak + fun:malloc + fun:strdup + obj:/usr/lib/libasound.so.2.0.0 + obj:/usr/lib/libasound.so.2.0.0 + fun:snd_hctl_open + fun:snd_mixer_attach + fun:gst_alsa_mixer_open + fun:gst_alsa_mixer_new + fun:gst_alsa_mixer_element_change_state + fun:gst_element_change_state + fun:gst_element_set_state_func + fun:test_alsa_mixer_track + fun:srunner_run_all + fun:gst_check_run_suite + fun:main +} +{ + + Memcheck:Leak + fun:malloc + fun:_dl_close_worker + fun:_dl_close + fun:_dl_catch_error + fun:_dlerror_run + fun:dlclose + obj:/usr/lib/libasound.so.2.0.0 + fun:snd_config_searcha_hooks + fun:snd_config_searchva_hooks + obj:/usr/lib/libasound.so.2.0.0 + fun:snd_config_search_definition + obj:/usr/lib/libasound.so.2.0.0 + fun:snd_hctl_open + fun:snd_mixer_attach + fun:gst_alsa_mixer_open + fun:gst_alsa_mixer_new + fun:gst_alsa_mixer_element_change_state + fun:gst_element_change_state + fun:gst_element_set_state_func + fun:test_alsa_mixer_track +} From 353153d07956a0fd44b63741a49a4ed035162f58 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Tue, 18 Oct 2011 17:58:49 +0100 Subject: [PATCH 2/8] oggdemux: survive skeleton finding length behind our backs in push mode In push mode, we determine duration by doing a seek to the end of the stream. However, a skeleton stream with an index will cause the duration to be known already, and we end up never setting the push_time_duration variable which we use to know duration has been determined. https://bugzilla.gnome.org/show_bug.cgi?id=662049 --- ext/ogg/gstoggdemux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index f739df09a7..998efb98d4 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -1294,6 +1294,7 @@ gst_ogg_pad_handle_push_mode_state (GstOggPad * pad, ogg_page * page) GstFlowReturn res; /* tell the pipeline we've just found out the duration */ + ogg->push_time_length = ogg->total_time; GST_INFO_OBJECT (ogg, "New duration found: %" GST_TIME_FORMAT, GST_TIME_ARGS (ogg->total_time)); message = From 10811d63f973a2872e0e684a795d1db49eca65c3 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 4 Nov 2011 11:10:46 +0000 Subject: [PATCH 3/8] theoraenc: refuse to get to READY if the encoder was disabled https://bugzilla.gnome.org/show_bug.cgi?id=663391 --- ext/theora/gsttheoraenc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index cae79db44f..b7cd8ae925 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -1405,11 +1405,19 @@ theora_enc_change_state (GstElement * element, GstStateChange transition) { GstTheoraEnc *enc; GstStateChangeReturn ret; + th_enc_ctx *th_ctx; enc = GST_THEORA_ENC (element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: + th_ctx = dummy_encode_ctx (); + if (!th_ctx) { + GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL), + ("libtheora has been compiled with the encoder disabled")); + return GST_STATE_CHANGE_FAILURE; + } + th_encode_free (th_ctx); break; case GST_STATE_CHANGE_READY_TO_PAUSED: GST_DEBUG_OBJECT (enc, "READY->PAUSED Initing theora state"); From 0c4ccb4f9c3e9f6084f82f16c548a5bdeeb690ae Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 4 Nov 2011 10:59:12 +0000 Subject: [PATCH 4/8] theoraenc: warn when trying to set an ignored obsolete property https://bugzilla.gnome.org/show_bug.cgi?id=663391 --- ext/theora/gsttheoraenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index b7cd8ae925..6f35ed6ba6 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -1500,6 +1500,8 @@ theora_enc_set_property (GObject * object, guint prop_id, case PROP_NOISE_SENSITIVITY: case PROP_SHARPNESS: /* kept for API compat, but ignored */ + GST_WARNING_OBJECT (object, "Obsolete property '%s' ignored", + pspec->name); break; case PROP_BITRATE: GST_OBJECT_LOCK (enc); From ffbe58fd5a4c0e5e7a20fb57389f383878f7ec6f Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 4 Nov 2011 10:59:00 +0000 Subject: [PATCH 5/8] theoraenc: trivial comment typos fixes https://bugzilla.gnome.org/show_bug.cgi?id=663391 --- ext/theora/gsttheoraenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index 6f35ed6ba6..385603aa84 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -1239,7 +1239,7 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer) enc = GST_THEORA_ENC (GST_PAD_PARENT (pad)); /* we keep track of two timelines. - * - The timestamps from the incomming buffers, which we copy to the outgoing + * - The timestamps from the incoming buffers, which we copy to the outgoing * encoded buffers as-is. We need to do this as we simply forward the * newsegment events. * - The running_time of the buffers, which we use to construct the granulepos @@ -1298,7 +1298,7 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer) } /* make sure we copy the discont flag to the next outgoing buffer when it's - * set on the incomming buffer */ + * set on the incoming buffer */ if (GST_BUFFER_IS_DISCONT (buffer)) { enc->next_discont = TRUE; } From c1aab3e0a73bf50680231833da4a083ba96545b7 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 4 Nov 2011 10:58:15 +0000 Subject: [PATCH 6/8] theoraenc: use th_packet_iskeyframe instead of peeking at bits https://bugzilla.gnome.org/show_bug.cgi?id=663391 --- ext/theora/gsttheoraenc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index 385603aa84..4ee0185cb2 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -781,9 +781,8 @@ theora_buffer_from_packet (GstTheoraEnc * enc, ogg_packet * packet, enc->next_discont = FALSE; } - /* the second most significant bit of the first data byte is cleared - * for keyframes */ - if (packet->bytes > 0 && (packet->packet[0] & 0x40) == 0) { + /* th_packet_iskeyframe returns positive for keyframes */ + if (th_packet_iskeyframe (packet) > 0) { GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT); } else { GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); From a81cb3ef7f7b06098278c4270bc61c4c05b49dcb Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 4 Nov 2011 10:57:40 +0000 Subject: [PATCH 7/8] theoraenc: make logically static const data just so https://bugzilla.gnome.org/show_bug.cgi?id=663391 --- ext/theora/gsttheoraenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index 4ee0185cb2..4d5d49d612 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -575,10 +575,10 @@ theora_enc_get_supported_formats (void) { th_enc_ctx *encoder; th_info info; - struct + static const struct { th_pixel_fmt pixelformat; - const char *fourcc; + const char fourcc[]; } formats[] = { { TH_PF_420, "I420"}, { From 5d3852d91a08405ec4666243e2ad24844e6de857 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 4 Nov 2011 10:34:27 +0000 Subject: [PATCH 8/8] theoraenc: fix speed level failure test It was testing the opposite of what it thought it was. https://bugzilla.gnome.org/show_bug.cgi?id=663390 --- ext/theora/gsttheoraenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index 4d5d49d612..0d32360597 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -310,7 +310,7 @@ gst_theora_enc_class_init (GstTheoraEncClass * klass) th_ctx = dummy_encode_ctx (); if (th_ctx) { - if (!check_speed_level (th_ctx, &default_speed_level, &max_speed_level)) + if (check_speed_level (th_ctx, &default_speed_level, &max_speed_level)) GST_WARNING ("Failed to determine settings for the speed-level property."); th_encode_free (th_ctx);