From e886ef8f5bcd4dc10531c74a59b3288b7baf4b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimo=20J=C3=A4rvi?= Date: Thu, 12 Jan 2012 00:18:39 +0200 Subject: [PATCH 01/29] waveformsink: Fix mingw warnings https://bugzilla.gnome.org/show_bug.cgi?id=667719 --- sys/waveform/gstwaveformsink.c | 8 ++++---- sys/waveform/gstwaveformsink.h | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/waveform/gstwaveformsink.c b/sys/waveform/gstwaveformsink.c index 83fe7492a6..3ff72a91e7 100644 --- a/sys/waveform/gstwaveformsink.c +++ b/sys/waveform/gstwaveformsink.c @@ -76,8 +76,8 @@ GstCaps *gst_waveform_sink_create_caps (gint rate, gint channels, gint bits_per_sample); WAVEHDR *bufferpool_get_buffer (GstWaveFormSink * wfsink, gpointer data, guint length); -void CALLBACK waveOutProc (HWAVEOUT hwo, UINT uMsg, unsigned long dwInstance, - DWORD dwParam1, DWORD dwParam2); +void CALLBACK waveOutProc (HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, + DWORD_PTR dwParam1, DWORD_PTR dwParam2); static GstStaticPadTemplate waveformsink_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", @@ -374,7 +374,7 @@ gst_waveform_sink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec) /* open the default audio device with the given caps */ mmresult = waveOutOpen (&wfsink->hwaveout, WAVE_MAPPER, - &wfx, (DWORD) waveOutProc, (DWORD) wfsink, CALLBACK_FUNCTION); + &wfx, (DWORD_PTR) waveOutProc, (DWORD_PTR) wfsink, CALLBACK_FUNCTION); if (mmresult != MMSYSERR_NOERROR) { waveOutGetErrorText (mmresult, wfsink->error_string, ERROR_LENGTH - 1); GST_ELEMENT_ERROR (wfsink, RESOURCE, OPEN_WRITE, @@ -569,7 +569,7 @@ gst_waveform_sink_create_caps (gint rate, gint channels, gint bits_per_sample) void CALLBACK waveOutProc (HWAVEOUT hwo, - UINT uMsg, unsigned long dwInstance, DWORD dwParam1, DWORD dwParam2) + UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { GstWaveFormSink *wfsink = (GstWaveFormSink *) dwInstance; diff --git a/sys/waveform/gstwaveformsink.h b/sys/waveform/gstwaveformsink.h index 79227794e8..b23aea145a 100644 --- a/sys/waveform/gstwaveformsink.h +++ b/sys/waveform/gstwaveformsink.h @@ -28,10 +28,21 @@ #include #include +#ifndef WAVE_FORMAT_96M08 #define WAVE_FORMAT_96M08 0x00001000 /* 96 kHz, Mono, 8-bit */ +#endif + +#ifndef WAVE_FORMAT_96S08 #define WAVE_FORMAT_96S08 0x00002000 /* 96 kHz, Stereo, 8-bit */ +#endif + +#ifndef WAVE_FORMAT_96M16 #define WAVE_FORMAT_96M16 0x00004000 /* 96 kHz, Mono, 16-bit */ +#endif + +#ifndef WAVE_FORMAT_96S16 #define WAVE_FORMAT_96S16 0x00008000 /* 96 kHz, Stereo, 16-bit */ +#endif #define ERROR_LENGTH MAXERRORLENGTH+50 #define BUFFER_COUNT 20 From 150403ab13dbccef653537cc62cc30a42f71d43f Mon Sep 17 00:00:00 2001 From: Havard Graff Date: Mon, 5 Sep 2011 10:43:19 +0200 Subject: [PATCH 02/29] v4l2src: Don't assert when the interface is not implemented. Simply return FALSE instead. https://bugzilla.gnome.org/show_bug.cgi?id=667817 --- sys/v4l2/gstv4l2src.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 023e77bee7..e2175a4ece 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -95,14 +95,16 @@ gst_v4l2src_iface_supported (GstImplementsInterface * iface, GType iface_type) GstV4l2Object *v4l2object = GST_V4L2SRC (iface)->v4l2object; #ifdef HAVE_XVIDEO - g_assert (iface_type == GST_TYPE_TUNER || - iface_type == GST_TYPE_X_OVERLAY || - iface_type == GST_TYPE_COLOR_BALANCE || - iface_type == GST_TYPE_VIDEO_ORIENTATION); + if (!(iface_type == GST_TYPE_TUNER || + iface_type == GST_TYPE_X_OVERLAY || + iface_type == GST_TYPE_COLOR_BALANCE || + iface_type == GST_TYPE_VIDEO_ORIENTATION)) + return FALSE; #else - g_assert (iface_type == GST_TYPE_TUNER || - iface_type == GST_TYPE_COLOR_BALANCE || - iface_type == GST_TYPE_VIDEO_ORIENTATION); + if (!(iface_type == GST_TYPE_TUNER || + iface_type == GST_TYPE_COLOR_BALANCE || + iface_type == GST_TYPE_VIDEO_ORIENTATION)) + return FALSE; #endif if (v4l2object->video_fd == -1) From ffe010ee4d813e15ec3994ae39210a33d72aa256 Mon Sep 17 00:00:00 2001 From: Stig Sandnes Date: Tue, 4 Oct 2011 10:00:02 +0200 Subject: [PATCH 03/29] osxvideo: Fix leak of NSOpenGLPixelFormat object https://bugzilla.gnome.org/show_bug.cgi?id=667818 --- sys/osxvideo/cocoawindow.m | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/osxvideo/cocoawindow.m b/sys/osxvideo/cocoawindow.m index 0a256acd47..ed24fadc28 100644 --- a/sys/osxvideo/cocoawindow.m +++ b/sys/osxvideo/cocoawindow.m @@ -128,6 +128,7 @@ } self = [super initWithFrame: frame pixelFormat:fmt]; + [fmt release]; actualContext = [self openGLContext]; [actualContext makeCurrentContext]; From f10e8192fa8968e84724b627bb3de5fb19fb174d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 13 Jan 2012 10:32:59 +0000 Subject: [PATCH 04/29] rtpptdemux: plug pad leak in error code path Based on patch by: Stig Sandnes Don't leak srcpad if there are no caps. https://bugzilla.gnome.org/show_bug.cgi?id=667820 --- gst/rtpmanager/gstrtpptdemux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gst/rtpmanager/gstrtpptdemux.c b/gst/rtpmanager/gstrtpptdemux.c index 0679438fa6..630212f0b1 100644 --- a/gst/rtpmanager/gstrtpptdemux.c +++ b/gst/rtpmanager/gstrtpptdemux.c @@ -326,6 +326,10 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf) GstPadTemplate *templ; gchar *padname; + caps = gst_rtp_pt_demux_get_caps (rtpdemux, pt); + if (!caps) + goto no_caps; + klass = GST_ELEMENT_GET_CLASS (rtpdemux); templ = gst_element_class_get_pad_template (klass, "src_%d"); padname = g_strdup_printf ("src_%d", pt); @@ -334,10 +338,6 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstBuffer * buf) g_free (padname); gst_pad_set_event_function (srcpad, gst_rtp_pt_demux_src_event); - caps = gst_rtp_pt_demux_get_caps (rtpdemux, pt); - if (!caps) - goto no_caps; - caps = gst_caps_make_writable (caps); gst_caps_set_simple (caps, "payload", G_TYPE_INT, pt, NULL); gst_pad_set_caps (srcpad, caps); From 4c2a2063cf20cf49e81213b156106ae4b541ad7c Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 13 Jan 2012 15:57:20 +0000 Subject: [PATCH 05/29] tests: fix caps leak in videotestsrc test --- tests/check/elements/videocrop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/check/elements/videocrop.c b/tests/check/elements/videocrop.c index 19b5c17561..fc7c5dc149 100644 --- a/tests/check/elements/videocrop.c +++ b/tests/check/elements/videocrop.c @@ -350,6 +350,7 @@ GST_START_TEST (test_crop_to_1x1) if (g_strcmp0 (gst_structure_get_name (s), "video/x-raw-gray") == 0) { /* videotestsrc does not support this format */ + gst_caps_unref (caps); continue; } From b0608128b10d573918f658edef97a415a4caa466 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 13 Jan 2012 17:25:59 +0000 Subject: [PATCH 06/29] v4l2src: fix caps leak --- sys/v4l2/gstv4l2src.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index e2175a4ece..f8ae09ccc1 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -522,11 +522,12 @@ gst_v4l2src_negotiate (GstBaseSrc * basesrc) } } gst_caps_unref (thiscaps); - gst_caps_unref (peercaps); } else { /* no peer or peer have ANY caps, work with our own caps then */ caps = thiscaps; } + if (peercaps) + gst_caps_unref (peercaps); if (caps) { caps = gst_caps_make_writable (caps); gst_caps_truncate (caps); From f799fb2c90f8d2c640bb049144233dab75a2730f Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 13 Jan 2012 17:43:49 +0000 Subject: [PATCH 07/29] oss4: fix caps leaks --- sys/oss4/oss4-sink.c | 2 +- sys/oss4/oss4-source.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/oss4/oss4-sink.c b/sys/oss4/oss4-sink.c index de2d8a99d5..54e95b9f9e 100644 --- a/sys/oss4/oss4-sink.c +++ b/sys/oss4/oss4-sink.c @@ -392,7 +392,7 @@ gst_oss4_sink_getcaps (GstBaseSink * bsink) oss = GST_OSS4_SINK (bsink); if (oss->fd == -1) { - caps = gst_caps_copy (gst_oss4_audio_get_template_caps ()); + caps = gst_oss4_audio_get_template_caps (); } else if (oss->probed_caps) { caps = gst_caps_copy (oss->probed_caps); } else { diff --git a/sys/oss4/oss4-source.c b/sys/oss4/oss4-source.c index bb6459399c..eadb4c5e31 100644 --- a/sys/oss4/oss4-source.c +++ b/sys/oss4/oss4-source.c @@ -274,7 +274,7 @@ gst_oss4_source_getcaps (GstBaseSrc * bsrc) oss = GST_OSS4_SOURCE (bsrc); if (oss->fd == -1) { - caps = gst_caps_copy (gst_oss4_audio_get_template_caps ()); + caps = gst_oss4_audio_get_template_caps (); } else if (oss->probed_caps) { caps = gst_caps_copy (oss->probed_caps); } else { From f0ac29113cc88099b6cba0a0883cf17d451ca413 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Fri, 13 Jan 2012 18:11:36 +0000 Subject: [PATCH 08/29] pulsesrc: fix wrong error check pa_stream_* functions return negative on error, despite the defines for error codes being positive. I only got to repro the error twice, so I'm not sure 100% sure this fixes the issue (the negative var being uninitialized after returning from pa_stream_get_latency). --- ext/pulse/pulsesrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c index 88c8b002f3..98f7f0c0f2 100644 --- a/ext/pulse/pulsesrc.c +++ b/ext/pulse/pulsesrc.c @@ -1230,7 +1230,7 @@ gst_pulsesrc_delay (GstAudioSrc * asrc) pa_threaded_mainloop_unlock (pulsesrc->mainloop); - if (res > 0) { + if (res < 0) { GST_DEBUG_OBJECT (pulsesrc, "could not get latency"); result = 0; } else { From 4d51c68fc0d9c43764fba3616a74e19720742da4 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 16 Jan 2012 12:13:50 +0000 Subject: [PATCH 09/29] deinterlace: make interlacedness test deterministic If the interlaced flag is not present in the caps, we assume the data is not interlaced, instead of leaving the boolean uninitialized. --- gst/deinterlace/gstdeinterlace.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 6e71bce22f..373fb20768 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -1000,9 +1000,10 @@ gst_deinterlace_get_interlacing_method (const GstCaps * caps) GstDeinterlaceInterlacingMethod method = 0; gboolean interlaced; - /* check interlaced cap */ - gst_structure_get_boolean (gst_caps_get_structure (caps, 0), "interlaced", - &interlaced); + /* check interlaced cap, defaulting to FALSE */ + if (!gst_structure_get_boolean (gst_caps_get_structure (caps, 0), + "interlaced", &interlaced)) + interlaced = FALSE; method = interlaced ? GST_DEINTERLACE_INTERLACED : GST_DEINTERLACE_PROGRESSIVE; From 2a7a38ca0738d285caf3703001c4bac06dc31ff5 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 16 Jan 2012 15:42:46 +0000 Subject: [PATCH 10/29] rtph263ppay: fix caps leak --- gst/rtp/gstrtph263ppay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst/rtp/gstrtph263ppay.c b/gst/rtp/gstrtph263ppay.c index d948b77f16..f85607e8c6 100644 --- a/gst/rtp/gstrtph263ppay.c +++ b/gst/rtp/gstrtph263ppay.c @@ -236,7 +236,7 @@ static GstCaps * gst_rtp_h263p_pay_sink_getcaps (GstBaseRTPPayload * payload, GstPad * pad) { GstRtpH263PPay *rtph263ppay; - GstCaps *caps = gst_caps_new_empty (); + GstCaps *caps = NULL; GstCaps *peercaps = NULL; GstCaps *intersect = NULL; guint i; @@ -256,6 +256,7 @@ gst_rtp_h263p_pay_sink_getcaps (GstBaseRTPPayload * payload, GstPad * pad) if (gst_caps_is_empty (intersect)) return intersect; + caps = gst_caps_new_empty (); for (i = 0; i < gst_caps_get_size (intersect); i++) { GstStructure *s = gst_caps_get_structure (intersect, i); const gchar *encoding_name = gst_structure_get_string (s, "encoding-name"); From e9e0bebde3ef6c4e55ac3fe621f249946a4fb0d9 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 16 Jan 2012 16:10:08 +0000 Subject: [PATCH 11/29] tests: fix autodetect test not testing correctly for state change success State change to PAUSED can be done async, so if this happens, we need to wait for the change to be done (or failed). --- tests/check/elements/autodetect.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/check/elements/autodetect.c b/tests/check/elements/autodetect.c index 0eb798b1e4..21f9bb50c2 100644 --- a/tests/check/elements/autodetect.c +++ b/tests/check/elements/autodetect.c @@ -62,6 +62,12 @@ GST_START_TEST (test_autovideosink_ghostpad_error_case) /* this should fail, there's no such format */ state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); + if (state_ret == GST_STATE_CHANGE_ASYNC) { + /* make sure we wait for the actual success/failure to happen */ + GstState state; + state_ret = + gst_element_get_state (pipeline, &state, &state, GST_CLOCK_TIME_NONE); + } fail_unless (state_ret == GST_STATE_CHANGE_FAILURE, "pipeline _set_state() to PAUSED succeeded but should have failed"); From cf81df80580fbec9774d39c755b0caf58100ae02 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 16 Jan 2012 17:51:18 +0000 Subject: [PATCH 12/29] cutter: fix leak of unused GValue --- gst/cutter/gstcutter.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/gst/cutter/gstcutter.c b/gst/cutter/gstcutter.c index 72b90db123..a8d95d5aeb 100644 --- a/gst/cutter/gstcutter.c +++ b/gst/cutter/gstcutter.c @@ -191,9 +191,6 @@ static GstMessage * gst_cutter_message_new (GstCutter * c, gboolean above, GstClockTime timestamp) { GstStructure *s; - GValue v = { 0, }; - - g_value_init (&v, GST_TYPE_LIST); s = gst_structure_new ("cutter", "above", G_TYPE_BOOLEAN, above, From 9ae5ddd8f947559088859852dcf3ff3de2dacd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 19 Jan 2012 14:24:04 +0000 Subject: [PATCH 13/29] Add --disable-fatal-warnings configure option --- common | 2 +- configure.ac | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common b/common index 11f0cd5a3f..17fa4abf49 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 11f0cd5a3fba36f85cf3e434150bfe66b1bf08d4 +Subproject commit 17fa4abf49d31cf5dcc2994bdbaa86e45a3fb69f diff --git a/configure.ac b/configure.ac index 681bc37ef2..981094e5c5 100644 --- a/configure.ac +++ b/configure.ac @@ -73,6 +73,8 @@ AG_GST_GETTEXT([gst-plugins-good-$GST_MAJORMINOR]) dnl *** check for arguments to configure *** +AG_GST_ARG_DISABLE_FATAL_WARNINGS + AG_GST_ARG_DEBUG AG_GST_ARG_PROFILING AG_GST_ARG_VALGRIND @@ -298,7 +300,7 @@ AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO], dnl define an ERROR_CFLAGS Makefile variable dnl -Wundef: too many broken headers if test "x$HAVE_OSX_VIDEO" != "xyes"; then - AG_GST_SET_ERROR_CFLAGS($GST_GIT, [ + AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [ -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wwrite-strings -Wold-style-definition -Waggregate-return -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar @@ -307,7 +309,7 @@ else dnl work-around for us passing GST_CFLAGS to the ObjC-compiler, which dnl doesn't understand all warning flags that the C compiler knows about dnl (e.g. -Waddress) or causes problems with some flags (-Waggregate-return) - AG_GST_SET_ERROR_CFLAGS($GST_GIT, [ + AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [ -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wwrite-strings -Wold-style-definition -Winit-self -Wmissing-include-dirs -Wno-multichar @@ -315,7 +317,7 @@ else fi dnl define an ERROR_CXXFLAGS Makefile variable -AG_GST_SET_ERROR_CXXFLAGS($GST_GIT, [ +AG_GST_SET_ERROR_CXXFLAGS($FATAL_WARNINGS, [ -Wmissing-declarations -Wredundant-decls -Wwrite-strings -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar ]) From ad11ec4121ec7520ba190fcd74c479740bb5c644 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:44:21 +0100 Subject: [PATCH 14/29] jpegenc: check _alloc_buffer result and perform fallback alloc if needed ... rather than carrying on with NULL buffer. --- ext/jpeg/gstjpegenc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c index 98c7e09a94..c44cb2ea15 100644 --- a/ext/jpeg/gstjpegenc.c +++ b/ext/jpeg/gstjpegenc.c @@ -210,15 +210,23 @@ gst_jpegenc_flush_destination (j_compress_ptr cinfo) GstBuffer *overflow_buffer; guint32 old_buffer_size; GstJpegEnc *jpegenc = (GstJpegEnc *) (cinfo->client_data); + GstFlowReturn ret; + GST_DEBUG_OBJECT (jpegenc, "gst_jpegenc_chain: flush_destination: buffer too small"); /* Our output buffer wasn't big enough. * Make a new buffer that's twice the size, */ old_buffer_size = GST_BUFFER_SIZE (jpegenc->output_buffer); - gst_pad_alloc_buffer_and_set_caps (jpegenc->srcpad, + ret = gst_pad_alloc_buffer_and_set_caps (jpegenc->srcpad, GST_BUFFER_OFFSET_NONE, old_buffer_size * 2, GST_PAD_CAPS (jpegenc->srcpad), &overflow_buffer); + /* handle here if needed */ + if (ret != GST_FLOW_OK) { + overflow_buffer = gst_buffer_new_and_alloc (old_buffer_size * 2); + gst_buffer_set_caps (overflow_buffer, GST_PAD_CAPS (jpegenc->srcpad)); + } + memcpy (GST_BUFFER_DATA (overflow_buffer), GST_BUFFER_DATA (jpegenc->output_buffer), old_buffer_size); From 3168b77e0421e234ae6c453dd36bd3b1d36a8474 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:46:21 +0100 Subject: [PATCH 15/29] pulsesink: additional error condition checking --- ext/pulse/pulsesink.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index 3c6177089d..11e9c894c5 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -2955,8 +2955,11 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition) GST_INFO_OBJECT (element, "new pa main loop thread"); if (!(mainloop = pa_threaded_mainloop_new ())) goto mainloop_failed; + if (pa_threaded_mainloop_start (mainloop) < 0) { + pa_threaded_mainloop_free (mainloop); + goto mainloop_start_failed; + } mainloop_ref_ct = 1; - pa_threaded_mainloop_start (mainloop); g_mutex_unlock (pa_shared_resource_mutex); } else { GST_INFO_OBJECT (element, "reusing pa main loop thread"); @@ -3002,6 +3005,13 @@ mainloop_failed: ("pa_threaded_mainloop_new() failed"), (NULL)); return GST_STATE_CHANGE_FAILURE; } +mainloop_start_failed: + { + g_mutex_unlock (pa_shared_resource_mutex); + GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED, + ("pa_threaded_mainloop_start() failed"), (NULL)); + return GST_STATE_CHANGE_FAILURE; + } state_failure: { if (transition == GST_STATE_CHANGE_NULL_TO_READY) { From e44d9302899c48e849cb0e488c950a4d9dd86384 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:47:36 +0100 Subject: [PATCH 16/29] pulsesrc: additional error condition checking --- ext/pulse/pulsesrc.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c index 98f7f0c0f2..12e52822b7 100644 --- a/ext/pulse/pulsesrc.c +++ b/ext/pulse/pulsesrc.c @@ -1677,10 +1677,13 @@ gst_pulsesrc_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: - this->mainloop = pa_threaded_mainloop_new (); - g_assert (this->mainloop); - - pa_threaded_mainloop_start (this->mainloop); + if (!(this->mainloop = pa_threaded_mainloop_new ())) + goto mainloop_failed; + if (pa_threaded_mainloop_start (this->mainloop) < 0) { + pa_threaded_mainloop_free (this->mainloop); + this->mainloop = NULL; + goto mainloop_start_failed; + } if (!this->mixer) this->mixer = @@ -1730,4 +1733,18 @@ gst_pulsesrc_change_state (GstElement * element, GstStateChange transition) } return ret; + + /* ERRORS */ +mainloop_failed: + { + GST_ELEMENT_ERROR (this, RESOURCE, FAILED, + ("pa_threaded_mainloop_new() failed"), (NULL)); + return GST_STATE_CHANGE_FAILURE; + } +mainloop_start_failed: + { + GST_ELEMENT_ERROR (this, RESOURCE, FAILED, + ("pa_threaded_mainloop_start() failed"), (NULL)); + return GST_STATE_CHANGE_FAILURE; + } } From 191181257250408dcb00948a5f6b271e6ea3dc12 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:48:49 +0100 Subject: [PATCH 17/29] flacdec: improve upstream peer duration querying ... to avoid accepting unhandled duration query result. --- ext/flac/gstflacdec.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 65aa927f87..10f8916c69 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -711,17 +711,12 @@ gst_flac_dec_length (const FLAC__StreamDecoder * decoder, { GstFlacDec *flacdec; GstFormat fmt = GST_FORMAT_BYTES; - gint64 len; - GstPad *peer; + gint64 len = -1; flacdec = GST_FLAC_DEC (client_data); - if (!(peer = gst_pad_get_peer (flacdec->sinkpad))) - return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; - - gst_pad_query_duration (peer, &fmt, &len); - gst_object_unref (peer); - if (fmt != GST_FORMAT_BYTES || len == -1) + if (!gst_pad_query_peer_duration (flacdec->sinkpad, &fmt, &len) || + (fmt != GST_FORMAT_BYTES || len == -1)) return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; *length = len; From 14fe651b15d3049c54a7df25a1187a4ef764bbb6 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:49:14 +0100 Subject: [PATCH 18/29] alphacolor: remove redundant statement --- gst/alpha/gstalphacolor.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gst/alpha/gstalphacolor.c b/gst/alpha/gstalphacolor.c index 48e6a5a104..3c9b37daa8 100644 --- a/gst/alpha/gstalphacolor.c +++ b/gst/alpha/gstalphacolor.c @@ -280,7 +280,6 @@ transform_ayuv_ayuv (guint8 * data, gint size, const gint * matrix) u = (data[1] * uc[0] + data[2] * uc[1] + data[3] * uc[2] + uc[3]) >> 8; v = (data[1] * vc[0] + data[2] * vc[1] + data[3] * vc[2] + vc[3]) >> 8; - data[0] = data[0]; data[1] = y; data[2] = u; data[3] = v; From 436a85ac8a9289ab205a51000deaf27717621657 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:54:06 +0100 Subject: [PATCH 19/29] avidemux: tweak DEFAULT format duration query response --- gst/avi/gstavidemux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index b6c065f509..43096ff736 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -573,7 +573,7 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query) GST_DEBUG_OBJECT (query, "total frames is %" G_GUINT32_FORMAT, stream->idx_n); - if (stream->idx_n >= 0) + if (stream->idx_n > 0) gst_query_set_duration (query, fmt, stream->idx_n); else if (gst_pad_query_convert (pad, GST_FORMAT_TIME, duration, &fmt, &dur)) From a973c0b38165f29c4d17534620acd919b1b1607a Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:55:06 +0100 Subject: [PATCH 20/29] imagefreeze: add various missing break --- gst/imagefreeze/gstimagefreeze.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gst/imagefreeze/gstimagefreeze.c b/gst/imagefreeze/gstimagefreeze.c index 6456040ae6..f5f05ddcac 100644 --- a/gst/imagefreeze/gstimagefreeze.c +++ b/gst/imagefreeze/gstimagefreeze.c @@ -399,6 +399,7 @@ gst_image_freeze_convert (GstImageFreeze * self, default: break; } + break; } case GST_FORMAT_TIME:{ switch (*dest_format) { @@ -413,7 +414,7 @@ gst_image_freeze_convert (GstImageFreeze * self, default: break; } - + break; } default: break; @@ -471,12 +472,14 @@ gst_image_freeze_src_query (GstPad * pad, GstQuery * query) position = self->offset; g_mutex_unlock (self->lock); ret = TRUE; + break; } case GST_FORMAT_TIME:{ g_mutex_lock (self->lock); position = self->segment.last_stop; g_mutex_unlock (self->lock); ret = TRUE; + break; } default: break; @@ -503,6 +506,7 @@ gst_image_freeze_src_query (GstPad * pad, GstQuery * query) duration = self->segment.stop; g_mutex_unlock (self->lock); ret = TRUE; + break; } case GST_FORMAT_DEFAULT:{ g_mutex_lock (self->lock); @@ -513,6 +517,7 @@ gst_image_freeze_src_query (GstPad * pad, GstQuery * query) GST_SECOND * self->fps_d); g_mutex_unlock (self->lock); ret = TRUE; + break; } default: break; From 9d771c9bed64673e6b54ec80ae09ef1c51e2e707 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:57:52 +0100 Subject: [PATCH 21/29] deinterlace: fix arithmetic for unsigned comparison --- gst/deinterlace/gstdeinterlace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 373fb20768..a79b836e00 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -1706,8 +1706,8 @@ restart: gst_buffer_set_caps (outbuf, GST_PAD_CAPS (self->srcpad)); } - g_return_val_if_fail (self->history_count - 1 - - gst_deinterlace_method_get_latency (self->method) >= 0, GST_FLOW_ERROR); + g_return_val_if_fail (self->history_count >= + 1 + gst_deinterlace_method_get_latency (self->method), GST_FLOW_ERROR); buf = self->field_history[self->history_count - 1 - From c588d568f14f786d137c8eb02b419b14a22a3c7c Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 16:58:28 +0100 Subject: [PATCH 22/29] matroska-demux: remove redundant variable --- gst/matroska/matroska-demux.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index e80febcb5f..c30e0d0283 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -1721,7 +1721,6 @@ gst_matroska_demux_search_pos (GstMatroskaDemux * demux, GstClockTime time) gint64 opos, newpos, startpos = 0, current_offset; gint64 prev_cluster_offset = -1, current_cluster_offset, cluster_offset; const guint chunk = 64 * 1024; - GstBuffer *buf = NULL; GstFlowReturn ret; guint64 length; guint32 id; @@ -1886,8 +1885,6 @@ retry: ", pos %" G_GUINT64_FORMAT, GST_TIME_ARGS (entry->time), entry->pos); exit: - if (buf) - gst_buffer_unref (buf); /* restore some state */ demux->cluster_offset = current_cluster_offset; From ed94e0123120def21770fdf1cc8d26228cc2a8eb Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 17:00:51 +0100 Subject: [PATCH 23/29] rtptheoradepay: remove dead code --- gst/rtp/gstrtptheoradepay.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/gst/rtp/gstrtptheoradepay.c b/gst/rtp/gstrtptheoradepay.c index 1e38262206..c808c2a730 100644 --- a/gst/rtp/gstrtptheoradepay.c +++ b/gst/rtp/gstrtptheoradepay.c @@ -322,10 +322,6 @@ gst_rtp_theora_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) guint8 *data; gsize size; - /* configure string should be in the caps */ - if (configuration == NULL) - goto no_configuration; - /* deserialize base64 to buffer */ data = g_base64_decode (configuration, &size); @@ -349,11 +345,6 @@ gst_rtp_theora_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) return res; /* ERRORS */ -no_configuration: - { - GST_ERROR_OBJECT (rtptheoradepay, "no configuration specified"); - return FALSE; - } invalid_configuration: { GST_ERROR_OBJECT (rtptheoradepay, "invalid configuration specified"); From 3137f26544eeff0aaf2bec05417aa85bbd19931c Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 17:01:37 +0100 Subject: [PATCH 24/29] isomp4: recovery: add sanity check ... on possibly bogus/corrupt input data. --- gst/isomp4/atomsrecovery.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gst/isomp4/atomsrecovery.c b/gst/isomp4/atomsrecovery.c index 1190ec1ca6..1d53ed8442 100644 --- a/gst/isomp4/atomsrecovery.c +++ b/gst/isomp4/atomsrecovery.c @@ -681,6 +681,13 @@ moov_recov_file_create (FILE * file, GError ** err) goto fail; } + /* sanity check */ + if (moovrf->num_traks > 1024) { + g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_PARSING, + "Unsupported number of traks"); + goto fail; + } + /* init the traks */ moovrf->traks_rd = g_new0 (TrakRecovData, moovrf->num_traks); for (i = 0; i < moovrf->num_traks; i++) { From a3ea25bc8829fd6d859894be4e22b2afc06583aa Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 17:02:15 +0100 Subject: [PATCH 25/29] rtpmp4adepay: prevent out-of-bound array access --- gst/rtp/gstrtpmp4adepay.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst/rtp/gstrtpmp4adepay.c b/gst/rtp/gstrtpmp4adepay.c index 103d389ce0..e4343f8dbe 100644 --- a/gst/rtp/gstrtpmp4adepay.c +++ b/gst/rtp/gstrtpmp4adepay.c @@ -130,7 +130,7 @@ gst_rtp_mp4a_depay_finalize (GObject * object) } static const guint aac_sample_rates[] = { 96000, 88200, 64000, 48000, - 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000 + 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 }; static gboolean @@ -247,6 +247,8 @@ gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) /* index of 15 means we get the rate in the next 24 bits */ if (!gst_bit_reader_get_bits_uint32 (&br, &rate, 24)) goto bad_config; + } else if (sr_idx >= G_N_ELEMENTS (aac_sample_rates)) { + goto bad_config; } else { /* else use the rate from the table */ rate = aac_sample_rates[sr_idx]; From eff88a239f192344865cfe84a0afac0220af95cb Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 17:03:21 +0100 Subject: [PATCH 26/29] rtpbin: arrange for initialized variables --- gst/rtpmanager/gstrtpbin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index ef00a8519f..621c85b49e 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -1188,8 +1188,11 @@ gst_rtp_bin_associate (GstRtpBin * bin, GstRtpBinStream * stream, guint8 len, * now equating rtptime obtained from RTP-Info, * where the large time represent the otherwise irrelevant npt/ntp time */ stream->rtp_delta = (GST_SECOND << 28) - rtp_clock_base; + } else { + clock_base = rtp_clock_base; } + all_sync = TRUE; for (walk = client->streams; walk; walk = g_slist_next (walk)) { GstRtpBinStream *ostream = (GstRtpBinStream *) walk->data; @@ -1215,7 +1218,7 @@ gst_rtp_bin_associate (GstRtpBin * bin, GstRtpBinStream * stream, guint8 len, /* arrange to re-sync for each stream upon significant change, * e.g. post-seek */ - all_sync = (stream->clock_base == clock_base); + all_sync = all_sync && (stream->clock_base == clock_base); stream->clock_base = clock_base; /* may need init performed above later on, but nothing more to do now */ From 018852ddc2638e464bf4d7158535c56610f039aa Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 17:03:50 +0100 Subject: [PATCH 27/29] rtspsrc: avoid NULL string comparison --- gst/rtsp/gstrtspsrc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index cfdbea49f5..ffb04edb31 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -4331,7 +4331,8 @@ gst_rtspsrc_parse_digest_challenge (GstRTSPConnection * conn, } else value = NULL; - if ((strcmp (item, "stale") == 0) && (strcmp (value, "TRUE") == 0)) + if (item && (strcmp (item, "stale") == 0) && + value && (strcmp (value, "TRUE") == 0)) *stale = TRUE; gst_rtsp_connection_set_auth_param (conn, item, value); g_free (item); From a224ffb971b70fdbf3a1e8334c2a716b163061e3 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Fri, 20 Jan 2012 17:06:42 +0100 Subject: [PATCH 28/29] rtspsrc: simplify internal src event debug logging ... which avoids almost superfluous obtaining of rtsp element. --- gst/rtsp/gstrtspsrc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index ffb04edb31..de142254d5 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -2016,13 +2016,9 @@ gst_rtspsrc_handle_src_event (GstPad * pad, GstEvent * event) static gboolean gst_rtspsrc_handle_internal_src_event (GstPad * pad, GstEvent * event) { - GstRTSPSrc *src; gboolean res; - src = GST_RTSPSRC_CAST (gst_pad_get_element_private (pad)); - - GST_DEBUG_OBJECT (src, "pad %s:%s received event %s", - GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE_NAME (event)); + GST_DEBUG_OBJECT (pad, "received event %s", GST_EVENT_TYPE_NAME (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: From a476d529d2f2d6a2c4a7008387de7cd427581b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 23 Jan 2012 13:15:46 +0000 Subject: [PATCH 29/29] rtpmanager: don't reveal the user's username, hostname or real name by default Send a randomly made-up user@hostname as CNAME and don't send a NAME at all by default. https://bugzilla.gnome.org/show_bug.cgi?id=668320 --- gst/rtpmanager/gstrtpbin.c | 10 ++++------ gst/rtpmanager/rtpsession.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index 621c85b49e..0b2167dd17 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -1883,7 +1883,7 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass) static void gst_rtp_bin_init (GstRtpBin * rtpbin, GstRtpBinClass * klass) { - gchar *str; + gchar *cname; rtpbin->priv = GST_RTP_BIN_GET_PRIVATE (rtpbin); rtpbin->priv->bin_lock = g_mutex_new (); @@ -1901,12 +1901,10 @@ gst_rtp_bin_init (GstRtpBin * rtpbin, GstRtpBinClass * klass) rtpbin->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK; /* some default SDES entries */ - str = g_strdup_printf ("%s@%s", g_get_user_name (), g_get_host_name ()); + cname = g_strdup_printf ("user%u@x-%u.net", g_random_int (), g_random_int ()); rtpbin->sdes = gst_structure_new ("application/x-rtp-source-sdes", - "cname", G_TYPE_STRING, str, - "name", G_TYPE_STRING, g_get_real_name (), - "tool", G_TYPE_STRING, "GStreamer", NULL); - g_free (str); + "cname", G_TYPE_STRING, cname, "tool", G_TYPE_STRING, "GStreamer", NULL); + g_free (cname); } static void diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index eed96ac5b7..72849a7ae8 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -556,12 +556,19 @@ rtp_session_init (RTPSession * sess) sess->mtu = DEFAULT_RTCP_MTU; /* some default SDES entries */ - str = g_strdup_printf ("%s@%s", g_get_user_name (), g_get_host_name ()); + + /* we do not want to leak details like the username or hostname here */ + str = g_strdup_printf ("user%u@x-%u.net", g_random_int (), g_random_int ()); rtp_source_set_sdes_string (sess->source, GST_RTCP_SDES_CNAME, str); g_free (str); - rtp_source_set_sdes_string (sess->source, GST_RTCP_SDES_NAME, - g_get_real_name ()); +#if 0 + /* we do not want to leak the user's real name here */ + str = g_strdup_printf ("Anon%u", g_random_int ()); + rtp_source_set_sdes_string (sess->source, GST_RTCP_SDES_NAME, str); + g_free (str); +#endif + rtp_source_set_sdes_string (sess->source, GST_RTCP_SDES_TOOL, "GStreamer"); sess->first_rtcp = TRUE;