Commit graph

1845 commits

Author SHA1 Message Date
Jan Schmidt 812d4976f0 fakesink: Add property to not drop out-of-segment buffers
Implement handling in basesink to not unconditionally discard
out-of-segment buffers and expose it as a new property on fakesink
(not unconditionally in all basesink based sinks).

The property defaults to FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=765734
2016-11-02 11:21:37 +11:00
Tim-Philipp Müller 2e278aeb71 baseparse: fix draining with less data than min frame size available
baseparse would pass whatever is left in the adapter to the
subclass when draining, even if it's less than the minimum
frame size required. This is bogus, baseparse should just
discard that data then. The original intention of that code
seems to have been that if we have more data available than
the minimum required we should pass all of the data available
and not just the minimum required, which does make sense, so
we'll continue to do that in the case that more data is available.

Fixes assertions in rawvideoparse on EOS after not-negotiated with
fakesrc sizetype=random ! queue ! rawvideoparse format=rgb ! appsink caps=video/x-raw,format=I420

https://bugzilla.gnome.org/show_bug.cgi?id=773666
2016-11-01 20:33:56 +02:00
Nicolas Dufresne eab0e76268 Revert "collectpads: Assume PTS is equal DTS if PTS is missing"
This reverts commit 9b0d42ceec.

https://bugzilla.gnome.org/show_bug.cgi?id=762207
2016-10-24 11:54:34 -04:00
Jesper Larsen 9ae7f465a5 adapter: Fix mix-up between DTS and PTS
https://bugzilla.gnome.org/show_bug.cgi?id=773319
2016-10-21 16:47:22 +03:00
Sebastian Dröge dc0ed9a5eb basesink: Remove unused fields and always use the buffer timestamp difference for calculating the QoS proportion
The buffer timestamps are only hints and more often than not have
nothing to do with reality.

https://bugzilla.gnome.org/show_bug.cgi?id=771306
2016-09-15 10:56:58 +02:00
Sebastian Dröge c1bd6677c6 basesink: Use the average durations based on timestamps for the QoS proportion when doing trickmodes
The durations of the buffers are (usually) assuming that no frames are being
dropped and are just the durations coming from the stream. However if we do
trickmodes, frames are being dropped regularly especially if only key units
are supposed to be played.

Fixes completely bogus QoS proportion values in the above case.
2016-09-08 15:19:38 +03:00
Thibault Saunier 4714ef2f8e Make use of the new GST_ELEMENT_FLOW_ERROR API all around.
https://bugzilla.gnome.org/show_bug.cgi?id=770158
2016-08-27 09:33:20 -03:00
Nirbheek Chauhan b2f9808722 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-19 21:26:14 +01:00
Aurélien Zanelli ec2723d366 collectpads: add g-i transfer annotations to peek/pop/read_buffer/take_buffer functions
https://bugzilla.gnome.org/show_bug.cgi?id=768948
2016-07-20 12:34:00 +01:00
Sebastian Dröge af0d087bbd basesrc: Fix automatic-eos=false mode if a segment.stop is given
If segment.stop was given, and the subclass provides a size that might be
smaller than segment.stop and also smaller than the actual size, we would
already stop there.

Instead try reading up to segment.stop, the goal is to ignore the (possibly
inaccurate) size the subclass gives and finish until segment.stop or when the
subclass tells us to stop.
2016-07-12 12:34:47 +03:00
Jan Alexander Steffens (heftig) d71e03b3be baseparse: Don't add calculated bitrates until threshold
Waiting before posting calculated bitrates seems to be the
intent of the code, so avoid adding them to the tag list
pushed with the first frame.

When the threshold is reached, gst_base_parse_update_bitrates
sets tags_changed, so this posts the calculated ones right
that moment.

This prevents an insane average calculated from just the
first (key) frame from getting posted.

https://bugzilla.gnome.org/show_bug.cgi?id=768439
2016-07-05 19:42:38 +03:00
Sebastian Dröge 8e8b8a8d34 baseparse: Make sure to not create an invalid event order when generating the default CAPS event because of a GAP event
There must be a SEGMENT event before the GAP event, and SEGMENT events must
come after any CAPS event. We however did not produce any CAPS yet, so we need
to ensure to insert the CAPS event before the SEGMENT event into the pending
events list.

