mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 18:51:11 +00:00
audiomixer: Mark a discont when we receive a new segment event
This allows us to handle new segment events correctly; either by dropping buffers or inserting silence; for example if the offset is changed on an srcpad connected to audiomixer.
This commit is contained in:
parent
38cf87aaea
commit
8227310d22
2 changed files with 11 additions and 1 deletions
|
@ -675,7 +675,9 @@ gst_audiomixer_sink_event (GstAggregator * agg, GstAggregatorPad * aggpad,
|
|||
}
|
||||
case GST_EVENT_SEGMENT:
|
||||
{
|
||||
GstAudioMixerPad *pad = GST_AUDIO_MIXER_PAD (aggpad);
|
||||
const GstSegment *segment;
|
||||
|
||||
gst_event_parse_segment (event, &segment);
|
||||
if (segment->rate != agg->segment.rate) {
|
||||
GST_ERROR_OBJECT (aggpad,
|
||||
|
@ -689,6 +691,10 @@ gst_audiomixer_sink_event (GstAggregator * agg, GstAggregatorPad * aggpad,
|
|||
res = FALSE;
|
||||
gst_event_unref (event);
|
||||
event = NULL;
|
||||
} else {
|
||||
/* Ideally, this should only be set when the new segment causes running
|
||||
* times to change, and hence needs discont calculation in fill_buffer */
|
||||
pad->new_segment = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1007,8 +1013,9 @@ gst_audio_mixer_fill_buffer (GstAudioMixer * audiomixer, GstAudioMixerPad * pad,
|
|||
|
||||
if (GST_BUFFER_IS_DISCONT (inbuf)
|
||||
|| GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_RESYNC)
|
||||
|| pad->next_offset == -1) {
|
||||
|| pad->new_segment || pad->next_offset == -1) {
|
||||
discont = TRUE;
|
||||
pad->new_segment = FALSE;
|
||||
} else {
|
||||
guint64 diff, max_sample_diff;
|
||||
|
||||
|
|
|
@ -110,6 +110,9 @@ struct _GstAudioMixerPad {
|
|||
|
||||
/* Last time we noticed a discont */
|
||||
GstClockTime discont_time;
|
||||
|
||||
/* A new unhandled segment event has been received */
|
||||
gboolean new_segment;
|
||||
};
|
||||
|
||||
struct _GstAudioMixerPadClass {
|
||||
|
|
Loading…
Reference in a new issue