From 04333a568cb82f398cb0b9bca7e33a6df5a702f9 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 17 Jan 2006 11:43:49 +0000 Subject: [PATCH] gst-libs/gst/audio/gstbaseaudiosink.c: Fix playback of non-synchronised streams by assuming a rate of 1.0 instead of ... Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_render): Fix playback of non-synchronised streams by assuming a rate of 1.0 instead of a random one. Makes this work again: gst-launch filesrc location=raw_audio.file ! 'audio/x-raw-int, endianness=(int)4321, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2' ! audioconvert ! audioresample ! alsasink --- ChangeLog | 14 ++++++++++++++ gst-libs/gst/audio/gstbaseaudiosink.c | 7 ++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b1bf4cea8..724a81f6e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-01-17 Jan Schmidt + + * gst-libs/gst/audio/gstbaseaudiosink.c: + (gst_base_audio_sink_render): + Fix playback of non-synchronised streams by assuming a rate + of 1.0 instead of a random one. + + Makes this work again: + + gst-launch filesrc location=raw_audio.file ! 'audio/x-raw-int, + endianness=(int)4321, signed=(boolean)true, width=(int)16, + depth=(int)16, rate=(int)44100, channels=(int)2' ! audioconvert ! + audioresample ! alsasink + === release 0.10.2 === 2006-01-16 Thomas Vander Stichele diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c index 6c697f653f..ea0850006c 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.c +++ b/gst-libs/gst/audio/gstbaseaudiosink.c @@ -405,7 +405,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) guint size; guint samples; gint bps; - gdouble crate; + gdouble crate = 1.0; GstClockTime crate_num; GstClockTime crate_denom; GstClockTime cinternal, cexternal; @@ -438,6 +438,8 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) * sample ASAP */ if (!GST_CLOCK_TIME_IS_VALID (time) || !bsink->sync) { render_offset = gst_base_audio_sink_get_offset (sink); + GST_DEBUG ("Buffer of size %u has no time. Using render_offset=%" + G_GUINT64_FORMAT, GST_BUFFER_SIZE (buf), render_offset); goto no_sync; } @@ -488,12 +490,11 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) GST_DEBUG ("resync"); } -no_sync: crate = ((gdouble) crate_num) / crate_denom; GST_DEBUG_OBJECT (sink, "internal %" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT ", rate %g", cinternal, cexternal, crate); - +no_sync: /* clip length based on rate */ samples = MIN (samples, samples / (crate * ABS (bsink->segment.rate))); -- 2.34.1