https://bugzilla.gnome.org/show_bug.cgi?id=766970
2016-07-04 10:35:41 +02:00
Sebastian Dröge b9a4a2a952 basesink: Update start time when losing state only if we were in PLAYING
If we were in PAUSED, the current clock time and base time don't have much to
do with the running time anymore as the clock might have advanced while we
were PAUSED. The system clock does that for example, audio clocks often don't.

Updating the start time in PAUSED will cause a) the wrong position to be
reported, b) step events to step not just the requested amount but the amount
of time we spent in PAUSED. The start time should only ever be updated when
going from PLAYING to PAUSED to remember the current running time (to be able
to compensate later when going to PLAYING for the clock time advancing while
PAUSED), not when we are already in PAUSED.

Based on a patch by Kishore Arepalli <kishore.arepalli@gmail.com>

The updating of the start time when the state is lost was added in commit
ba943a82c0 to fix the position reporting when
the state is lost. This still works correctly after this change.

https://bugzilla.gnome.org/show_bug.cgi?id=739289
2016-06-13 20:20:44 +02:00
Sebastian Dröge 8c7da1d426 adapter: Rename functions and implement new functions, update test
We don't do calculations with different units (buffer offsets and bytes)
anymore but have functions for:
1) getting the number of bytes since the last discont
2) getting the offset (and pts/dts) at the last discont

and the previously added function to get the last offset and its distance from
the current adapter position.

https://bugzilla.gnome.org/show_bug.cgi?id=766647
2016-06-10 09:49:33 +03:00
Edward Hervey 67ae0ad225 adapter: Add methods to query current offset
API: gst_buffer_prev_offset
API: gst_buffer_get_offset_from_discont

The gst_buffer_get_offset_from_discont() method allows retrieving the current
offset based on the GST_BUFFER_OFFSET of the buffers that were pushed in.

The offset will be set initially by the GST_BUFFER_OFFSET of
DISCONT buffers, and then incremented by the sizes of the following
buffers.

The gst_buffer_prev_offset() method allows retrievent the previous
GST_BUFFER_OFFSET regardless of flags. It works in the same way as
the other gst_buffer_prev_*() methods.

https://bugzilla.gnome.org/show_bug.cgi?id=766647
2016-06-10 09:49:33 +03:00
Edward Hervey ea395c2498 baseparse: Make sure DISCONT flags are properly propagated
If we drop a frame that contained a discontinuity, we must remember
that for the next frame that *will* be pushed downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=766795
2016-06-07 09:42:39 +02:00
Tim-Philipp Müller 0274650e42 g-i: pass compiler env to g-ir-scanner
It's what introspection.mak does as well. Should
fix spurious build failures on gnome-continuous.
2016-05-24 00:40:27 +01:00
Sebastian Dröge d184e7a9a0 basesink/src: Post an error message if ::start() fails
The subclass should do that already, but just in case do it ourselves too as a
fallback. Without this, e.g. playbin will just wait forever if this fails
because it is triggered as part of an ASYNC state change.
2016-05-15 11:04:25 +03:00
Tim-Philipp Müller 246b285783 flowcombiner: add debug category
Not that it logs much.
2016-05-05 18:50:05 +01:00
Tim-Philipp Müller 5ebfe26a51 flowcombiner: fix docs for gst_flow_combiner_reset() 2016-05-05 18:02:21 +01:00
Sebastian Dröge 5294065985 baseparse: Remember if we interpolated DTS from PTS and refresh it whenever we update the PTS
Otherwise PTS and DTS will come out of sync if upstream continues to provide
PTS and not DTS, and we have to skip some data from the stream or PTS are not
exactly increasing with the duration of each packet.

https://bugzilla.gnome.org/show_bug.cgi?id=765260
2016-04-20 11:49:24 +03:00
Sebastian Dröge c434b6486d typefindhelper: Fix gobject-introspection warning about invalid transfer annotation
gsttypefindhelper.c:485: Warning: GstBase: invalid "transfer" annotation for gsize: only valid for array, struct, union, boxed, object and interface types
2016-04-20 11:45:28 +03:00
Sebastian Dröge 895332e056 baseparse: When initializing DTS from PTS, remember that we did so
If we don't store the value in prev_dts, we would over and over again
initialize the DTS from the last known upstream PTS. If upstream only provides
PTS every now and then, then this causes DTS to be rather static.

