After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 791353 - interaudio: Add option to enable/disable gap flags in nullsample buffers
interaudio: Add option to enable/disable gap flags in nullsample buffers
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 781721
Blocks:
 
 
Reported: 2017-12-07 15:40 UTC by Carlos Rafael Giani
Modified: 2018-11-03 14:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
nullsample gap gobject property patch (4.36 KB, patch)
2017-12-07 15:41 UTC, Carlos Rafael Giani
none Details | Review

Description Carlos Rafael Giani 2017-12-07 15:40:05 UTC
If the interaudio channel runs out of data, nullsample buffers are created.
interaudiosrc sets the GAP flag of these buffers. In some cases, it may
be preferable to not set the flag (for example, to produce one continuous
seamless stream even if the other side of the channel is currently paused).

One such case would be a system with a producer and a consumer pipeline, linked
together through an interaudio channel. The consumer pipeline always runs, while
the producer pipeline may sometimes be stopped, seeking, paused etc. In such a
case, it is necessary to make sure the consumer's interaudiosrc produces a
continuous stream. GAP flags would introduce unnecessary resynchronization events
inside the consumer pipeline's audio sink.
Comment 1 Carlos Rafael Giani 2017-12-07 15:41:45 UTC
Created attachment 365206 [details] [review]
nullsample gap gobject property patch
Comment 2 Tim-Philipp Müller 2018-01-25 23:07:46 UTC
You can remove GAP flags on buffers with

  .. ! identity drop-buffer-flags=gap ! ...

for what it's worth.

I feel this shouldn't really be needed though, including this property. If the BUFFER_FLAG_GAP handling in baseaudiosink is problematic in some way, perhaps it needs to be revisited? It sounds like there might either be a bug, undesired side effect or oversight. It's only supposed to be an optimisation afaik.
Comment 3 Carlos Rafael Giani 2018-01-26 12:49:24 UTC
Oh, it is needed. See my producer-consumer example above. You can't do that with gap events enabled.

Also, identity does not do the same. It _drops_ buffers with the GAP flag. I do not want to drop any buffer; instead, I want to prevent the GAP flag from ever being added.
Comment 4 Tim-Philipp Müller 2018-01-26 13:09:07 UTC
> Oh, it is needed. See my producer-consumer example above. You can't do that
> with gap events enabled.

Why not? I was saying that the resync problems might be a bug.

 
> Also, identity does not do the same. It _drops_ buffers with the GAP flag. I
> do not want to drop any buffer; instead, I want to prevent the GAP flag from
> ever being added.

Right, that's my bad, I was confused about what it does, sorry :)
Comment 5 Carlos Rafael Giani 2018-01-26 13:29:34 UTC
> Why not? I was saying that the resync problems might be a bug.

Hm, is it? Because this seems like a fundamental design decision in GstBaseSink. Look at https://cgit.freedesktop.org/gstreamer/gstreamer/tree/libs/gst/base/gstbasesink.c#n1964 how it sets do_sync to TRUE.
Comment 6 Tim-Philipp Müller 2018-01-26 13:41:29 UTC
Sorry if I'm missing something fundamental here, which is quite possible.

The link you sent is about GAP events, not buffers with the GAP flag set, no?

This bug report is about the latter, isn't it?

I have a vague memory that we transform GAP events into buffers with the GAP flag set somewhere in audiosink, but I couldn't actually find code for that so I'm probably confusing that with somewhere else.
Comment 7 Carlos Rafael Giani 2018-01-26 13:47:05 UTC
Oh, right, my mistake. I confused the event with the buffer flag. I meant the  latter.

Anyway, here is code in audiobasesink that is affected by this flag:
https://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst-libs/gst/audio/gstaudiobasesink.c#n1870

Note how this forces a resync.
Comment 8 Tim-Philipp Müller 2018-01-26 13:49:30 UTC
Sure, but that was added fairly recently, so can hardly be a fundamental design decision :)
Comment 9 Carlos Rafael Giani 2018-01-26 13:54:06 UTC
This has been part of an extensive GAP flag/event handling rework though. Perhaps Jan can comment too? After all, he wrote it :)
Comment 10 Jan Schmidt 2018-02-27 14:58:28 UTC
I think the reason is that I was testing scenarios where you switch streams and you have no audio for a while - so the demuxer is periodically sending GAP events to trigger preroll, and to catch up the audio chain with the 'current time'. The GAP events aren't continuous though - so you need to resync on the next buffer or risk being slightly out of sync with the video.

Maybe in that case the next buffer should carry a DISCONT flag or something instead and the forced resync isn't essential.

Or, it really fixed a problem and I've forgotten what after 2 years.
Comment 11 Carlos Rafael Giani 2018-02-27 15:05:17 UTC
OK, thanks. My gut feeling is that changing this behavior may subtly break something else and it is easier and safer to add the gap-flag-removal patch instead. What do you think?
Comment 12 Tim-Philipp Müller 2018-02-27 15:13:58 UTC
I think maybe we're mixing up GAP events and buffers with the GAP flag set here?

Raw audio buffers with the GAP flag carry silence data, so elements can choose for optimisation purposes to not process them.
Comment 13 Jan Schmidt 2018-02-27 15:26:07 UTC
(In reply to Tim-Philipp Müller from comment #12)
> I think maybe we're mixing up GAP events and buffers with the GAP flag set
> here?
> 
> Raw audio buffers with the GAP flag carry silence data, so elements can
> choose for optimisation purposes to not process them.

you're correct - the code I was referring to in baseaudiosink deals with converting *buffers with GAP flag* into *GAP events* to process them, and then marks the sink as needing a resync. So it's not about GAP events the sink receives but actually buffers, and I don't remember where they come from.
Comment 14 Carlos Rafael Giani 2018-07-24 13:37:58 UTC
Ping. Since this doesn't really change anything in the interaudio's behavior by default, can we add this?
Comment 15 GStreamer system administrator 2018-11-03 14:16:15 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/638.