From 04786a6d31bfb150028071e3cf6d26819a1a0a50 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Wed, 2 Feb 2011 16:18:54 +0530 Subject: [PATCH 01/14] pulse: Drop support for PA versions before 0.9.16 This drops support fof PulseAudio versions prior to 0.9.16, which was released about 1.5 years ago. Testing with very old versions is not feasible and we don't want to maintain 2 independent code-paths. --- configure.ac | 22 +----- ext/pulse/pulsesink.c | 172 +++--------------------------------------- ext/pulse/pulsesrc.c | 17 +---- ext/pulse/pulseutil.c | 2 - ext/pulse/pulseutil.h | 18 ----- 5 files changed, 13 insertions(+), 218 deletions(-) diff --git a/configure.ac b/configure.ac index 50dd1c62b3..74dd20026a 100644 --- a/configure.ac +++ b/configure.ac @@ -834,27 +834,7 @@ AG_GST_CHECK_FEATURE(PULSE, [pulseaudio plug-in], pulseaudio, [ dnl used in ext/pulse/pulseutil.c AC_CHECK_HEADERS([process.h]) - AG_GST_PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.10) - AG_GST_PKG_CHECK_MODULES(PULSE_0_9_11, libpulse >= 0.9.11) - if test x$HAVE_PULSE_0_9_11 = xyes; then - AC_DEFINE(HAVE_PULSE_0_9_11, 1, [defined if pulseaudio >= 0.9.11 is available]) - fi - AG_GST_PKG_CHECK_MODULES(PULSE_0_9_12, libpulse >= 0.9.12) - if test x$HAVE_PULSE_0_9_12 = xyes; then - AC_DEFINE(HAVE_PULSE_0_9_12, 1, [defined if pulseaudio >= 0.9.12 is available]) - fi - AG_GST_PKG_CHECK_MODULES(PULSE_0_9_13, libpulse >= 0.9.13) - if test x$HAVE_PULSE_0_9_13 = xyes; then - AC_DEFINE(HAVE_PULSE_0_9_13, 1, [defined if pulseaudio >= 0.9.13 is available]) - fi - AG_GST_PKG_CHECK_MODULES(PULSE_0_9_15, libpulse >= 0.9.15) - if test x$HAVE_PULSE_0_9_15 = xyes; then - AC_DEFINE(HAVE_PULSE_0_9_15, 1, [defined if pulseaudio >= 0.9.15 is available]) - fi - AG_GST_PKG_CHECK_MODULES(PULSE_0_9_16, libpulse >= 0.9.16) - if test x$HAVE_PULSE_0_9_16 = xyes; then - AC_DEFINE(HAVE_PULSE_0_9_16, 1, [defined if pulseaudio >= 0.9.16 is available]) - fi + AG_GST_PKG_CHECK_MODULES(PULSE, libpulse >= 0.9.16) AG_GST_PKG_CHECK_MODULES(PULSE_0_9_20, libpulse >= 0.9.20) if test x$HAVE_PULSE_0_9_20 = xyes; then AC_DEFINE(HAVE_PULSE_0_9_20, 1, [defined if pulseaudio >= 0.9.20 is available]) diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index e4fe6e36dc..3464799f0f 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -63,11 +63,6 @@ GST_DEBUG_CATEGORY_EXTERN (pulse_debug); #define GST_CAT_DEFAULT pulse_debug -/* according to - * http://www.pulseaudio.org/ticket/314 - * we need pulse-0.9.12 to use sink volume properties - */ - #define DEFAULT_SERVER NULL #define DEFAULT_DEVICE NULL #define DEFAULT_DEVICE_NAME NULL @@ -145,13 +140,11 @@ struct _GstPulseRingBuffer pa_sample_spec sample_spec; -#ifdef HAVE_PULSE_0_9_16 void *m_data; size_t m_towrite; size_t m_writable; gint64 m_offset; gint64 m_lastoffset; -#endif gboolean corked:1; gboolean in_commit:1; @@ -229,21 +222,13 @@ gst_pulseringbuffer_init (GstPulseRingBuffer * pbuf) pbuf->context = NULL; pbuf->stream = NULL; -#ifdef HAVE_PULSE_0_9_13 pa_sample_spec_init (&pbuf->sample_spec); -#else - pbuf->sample_spec.format = PA_SAMPLE_INVALID; - pbuf->sample_spec.rate = 0; - pbuf->sample_spec.channels = 0; -#endif -#ifdef HAVE_PULSE_0_9_16 pbuf->m_data = NULL; pbuf->m_towrite = 0; pbuf->m_writable = 0; pbuf->m_offset = 0; pbuf->m_lastoffset = 0; -#endif pbuf->corked = TRUE; pbuf->in_commit = FALSE; @@ -255,7 +240,6 @@ gst_pulsering_destroy_stream (GstPulseRingBuffer * pbuf) { if (pbuf->stream) { -#ifdef HAVE_PULSE_0_9_16 if (pbuf->m_data) { /* drop shm memory buffer */ pa_stream_cancel_write (pbuf->stream); @@ -267,7 +251,6 @@ gst_pulsering_destroy_stream (GstPulseRingBuffer * pbuf) pbuf->m_offset = 0; pbuf->m_lastoffset = 0; } -#endif pa_stream_disconnect (pbuf->stream); @@ -318,9 +301,7 @@ gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf) /* Make sure we don't get any further callbacks */ pa_context_set_state_callback (pctx->context, NULL, NULL); -#ifdef HAVE_PULSE_0_9_12 pa_context_set_subscribe_callback (pctx->context, NULL, NULL); -#endif g_hash_table_remove (gst_pulse_shared_contexts, pbuf->context_name); @@ -397,7 +378,6 @@ gst_pulsering_context_state_cb (pa_context * c, void *userdata) } } -#ifdef HAVE_PULSE_0_9_12 static void gst_pulsering_context_subscribe_cb (pa_context * c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) @@ -431,7 +411,6 @@ gst_pulsering_context_subscribe_cb (pa_context * c, g_atomic_int_compare_and_exchange (&psink->notify, 0, 1); } } -#endif /* will be called when the device should be opened. In this case we will connect * to the server. We should not try to open any streams in this state. */ @@ -478,10 +457,8 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf) /* register some essential callbacks */ pa_context_set_state_callback (pctx->context, gst_pulsering_context_state_cb, mainloop); -#ifdef HAVE_PULSE_0_9_12 pa_context_set_subscribe_callback (pctx->context, gst_pulsering_context_subscribe_cb, pctx); -#endif /* try to connect to the server and wait for completion, we don't want to * autospawn a deamon */ @@ -659,11 +636,7 @@ gst_pulsering_stream_latency_cb (pa_stream * s, void *userdata) GST_LOG_OBJECT (psink, "latency update (information unknown)"); return; } -#ifdef HAVE_PULSE_0_9_11 sink_usec = info->configured_sink_usec; -#else - sink_usec = 0; -#endif GST_LOG_OBJECT (psink, "latency_update, %" G_GUINT64_FORMAT ", %d:%" G_GINT64_FORMAT ", %d:%" @@ -688,7 +661,6 @@ gst_pulsering_stream_suspended_cb (pa_stream * p, void *userdata) GST_DEBUG_OBJECT (psink, "stream resumed"); } -#ifdef HAVE_PULSE_0_9_11 static void gst_pulsering_stream_started_cb (pa_stream * p, void *userdata) { @@ -700,9 +672,7 @@ gst_pulsering_stream_started_cb (pa_stream * p, void *userdata) GST_DEBUG_OBJECT (psink, "stream started"); } -#endif -#ifdef HAVE_PULSE_0_9_15 static void gst_pulsering_stream_event_cb (pa_stream * p, const char *name, pa_proplist * pl, void *userdata) @@ -729,7 +699,6 @@ gst_pulsering_stream_event_cb (pa_stream * p, const char *name, GST_DEBUG_OBJECT (psink, "got unknown event %s", name); } } -#endif /* This method should create a new stream of the given @spec. No playback should * start yet so we start in the corked state. */ @@ -800,14 +769,10 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) gst_pulsering_stream_latency_cb, pbuf); pa_stream_set_suspended_callback (pbuf->stream, gst_pulsering_stream_suspended_cb, pbuf); -#ifdef HAVE_PULSE_0_9_11 pa_stream_set_started_callback (pbuf->stream, gst_pulsering_stream_started_cb, pbuf); -#endif -#ifdef HAVE_PULSE_0_9_15 pa_stream_set_event_callback (pbuf->stream, gst_pulsering_stream_event_cb, pbuf); -#endif /* buffering requirements. When setting prebuf to 0, the stream will not pause * when we cause an underrun, which causes time to continue. */ @@ -836,15 +801,10 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec) /* construct the flags */ flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | -#ifdef HAVE_PULSE_0_9_11 - PA_STREAM_ADJUST_LATENCY | -#endif - PA_STREAM_START_CORKED; + PA_STREAM_ADJUST_LATENCY | PA_STREAM_START_CORKED; -#ifdef HAVE_PULSE_0_9_12 if (psink->mute_set && psink->mute) flags |= PA_STREAM_START_MUTED; -#endif /* we always start corked (see flags above) */ pbuf->corked = TRUE; @@ -1149,18 +1109,16 @@ gst_pulseringbuffer_stop (GstRingBuffer * buf) pa_threaded_mainloop_signal (mainloop, 0); } - if (strcmp (psink->pa_version, "0.9.12")) { - /* then try to flush, it's not fatal when this fails */ - GST_DEBUG_OBJECT (psink, "flushing"); - if ((o = pa_stream_flush (pbuf->stream, gst_pulsering_success_cb, pbuf))) { - while (pa_operation_get_state (o) == PA_OPERATION_RUNNING) { - GST_DEBUG_OBJECT (psink, "wait for completion"); - pa_threaded_mainloop_wait (mainloop); - if (gst_pulsering_is_dead (psink, pbuf, TRUE)) - goto server_dead; - } - GST_DEBUG_OBJECT (psink, "flush completed"); + /* then try to flush, it's not fatal when this fails */ + GST_DEBUG_OBJECT (psink, "flushing"); + if ((o = pa_stream_flush (pbuf->stream, gst_pulsering_success_cb, pbuf))) { + while (pa_operation_get_state (o) == PA_OPERATION_RUNNING) { + GST_DEBUG_OBJECT (psink, "wait for completion"); + pa_threaded_mainloop_wait (mainloop); + if (gst_pulsering_is_dead (psink, pbuf, TRUE)) + goto server_dead; } + GST_DEBUG_OBJECT (psink, "flush completed"); } res = TRUE; @@ -1336,7 +1294,6 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample, "need to write %d samples at offset %" G_GINT64_FORMAT, *toprocess, offset); -#ifdef HAVE_PULSE_0_9_16 if (offset != pbuf->m_lastoffset) GST_LOG_OBJECT (psink, "discontinuity, offset is %" G_GINT64_FORMAT ", " "last offset was %" G_GINT64_FORMAT, offset, pbuf->m_lastoffset); @@ -1484,94 +1441,10 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample, pbuf->m_towrite = 0; pbuf->m_offset = offset + towrite; /* keep track of current offset */ } -#else - - for (;;) { - /* FIXME, this is not quite right */ - if ((avail = pa_stream_writable_size (pbuf->stream)) == (size_t) - 1) - goto writable_size_failed; - - /* We always try to satisfy a request for data */ - GST_LOG_OBJECT (psink, "writable bytes %" G_GSIZE_FORMAT, avail); - - /* convert to samples, we can only deal with multiples of the - * sample size */ - avail /= bps; - - if (avail > 0) - break; - - /* see if we need to uncork because we have no free space */ - if (pbuf->corked) { - if (!gst_pulsering_set_corked (pbuf, FALSE, FALSE)) - goto uncork_failed; - } - - /* we can't write a single byte, wait a bit */ - GST_LOG_OBJECT (psink, "waiting for free space"); - pa_threaded_mainloop_wait (mainloop); - - if (pbuf->paused) - goto was_paused; - } - - if (avail > out_samples) - avail = out_samples; - - towrite = avail * bps; - - GST_LOG_OBJECT (psink, "writing %u samples at offset %" G_GUINT64_FORMAT, - (guint) avail, offset); - - if (G_LIKELY (inr == outr && !reverse)) { - /* no rate conversion, simply write out the samples */ - if (pa_stream_write (pbuf->stream, data, towrite, NULL, offset, - PA_SEEK_ABSOLUTE) < 0) - goto write_failed; - - data += towrite; - in_samples -= avail; - out_samples -= avail; - } else { - guint8 *dest, *d, *d_end; - - /* we need to allocate a temporary buffer to resample the data into, - * FIXME, we should have a pulseaudio API to allocate this buffer for us - * from the shared memory. */ - dest = d = g_malloc (towrite); - d_end = d + towrite; - - if (!reverse) { - if (inr >= outr) - /* forward speed up */ - FWD_UP_SAMPLES (data, data_end, d, d_end); - else - /* forward slow down */ - FWD_DOWN_SAMPLES (data, data_end, d, d_end); - } else { - if (inr >= outr) - /* reverse speed up */ - REV_UP_SAMPLES (data, data_end, d, d_end); - else - /* reverse slow down */ - REV_DOWN_SAMPLES (data, data_end, d, d_end); - } - /* see what we have left to write */ - towrite = (d - dest); - if (pa_stream_write (pbuf->stream, dest, towrite, - g_free, offset, PA_SEEK_ABSOLUTE) < 0) - goto write_failed; - - avail = towrite / bps; - } -#endif /* HAVE_PULSE_0_9_16 */ *sample += avail; offset += avail * bps; - -#ifdef HAVE_PULSE_0_9_16 pbuf->m_lastoffset = offset; -#endif /* check if we need to uncork after writing the samples */ if (pbuf->corked) { @@ -1657,7 +1530,6 @@ write_failed: static void gst_pulsering_flush (GstPulseRingBuffer * pbuf) { -#ifdef HAVE_PULSE_0_9_16 GstPulseSink *psink; psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf)); @@ -1694,7 +1566,6 @@ write_failed: pa_strerror (pa_context_errno (pbuf->context))), (NULL)); goto done; } -#endif } static void gst_pulsesink_set_property (GObject * object, guint prop_id, @@ -1758,14 +1629,11 @@ gst_pulsesink_init_interfaces (GType type) NULL, NULL, }; -#ifdef HAVE_PULSE_0_9_12 static const GInterfaceInfo svol_iface_info = { NULL, NULL, NULL }; g_type_add_interface_static (type, GST_TYPE_STREAM_VOLUME, &svol_iface_info); -#endif - g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, &implements_iface_info); g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE, @@ -1796,7 +1664,6 @@ gst_pulsesink_base_init (gpointer g_class) "width = (int) 32, " "depth = (int) 32, " "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 32 ];" -#ifdef HAVE_PULSE_0_9_15 "audio/x-raw-int, " "endianness = (int) { " ENDIANNESS " }, " "signed = (boolean) TRUE, " @@ -1810,7 +1677,6 @@ gst_pulsesink_base_init (gpointer g_class) "width = (int) 32, " "depth = (int) 24, " "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 32 ];" -#endif "audio/x-raw-int, " "signed = (boolean) FALSE, " "width = (int) 8, " @@ -1888,7 +1754,6 @@ gst_pulsesink_class_init (GstPulseSinkClass * klass) "Human-readable name of the sound device", DEFAULT_DEVICE_NAME, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); -#ifdef HAVE_PULSE_0_9_12 g_object_class_install_property (gobject_class, PROP_VOLUME, g_param_spec_double ("volume", "Volume", @@ -1899,7 +1764,6 @@ gst_pulsesink_class_init (GstPulseSinkClass * klass) g_param_spec_boolean ("mute", "Mute", "Mute state of this stream", DEFAULT_MUTE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -#endif /** * GstPulseSink:client @@ -1997,15 +1861,9 @@ gst_pulsesink_init (GstPulseSink * pulsesink, GstPulseSinkClass * klass) pulsesink->notify = 0; - /* needed for conditional execution */ - pulsesink->pa_version = pa_get_library_version (); - pulsesink->properties = NULL; pulsesink->proplist = NULL; - GST_DEBUG_OBJECT (pulsesink, "using pulseaudio version %s", - pulsesink->pa_version); - /* override with a custom clock */ if (GST_BASE_AUDIO_SINK (pulsesink)->provided_clock) gst_object_unref (GST_BASE_AUDIO_SINK (pulsesink)->provided_clock); @@ -2043,7 +1901,6 @@ gst_pulsesink_finalize (GObject * object) G_OBJECT_CLASS (parent_class)->finalize (object); } -#ifdef HAVE_PULSE_0_9_12 static void gst_pulsesink_set_volume (GstPulseSink * psink, gdouble volume) { @@ -2342,7 +2199,6 @@ info_failed: goto unlock; } } -#endif static void gst_pulsesink_sink_info_cb (pa_context * c, const pa_sink_info * i, int eol, @@ -2435,14 +2291,12 @@ gst_pulsesink_set_property (GObject * object, g_free (pulsesink->device); pulsesink->device = g_value_dup_string (value); break; -#ifdef HAVE_PULSE_0_9_12 case PROP_VOLUME: gst_pulsesink_set_volume (pulsesink, g_value_get_double (value)); break; case PROP_MUTE: gst_pulsesink_set_mute (pulsesink, g_value_get_boolean (value)); break; -#endif case PROP_CLIENT: g_free (pulsesink->client_name); if (!g_value_get_string (value)) { @@ -2484,14 +2338,12 @@ gst_pulsesink_get_property (GObject * object, case PROP_DEVICE_NAME: g_value_take_string (value, gst_pulsesink_device_description (pulsesink)); break; -#ifdef HAVE_PULSE_0_9_12 case PROP_VOLUME: g_value_set_double (value, gst_pulsesink_get_volume (pulsesink)); break; case PROP_MUTE: g_value_set_boolean (value, gst_pulsesink_get_mute (pulsesink)); break; -#endif case PROP_CLIENT: g_value_set_string (value, pulsesink->client_name); break; @@ -2547,7 +2399,6 @@ name_failed: } } -#ifdef HAVE_PULSE_0_9_11 static void gst_pulsesink_change_props (GstPulseSink * psink, GstTagList * l) { @@ -2625,7 +2476,6 @@ update_failed: goto unlock; } } -#endif static void gst_pulsesink_flush_ringbuffer (GstPulseSink * psink) @@ -2701,9 +2551,7 @@ gst_pulsesink_event (GstBaseSink * sink, GstEvent * event) g_free (description); g_free (buf); -#ifdef HAVE_PULSE_0_9_11 gst_pulsesink_change_props (pulsesink, l); -#endif break; } diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c index ebb41c19b4..9c078fba75 100644 --- a/ext/pulse/pulsesrc.c +++ b/ext/pulse/pulsesrc.c @@ -299,13 +299,7 @@ gst_pulsesrc_init (GstPulseSrc * pulsesrc, GstPulseSrcClass * klass) pulsesrc->read_buffer = NULL; pulsesrc->read_buffer_length = 0; -#ifdef HAVE_PULSE_0_9_13 pa_sample_spec_init (&pulsesrc->sample_spec); -#else - pulsesrc->sample_spec.format = PA_SAMPLE_INVALID; - pulsesrc->sample_spec.rate = 0; - pulsesrc->sample_spec.channels = 0; -#endif pulsesrc->operation_success = FALSE; pulsesrc->paused = FALSE; @@ -598,11 +592,7 @@ gst_pulsesrc_stream_latency_update_cb (pa_stream * s, void *userdata) "latency update (information unknown)"); return; } -#ifdef HAVE_PULSE_0_9_11 source_usec = info->configured_source_usec; -#else - source_usec = 0; -#endif GST_LOG_OBJECT (GST_PULSESRC_CAST (userdata), "latency_update, %" G_GUINT64_FORMAT ", %d:%" G_GINT64_FORMAT ", %d:%" @@ -1042,11 +1032,8 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec) GST_INFO_OBJECT (pulsesrc, "fragsize: %d", wanted.fragsize); if (pa_stream_connect_record (pulsesrc->stream, pulsesrc->device, &wanted, - PA_STREAM_INTERPOLATE_TIMING | - PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_NOT_MONOTONOUS | -#ifdef HAVE_PULSE_0_9_11 - PA_STREAM_ADJUST_LATENCY | -#endif + PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | + PA_STREAM_NOT_MONOTONIC | PA_STREAM_ADJUST_LATENCY | PA_STREAM_START_CORKED) < 0) { GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Failed to connect stream: %s", diff --git a/ext/pulse/pulseutil.c b/ext/pulse/pulseutil.c index 058f2fb7c9..8fbb3caece 100644 --- a/ext/pulse/pulseutil.c +++ b/ext/pulse/pulseutil.c @@ -98,7 +98,6 @@ gst_pulse_fill_sample_spec (GstRingBufferSpec * spec, pa_sample_spec * ss) ss->format = PA_SAMPLE_S32LE; else if (spec->format == GST_S32_BE && spec->width == 32) ss->format = PA_SAMPLE_S32BE; -#ifdef HAVE_PULSE_0_9_15 else if (spec->format == GST_S24_3LE && spec->width == 24) ss->format = PA_SAMPLE_S24LE; else if (spec->format == GST_S24_3BE && spec->width == 24) @@ -107,7 +106,6 @@ gst_pulse_fill_sample_spec (GstRingBufferSpec * spec, pa_sample_spec * ss) ss->format = PA_SAMPLE_S24_32LE; else if (spec->format == GST_S24_BE && spec->width == 32) ss->format = PA_SAMPLE_S24_32BE; -#endif else return FALSE; diff --git a/ext/pulse/pulseutil.h b/ext/pulse/pulseutil.h index 75b31120a9..ec04ffc0cb 100644 --- a/ext/pulse/pulseutil.h +++ b/ext/pulse/pulseutil.h @@ -41,22 +41,4 @@ void gst_pulse_cvolume_from_linear (pa_cvolume *v, unsigned channels, gdouble vo pa_proplist *gst_pulse_make_proplist (const GstStructure *properties); -#if !HAVE_PULSE_0_9_11 -static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) { - return - x == PA_CONTEXT_CONNECTING || - x == PA_CONTEXT_AUTHORIZING || - x == PA_CONTEXT_SETTING_NAME || - x == PA_CONTEXT_READY; -} - -/** Return non-zero if the passed state is one of the connected states */ -static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) { - return - x == PA_STREAM_CREATING || - x == PA_STREAM_READY; -} - -#endif - #endif From 55cb5c288927f84742732f06f639420e5e52e107 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 23 Jun 2011 11:28:27 -0700 Subject: [PATCH 02/14] Automatic update of common submodule From 69b981f to 605cd9a --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 69b981f10c..605cd9a65e 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 69b981f10caa234ad0ff639179d0fda8505bd94b +Subproject commit 605cd9a65ed61505f24b840d3fe8e252be72b151 From 977a5eee7abf5ac9ed341bb6cf0a2d5785a7baac Mon Sep 17 00:00:00 2001 From: Miguel Angel Cabrera Moya Date: Fri, 24 Jun 2011 11:54:29 +0200 Subject: [PATCH 03/14] rtpjitterbuffer: return correct type when assertion fails --- gst/rtpmanager/rtpjitterbuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c index 341388bd25..f6382fc614 100644 --- a/gst/rtpmanager/rtpjitterbuffer.c +++ b/gst/rtpmanager/rtpjitterbuffer.c @@ -699,7 +699,7 @@ rtp_jitter_buffer_pop (RTPJitterBuffer * jbuf, gint * percent) { GstBuffer *buf; - g_return_val_if_fail (jbuf != NULL, FALSE); + g_return_val_if_fail (jbuf != NULL, NULL); buf = g_queue_pop_tail (jbuf->packets); @@ -727,7 +727,7 @@ rtp_jitter_buffer_peek (RTPJitterBuffer * jbuf) { GstBuffer *buf; - g_return_val_if_fail (jbuf != NULL, FALSE); + g_return_val_if_fail (jbuf != NULL, NULL); buf = g_queue_peek_tail (jbuf->packets); From d9f4c59c494cce8bb732089b8a4e6448c9abb60f Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Mon, 20 Jun 2011 18:49:57 +0200 Subject: [PATCH 04/14] dv1394src: make the internal clock thread safe Fixes: #653091. --- ext/raw1394/gst1394clock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/raw1394/gst1394clock.c b/ext/raw1394/gst1394clock.c index b7d4a8f177..0505c8cb1c 100644 --- a/ext/raw1394/gst1394clock.c +++ b/ext/raw1394/gst1394clock.c @@ -113,6 +113,7 @@ gst_1394_clock_get_internal_time (GstClock * clock) _1394clock = GST_1394_CLOCK_CAST (clock); if (_1394clock->handle != NULL) { + GST_OBJECT_LOCK (clock); raw1394_read_cycle_timer (_1394clock->handle, &cycle_timer, &local_time); if (cycle_timer < _1394clock->cycle_timer_lo) { @@ -130,6 +131,7 @@ gst_1394_clock_get_internal_time (GstClock * clock) result += (((cycle_timer >> 12) & 0x1fff) * 125) * GST_USECOND; GST_LOG_OBJECT (clock, "result %" GST_TIME_FORMAT, GST_TIME_ARGS (result)); + GST_OBJECT_UNLOCK (clock); } else { result = GST_CLOCK_TIME_NONE; } From f528f62b53d5ff0cf906832eb72d9b972e419a0f Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 25 Jun 2011 11:39:23 -0700 Subject: [PATCH 05/14] configure: remove non-pkg-config check for shout Fixes: 653327 --- configure.ac | 6 ------ 1 file changed, 6 deletions(-) diff --git a/configure.ac b/configure.ac index 74dd20026a..d6f2b9ba2e 100644 --- a/configure.ac +++ b/configure.ac @@ -896,12 +896,6 @@ dnl *** shout2 *** translit(dnm, m, l) AM_CONDITIONAL(USE_SHOUT2, true) AG_GST_CHECK_FEATURE(SHOUT2, [Shoutcast/Icecast client library], shout2, [ AG_GST_PKG_CHECK_MODULES(SHOUT2, shout >= 2.0) - if test $HAVE_SHOUT2 = no - then - AM_PATH_SHOUT2(HAVE_SHOUT2="yes") - AC_SUBST(SHOUT2_CFLAGS) - AC_SUBST(SHOUT2_LIBS) - fi ]) dnl *** soup *** From 1912c869469bec10dddcd26a82d18ef767228a1d Mon Sep 17 00:00:00 2001 From: Jonas Larsson Date: Tue, 28 Jun 2011 12:26:37 +0200 Subject: [PATCH 06/14] aacparse: not so greedy minimum frame size Fixes #653559. --- gst/audioparsers/gstaacparse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c index df7c401ab3..5ee8466913 100644 --- a/gst/audioparsers/gstaacparse.c +++ b/gst/audioparsers/gstaacparse.c @@ -611,7 +611,8 @@ gst_aac_parse_check_valid_frame (GstBaseParse * parse, } else { GST_DEBUG ("buffer didn't contain valid frame"); - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), 1024); + gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), + ADTS_MAX_SIZE); } return ret; @@ -696,7 +697,7 @@ gst_aac_parse_start (GstBaseParse * parse) aacparse = GST_AAC_PARSE (parse); GST_DEBUG ("start"); - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), 1024); + gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), ADTS_MAX_SIZE); return TRUE; } From cc526d2e5262c2d28d701f9d13dd8b0e947e2e8e Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Wed, 29 Jun 2011 12:05:04 +0200 Subject: [PATCH 07/14] qtmux: free date tag --- gst/isomp4/gstqtmux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index 60ebab7706..8d2ed3e2c5 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -613,6 +613,8 @@ gst_qt_mux_add_mp4_date (GstQTMux * qtmux, const GstTagList * list, month = g_date_get_month (date); day = g_date_get_day (date); + g_date_free (date); + if (year == G_DATE_BAD_YEAR && month == G_DATE_BAD_MONTH && day == G_DATE_BAD_DAY) { GST_WARNING_OBJECT (qtmux, "invalid date in tag"); From 2f94df80325006fa72009e0c9d9e69b51e9ee3b5 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 29 Jun 2011 14:39:52 -0700 Subject: [PATCH 08/14] jpegenc: Don't round up size of encoded buffers For some reason, in code dating to 2001, encoded jpeg buffers were rounded up to multiples of 4 bytes. With the added bonus that the extra bytes are unwritten, causing valgrind issues. Oops. I can't think of any reason why JPEG buffers need to be multiples of 4 bytes, so I removed the padding. There might be some code somewhere that depends on this behavior, so if this needs to be reverted, please fix the valgrind issues. --- ext/jpeg/gstjpegenc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c index 8708a70a45..e631be6dd9 100644 --- a/ext/jpeg/gstjpegenc.c +++ b/ext/jpeg/gstjpegenc.c @@ -246,8 +246,7 @@ gst_jpegenc_term_destination (j_compress_ptr cinfo) /* Trim the buffer size and push it. */ GST_BUFFER_SIZE (jpegenc->output_buffer) = - GST_ROUND_UP_4 (GST_BUFFER_SIZE (jpegenc->output_buffer) - - jpegenc->jdest.free_in_buffer); + GST_BUFFER_SIZE (jpegenc->output_buffer) - jpegenc->jdest.free_in_buffer; g_signal_emit (G_OBJECT (jpegenc), gst_jpegenc_signals[FRAME_ENCODED], 0); From c8619aa0fdc114e9bae0f88f76aa093f96d066b3 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Fri, 10 Jun 2011 18:54:48 +0530 Subject: [PATCH 09/14] matroskaparse: fix reference counting of parse->streamheader https://bugzilla.gnome.org/show_bug.cgi?id=652286 Signed-off-by: David Schleef --- gst/matroska/matroska-parse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst/matroska/matroska-parse.c b/gst/matroska/matroska-parse.c index 8f8da64fcc..a790a2f092 100644 --- a/gst/matroska/matroska-parse.c +++ b/gst/matroska/matroska-parse.c @@ -2527,8 +2527,10 @@ gst_matroska_parse_output (GstMatroskaParse * parse, GstBuffer * buffer, s = gst_caps_get_structure (caps, 0); g_value_init (&streamheader, GST_TYPE_ARRAY); g_value_init (&bufval, GST_TYPE_BUFFER); - GST_BUFFER_FLAG_SET (parse->streamheader, GST_BUFFER_FLAG_IN_CAPS); - gst_value_set_buffer (&bufval, parse->streamheader); + buf = gst_buffer_copy (parse->streamheader); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS); + gst_value_set_buffer (&bufval, buf); + gst_buffer_unref (buf); gst_value_array_append_value (&streamheader, &bufval); g_value_unset (&bufval); gst_structure_set_value (s, "streamheader", &streamheader); @@ -2536,7 +2538,7 @@ gst_matroska_parse_output (GstMatroskaParse * parse, GstBuffer * buffer, //gst_caps_replace (parse->caps, caps); gst_pad_set_caps (parse->srcpad, caps); - buf = gst_buffer_make_metadata_writable (parse->streamheader); + buf = gst_buffer_copy (parse->streamheader); gst_buffer_set_caps (buf, caps); gst_caps_unref (caps); From e385108f840065efb060f552764c0fa47767fc6a Mon Sep 17 00:00:00 2001 From: Branko Subasic Date: Thu, 16 Jun 2011 14:52:51 +0200 Subject: [PATCH 10/14] matroskademux: avoid looping when searching for clusters Fixes some bugs that results in the demuxer looping when seaching for clusters in non-finalized files. https://bugzilla.gnome.org/show_bug.cgi?id=652195 --- gst/matroska/ebml-read.c | 1 - gst/matroska/matroska-demux.c | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gst/matroska/ebml-read.c b/gst/matroska/ebml-read.c index 24780e7775..c2dfa522a4 100644 --- a/gst/matroska/ebml-read.c +++ b/gst/matroska/ebml-read.c @@ -131,7 +131,6 @@ gst_ebml_peek_id_length (guint32 * _id, guint64 * _length, guint * _needed, *_length = G_MAXUINT64; else *_length = total; - *_length = total; *_needed = needed; diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index a6fb32f138..23a88f9a71 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -1608,6 +1608,10 @@ gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos) GstByteReader reader; gint cluster_pos; + if (buf != NULL) { + gst_buffer_unref (buf); + buf = NULL; + } ret = gst_pad_pull_range (demux->common.sinkpad, newpos, chunk, &buf); if (ret != GST_FLOW_OK) break; @@ -1636,13 +1640,15 @@ gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos) demux->common.offset = newpos; ret = gst_matroska_read_common_peek_id_length_pull (&demux->common, GST_ELEMENT_CAST (demux), &id, &length, &needed); - if (ret != GST_FLOW_OK) - goto resume; + if (ret != GST_FLOW_OK) { + GST_DEBUG_OBJECT (demux, "need more data -> continue"); + continue; + } g_assert (id == GST_MATROSKA_ID_CLUSTER); GST_DEBUG_OBJECT (demux, "cluster size %" G_GUINT64_FORMAT ", prefix %d", length, needed); /* ok if undefined length or first cluster */ - if (length == G_MAXUINT64) { + if (length == GST_EBML_SIZE_UNKNOWN || length == G_MAXUINT64) { GST_DEBUG_OBJECT (demux, "cluster has undefined length -> OK"); break; } @@ -1661,8 +1667,6 @@ gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos) } else { /* partial cluster id may have been in tail of buffer */ newpos += MAX (gst_byte_reader_get_remaining (&reader), 4) - 3; - gst_buffer_unref (buf); - buf = NULL; } } @@ -1716,6 +1720,10 @@ gst_matroska_demux_search_pos (GstMatroskaDemux * demux, GstClockTime time) otime = demux->common.segment.last_stop; GST_OBJECT_UNLOCK (demux); + /* avoid division by zero in first estimation below */ + if (otime == 0) + otime = time; + retry: GST_LOG_OBJECT (demux, "opos: %" G_GUINT64_FORMAT ", otime: %" GST_TIME_FORMAT, opos, From 32aa80cda8e8f7a958a2e1bf2410b2964f3617a7 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 30 Jun 2011 18:47:48 -0700 Subject: [PATCH 11/14] multipartmux: Add \r\n to tail of pushed buffers Clients such as Firefox require the \r\n after the payload. --- gst/multipart/multipartmux.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/gst/multipart/multipartmux.c b/gst/multipart/multipartmux.c index 9f246ddf49..9f69975f56 100644 --- a/gst/multipart/multipartmux.c +++ b/gst/multipart/multipartmux.c @@ -427,6 +427,7 @@ gst_multipart_mux_collected (GstCollectPads * pads, GstMultipartMux * mux) gchar *header = NULL; size_t headerlen; GstBuffer *headerbuf = NULL; + GstBuffer *footerbuf = NULL; GstBuffer *databuf = NULL; GstStructure *structure = NULL; const gchar *mime; @@ -484,7 +485,7 @@ gst_multipart_mux_collected (GstCollectPads * pads, GstMultipartMux * mux) /* get the mime type for the structure */ mime = gst_multipart_mux_get_mime (mux, structure); - header = g_strdup_printf ("\r\n--%s\r\nContent-Type: %s\r\n" + header = g_strdup_printf ("--%s\r\nContent-Type: %s\r\n" "Content-Length: %u\r\n\r\n", mux->boundary, mime, GST_BUFFER_SIZE (best->buffer)); headerlen = strlen (header); @@ -529,6 +530,29 @@ gst_multipart_mux_collected (GstCollectPads * pads, GstMultipartMux * mux) GST_DEBUG_OBJECT (mux, "pushing %u bytes data buffer", GST_BUFFER_SIZE (databuf)); ret = gst_pad_push (mux->srcpad, databuf); + if (ret != GST_FLOW_OK) + /* push always takes ownership of the buffer, even after an error, so we + * don't need to unref headerbuf here. */ + goto beach; + + ret = gst_pad_alloc_buffer_and_set_caps (mux->srcpad, GST_BUFFER_OFFSET_NONE, + 2, GST_PAD_CAPS (mux->srcpad), &footerbuf); + if (ret != GST_FLOW_OK) + goto alloc_failed; + + memcpy (GST_BUFFER_DATA (footerbuf), "\r\n", 2); + + /* the footer has the same timestamp as the data buffer and has a + * duration of 0 */ + GST_BUFFER_TIMESTAMP (footerbuf) = best->timestamp; + GST_BUFFER_DURATION (footerbuf) = 0; + GST_BUFFER_OFFSET (footerbuf) = mux->offset; + mux->offset += 2; + GST_BUFFER_OFFSET_END (footerbuf) = mux->offset; + GST_BUFFER_FLAG_SET (footerbuf, GST_BUFFER_FLAG_DELTA_UNIT); + + GST_DEBUG_OBJECT (mux, "pushing %" G_GSIZE_FORMAT " bytes footer buffer", 2); + ret = gst_pad_push (mux->srcpad, footerbuf); beach: if (best && best->buffer) { From f69dcaab58b262bb60fbbd561f01b9e049ba8da4 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 3 Jul 2011 19:51:32 -0700 Subject: [PATCH 12/14] pulse: Increase ranks to PRIMARY + 10 So that pulsesrc/pulsesink get chosen over other possible PRIMARY src/sinks by autoaudiosink. Presumably, if pulse is available, it is always preferred over another src/sink. Fixes: #647540. --- ext/pulse/plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pulse/plugin.c b/ext/pulse/plugin.c index beb88488c3..3abc26fc96 100644 --- a/ext/pulse/plugin.c +++ b/ext/pulse/plugin.c @@ -41,11 +41,11 @@ plugin_init (GstPlugin * plugin) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); #endif - if (!gst_element_register (plugin, "pulsesink", GST_RANK_PRIMARY, + if (!gst_element_register (plugin, "pulsesink", GST_RANK_PRIMARY + 10, GST_TYPE_PULSESINK)) return FALSE; - if (!gst_element_register (plugin, "pulsesrc", GST_RANK_PRIMARY, + if (!gst_element_register (plugin, "pulsesrc", GST_RANK_PRIMARY + 10, GST_TYPE_PULSESRC)) return FALSE; From 350b9b9d2db4eb6c85cbfb5c2fe56a4859b12ce8 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Mon, 4 Jul 2011 11:24:23 +0200 Subject: [PATCH 13/14] flvdemux: indicate raw format in aac caps --- gst/flv/gstflvdemux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c index fae7e4153f..7432520e27 100644 --- a/gst/flv/gstflvdemux.c +++ b/gst/flv/gstflvdemux.c @@ -675,7 +675,8 @@ gst_flv_demux_audio_negotiate (GstFlvDemux * demux, guint32 codec_tag, } } caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 4, "framed", G_TYPE_BOOLEAN, TRUE, NULL); + "mpegversion", G_TYPE_INT, 4, "framed", G_TYPE_BOOLEAN, TRUE, + "stream-format", G_TYPE_STRING, "raw", NULL); break; } case 7: From b307c74e9e4ad3eb80339e685feb187ff929558a Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Mon, 4 Jul 2011 11:25:28 +0200 Subject: [PATCH 14/14] flvmux: pass along segment info to collectpads ... so it can track this and be subsequently used to determine running time etc. --- gst/flv/gstflvmux.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c index 93517822e2..f1612a475a 100644 --- a/gst/flv/gstflvmux.c +++ b/gst/flv/gstflvmux.c @@ -274,11 +274,6 @@ gst_flv_mux_handle_sink_event (GstPad * pad, GstEvent * event) mux->new_tags = TRUE; break; } - case GST_EVENT_NEWSEGMENT: - /* We don't support NEWSEGMENT events */ - ret = FALSE; - gst_event_unref (event); - break; default: break; }