For example in adaptive streaming scenarios this means that all buffers in a
fragment will have exactly the same DTS while the PTS is properly updated. As
our queues are now preferring to do buffer fill level calculations on DTS,
this is causing huge problems there.

See https://bugzilla.gnome.org/show_bug.cgi?id=691481#c27 where this part of
the code was introduced.

https://bugzilla.gnome.org/show_bug.cgi?id=765096
2016-04-15 16:02:29 +03:00
Sebastian Dröge 00e4499b15 Revert "basesink: Take PREROLL_LOCK in wait_event()"
This reverts commit 828a4627db.

The lock was already taken elsewhere, in gst_base_sink_event().
2016-04-12 15:17:36 +03:00
Sebastian Dröge 828a4627db basesink: Take PREROLL_LOCK in wait_event()
It is calling do_sync(), which requires the STREAM_LOCK and PREROLL_LOCK to be
taken. The STREAM_LOCK is already taken in all callers, the PREROLL_LOCK not.

https://bugzilla.gnome.org/show_bug.cgi?id=764939
2016-04-12 15:11:30 +03:00
Vineeth TM 8cc3e908c3 gstreamer: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763020
2016-03-24 14:43:41 +02:00
Nicolas Dufresne 9b0d42ceec collectpads: Assume PTS is equal DTS if PTS is missing
This is the best guess we can make if such a buffer reached the collect
pad. This is uncommon, we do expect parsers to have tried and fixed that
if possible (or needed).

https://bugzilla.gnome.org/show_bug.cgi?id=762207
2016-03-24 14:29:47 +02:00
Sebastian Dröge 87c0513569 baseparse: Recheck after pre_push_frame() if there are tags pending
Many parsers are storing tags only in pre_push_frame(), if we wouldn't check
afterwards we would push buffers before those tags and a lot of code assumes that
tags are available before preroll.

https://bugzilla.gnome.org/show_bug.cgi?id=763553
2016-03-14 12:23:29 +02:00
Evan Nemerson d11e657412 docs: annotate C examples as such
https://bugzilla.gnome.org/show_bug.cgi?id=731292
2016-02-15 17:45:15 +00:00
Martin Kelly 86a46ee43b pushsrc: fix minor typos in header
https://bugzilla.gnome.org/show_bug.cgi?id=761970
2016-02-12 20:50:57 +00:00
Tim-Philipp Müller 78a832ebd5 baseparse: fix stray discont flag set on outgoing buffers in push mode
We have no guarantees about what flags are set on buffers we take
out of the GstAdapter. If we push out multiple buffers from the
first input buffer (which will have discont set), only the first
buffer we push out should be flagged as discont, not all of the
buffers produced from that first initial input buffer.

Fixes issue where the first few mp3 frames/seconds of data in push
mode were skipped or garbled in some cases, and the discont flags
would also trip up decoders which were getting drained/flushed for
every buffer. This was a regression introduced in 1.6 apparently.
2016-02-04 19:04:41 +00:00
HoonHee Lee f90fd86d5f baseparse: Try to generate caps on the srcpad before forwarding GAP event
To configure downstream elements and complete initial pre-rolling,
ensure we have default output caps before forwarding GAP event.

https://bugzilla.gnome.org/show_bug.cgi?id=753899
2016-01-29 10:49:24 +01:00
Carlos Rafael Giani 91496281eb basesrc: Only set duration/position query values in case of query success
Currently, the query values are being set even if the query itself was
determined to have failed. Fix this to ensure the values are only set in
case of a query success.

https://bugzilla.gnome.org/show_bug.cgi?id=760479
2016-01-11 21:42:10 +01:00
Xavier Claessens 46f83f5fcd core: Add g_autoptr() support to all types
https://bugzilla.gnome.org/show_bug.cgi?id=754464
2015-12-14 12:06:55 -05:00
Athanasios Oikonomou d10c488d63 baseparse: post tag list when avg bitrate changes at least 2%
Watching videos with variant bitrate is common to have delta
more than 10 kbps, resulting in tag list spam.

Instead of relying on fixed 10 kpbs delta, it is better to
calculale the difference in percentage and update tag list
only when bitrate changes more than 2%.

