Talking clock - timestamp problem?

David Holroyd dave at badgers-in-foil.co.uk
Mon Aug 25 15:14:07 PDT 2014


Hi,

On 25/08/14 14:29, David Holroyd wrote:
> On 24/08/14 00:35, David Holroyd wrote:
>> On 20/08/14 23:11, Tim Müller wrote:
>>> On 18/08/14 22:11, David Holroyd wrote:
>>>> I am trying to build a pipeline something like a 'talking clock',
>>>> continually announcing the current date and time as test input to
>>>> another system.
>
>>> Perhaps have two separate pipelines, connected via interaudiosink/src
>>> elements:
>>>
>>>    interaudiosrc ! ... ! rtpL24pay ! udpsink
>>>
>>> and then
>>>
>>>    appsrc ! festival ! wavparse ! ... ! interaudiosink

>> When I run the pipelines with GST_DEBUG=4, I see that interaudiosrc is
>> inserting silence inbetween pieces of audio,

> I hacked-out the entire test that does gst_adapter_flush() in
> gst_inter_audio_src_create(), which seems to have improved things greatly:

...and FWIW avoiding adding any silence unless there is actually no data 
available (but sometimes pushing shorter buffers than current code) 
leaves no audio glitches that I can hear:


diff --git a/gst/inter/gstinteraudiosrc.c b/gst/inter/gstinteraudiosrc.c
index cab0eb6..4d7a8e0 100644
--- a/gst/inter/gstinteraudiosrc.c
+++ b/gst/inter/gstinteraudiosrc.c
@@ -283,13 +283,17 @@ gst_inter_audio_src_create (GstBaseSrc * src, 
guint64 offset, guint size,

    g_mutex_lock (&interaudiosrc->surface->mutex);
    n = gst_adapter_available (interaudiosrc->surface->audio_adapter) / 4;
+/*
    if (n > SIZE * 3) {
      GST_WARNING ("flushing %d samples", SIZE / 2);
      gst_adapter_flush (interaudiosrc->surface->audio_adapter, (SIZE / 
2) * 4);
      n -= (SIZE / 2);
    }
+*/
    if (n > SIZE) {
      n = SIZE;
    if (n > 0) {
      buffer = gst_adapter_take_buffer 
(interaudiosrc->surface->audio_adapter,
          n * 4);
@@ -298,7 +302,7 @@ gst_inter_audio_src_create (GstBaseSrc * src, 
guint64 offset, guint size,
    }
    g_mutex_unlock (&interaudiosrc->surface->mutex);

-  if (n < SIZE) {
+  if (n == 0) {
      GstMapInfo map;
      GstMemory *mem;

@@ -310,8 +314,8 @@ gst_inter_audio_src_create (GstBaseSrc * src, 
guint64 offset, guint size,
      }
      buffer = gst_buffer_make_writable (buffer);
      gst_buffer_prepend_memory (buffer, mem);
+    n = SIZE;
    }
-  n = SIZE;

    GST_BUFFER_OFFSET (buffer) = interaudiosrc->n_samples;
    GST_BUFFER_OFFSET_END (buffer) = interaudiosrc->n_samples + n;


ta,
dave


More information about the gstreamer-devel mailing list