audiomixer: calculate stream_time used to sync pad values correctly
authorTim-Philipp Müller <tim@centricular.com>
Thu, 12 Feb 2015 11:26:44 +0000 (11:26 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 12 Feb 2015 11:41:10 +0000 (11:41 +0000)
Use pad (input) segment to calculate the stream time from the
input timestamp, not the aggregator (output) segment.

gst/audiomixer/gstaudiomixer.c

index a58ef74..f48e268 100644 (file)
@@ -973,22 +973,20 @@ static gboolean
 gst_audio_mixer_fill_buffer (GstAudioMixer * audiomixer, GstAudioMixerPad * pad,
     GstBuffer * inbuf)
 {
+  GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
   GstClockTime start_time, end_time;
   gboolean discont = FALSE;
   guint64 start_offset, end_offset;
   GstClockTime timestamp, stream_time;
   gint rate, bpf;
 
-  GstAggregator *agg = GST_AGGREGATOR (audiomixer);
-  GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
-
   g_assert (pad->buffer == NULL);
 
   rate = GST_AUDIO_INFO_RATE (&audiomixer->info);
   bpf = GST_AUDIO_INFO_BPF (&audiomixer->info);
 
   timestamp = GST_BUFFER_TIMESTAMP (inbuf);
-  stream_time = gst_segment_to_stream_time (&agg->segment, GST_FORMAT_TIME,
+  stream_time = gst_segment_to_stream_time (&aggpad->segment, GST_FORMAT_TIME,
       timestamp);
 
   /* sync object properties on stream time */