https://bugzilla.gnome.org/show_bug.cgi?id=759055
2015-12-08 11:34:13 +02:00
Reynaldo H. Verdejo Pinochet 63a9130f56 Drop usage of deprecated g-ir-scanner --strip-prefix flag 2015-12-02 15:02:25 -08:00
Thiago Santos b93369c78a Revert "baseparse: do not overwrite header buffer timestamps"
This reverts commit 2c475a0355.

This causes issues with h264parse. It breaks timestamps as
there are headers in the middle of the stream and this patch
makes the timestamps for those differ from the ones that
are adjusted, creating a discontinuity and leading to sync
issues.
2015-11-19 00:57:17 -03:00
Thiago Santos 5feba38a4e Revert "baseparse: simplify code a bit"
This reverts commit 3984f7159a.
2015-11-19 00:57:08 -03:00
Thiago Santos 3984f7159a baseparse: simplify code a bit
Avoid repeated checks for testing if a buffer is a header
2015-11-16 08:22:14 -03:00
Thiago Santos 42d45a0f40 collectpads: handle buffer with dts-only when mapping to running time
Otherwise the buffer was left with the original values and later would
be compared with other buffers that were converted to runninn time,
leading to bad interleaving of multiple streams.

https://bugzilla.gnome.org/show_bug.cgi?id=757961
2015-11-14 10:50:35 -03:00
Thiago Santos 971ac61c36 baseparse: do not overwrite header buffer timestamps
baseparse tries to preserve timestamps from upstream if
it is running on a time segment and write that to
output buffers. It assumes the first DTS is going to be
segment.start and sets that to the first buffers. In case
the buffer is a header buffer, it had no timestamps and
will have only the DTS set due to this mechanism.

This patch prevents this by skipping this behavior for
header buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=757961
2015-11-14 10:50:35 -03:00
Tim-Philipp Müller 220dbfc13c docs: remove dummy function declarations with G_INLINE_FUNCTION for gtk-doc
gtk-doc can handle static inline functions just fine these days,
there's no need for this stuff any more.
2015-11-09 17:59:16 +00:00
Edward Hervey 16458daddb collectpads: Use GST_BUFFER_DTS_OR_PTS
Simplifies code a bit
2015-10-27 08:33:41 +01:00
Guillaume Desmottes 66b6d355e4 basesink: rename argument of PREROLL_{COND,LOCK} macros
They take a GstBaseSink instance as argument at not a GstPad. Rename the
argument to 'obj' which is not miss leading and in line with
GST_BASE_SINK_PAD(obj).

https://bugzilla.gnome.org/show_bug.cgi?id=756954
2015-10-22 13:49:06 +01:00
Sebastian Dröge 1efb451154 Use new GST_ENABLE_EXTRA_CHECKS #define
https://bugzilla.gnome.org/show_bug.cgi?id=756870
2015-10-21 14:31:56 +03:00
Edward Hervey 55f6582159 baseparse: Update internal position even if not linked
Our current position has nothing to do with being linked or not.

Avoids having stray segment updates fired every 2s
2015-10-12 17:30:38 +02:00
Stefan Sauer 05dbad27c5 index: mark two structs that don't have abi padding 2015-09-28 16:23:41 +02:00
Vivia Nikolaidou 44ba1565d9 segment: Replaced gst_segment_to_position with gst_segment_position_from_running_time
gst_segment_to_position might cause confusion, especially with the addition of
gst_segment_position_from_stream_time . Deprecated gst_segment_to_position
now, and replaced it with gst_segment_position_from_running_time.

Also added unit tests.
2015-09-26 00:00:08 +02:00
Sebastian Dröge 73263271bb basetransform: Print buffer PTS when submitting an input buffer 2015-09-23 20:31:48 +02:00
Nicolas Dufresne 2534e39e55 basetransform: Reconfigure before propose_allocation
There exist cases where a reconfigure event was propagated from
downstream, but caps didn't change. In this case, we would
reconfigure only when the next buffer arrives. The problem is that
due to the allocation query being cached, the return query parameters
endup outdated.

In this patch we refactor the reconfigurating code into a function, and
along with reconfiguring when a new buffer comes in, we also reconfigure
when a query allocation arrives.

https://bugzilla.gnome.org/show_bug.cgi?id=753850
2015-08-21 15:14:34 -07:00