Commit graph

1882 commits

Author SHA1 Message Date
Tim-Philipp Müller d8079ae1fe baseparse: fix taglist update spam
We would constantly re-post the taglist because
posted_avg_rate only gets set to avg_bitrate if
parse->priv->post_avg_bitrate is true, so if it's
false the posted rate will always differ from the
current average rate and we'd queue an update,
which leads to us spamming downstream and the
application with taglist updates.

Fix this by only queuing an update if the average
rate will actually be posted.

These taglists updates could cause expensive
operations on the application side, e.g. in Totem.

https://bugzilla.gnome.org/show_bug.cgi?id=786561
2017-09-01 12:14:09 +03:00
Jason Lin d7c47d1562 basesink: fix buffer leaks if preroll failed
buffer is not unreferened if preroll failed

:Detailed Notes:
- Problem : video freeze when switching from pause to 1/2-FF repeatedly
- RootCause : buffer leaks in basesink
- Solution : unref the buffer if prerolled failed

:Testing Preformed:
How to Test :
pause -> 1/2 FF -> resume -> pause -> 1/2 FF ...

https://bugzilla.gnome.org/show_bug.cgi?id=784932
2017-07-14 16:54:09 +10:00
Nicolas Dufresne 486dd447e6 baseparse: sinkcaps can be NULL in default caps negotiation
This was causing harmless assertion about the unreffed caps not being of
type caps.

https://bugzilla.gnome.org/show_bug.cgi?id=784041
2017-07-03 20:47:39 +01:00
Sebastian Dröge 226d01a941 base: Export boxed type copy/free functions for the remaining types 2017-06-20 10:08:38 +03:00
Olivier Crête 2325d00eee basesrc: Hold object lock while updating latency
Otherwise in gst_base_src_query_latency(), it ended up
sometimes thinking it wasn't -1 when it was actually.
2017-05-29 10:55:31 +03:00
Sebastian Dröge 733de3190b adapter: Check if meta transform_func is NULL before using it
https://bugzilla.gnome.org/show_bug.cgi?id=782050
2017-05-02 14:27:14 +03:00
Frédéric Dalleau ca7fa6a661 basetransform: Check if meta transform_func is NULL before using it
An untested pointer segfaulted in webkit while playing video
on imx6 sabrelite. It turned out that the imx plugin didn't
implement the meta transform function.

The following GST_DEBUG trace was visible:
gstbasetransform.c:1779:foreach_metadata:<conv2> copy metadata
                                                GstImxVpuBufferMetaAPI

Thread 26 vqueue:src received signal SIGSEGV, Segmentation fault.

(gdb) bt
 0x00000000 in ?? ()
 0x73f8d7d8 in foreach_metadata (inbuf=0xc9b020, meta=0x474b2490,
                  user_data=<optimized out>) at gstbasetransform.c:1781
 0x73eb3ea8 in gst_buffer_foreach_meta (buffer=buffer@entry=0xc9b020,
                  func=0x73f8d705 <foreach_metadata>,
                  user_data=user_data@entry=0x474b24d4)
                  at gstbuffer.c:2234

https://bugzilla.gnome.org/show_bug.cgi?id=782050
2017-05-02 14:26:21 +03:00
Yasushi SHOJI c423df49af basetransform: fix typo in debug log output
This unbalanced closing parenthesis is leftover from the commit
8b739d91e7. It used to wrap the caps but we don't seem to do that in
the current code.

So, just remove it. No functionality has been changed.

https://bugzilla.gnome.org/show_bug.cgi?id=781484
2017-04-19 09:21:32 +01:00
Rico Tzschichholz 72e42f0ce9 meson: A couple for GIR-generation fixes 2017-04-13 10:05:53 +01:00
Tim-Philipp Müller 519d64881f Don't use deprecated g_object_newv()
Use g_object_new() instead which nowadays has a shortcut for the
no-properties check. It still does an extra GType check in the
function guard, but there's a pending patch to remove that
and it's hardly going to be a performance issue in practice,
even less so on a system that's compiled without run-time checks.

Alternative would be to move to the new g_object_new_properties()
with a fallback define for older glib versions, but it makes the
code look more unwieldy and doesn't seem worth it.

Fixes deprecation warnings when building against newer GLib versions.

https://bugzilla.gnome.org/show_bug.cgi?id=780903
2017-04-08 09:49:59 +01:00
Sebastian Dröge 50ec7129bb queuearray: Add G_BEGIN_DECLS and G_END_DECLS to make it usable from C++ code 2017-03-24 14:21:55 +02:00
Jan Schmidt e571002dcb baseparse: Don't forget error returns when processing more
If parsing returns a non-OK flow return in the middle
of processing an input buffer, don't overwrite that
if a later return is OK again - the subclass might
return not-linked in the middle, and then discard
subsequent data without pushing while returning OK.

A later success doesn't invalidate the earlier failure,
but we should continue processing after not-linked, so
as to keep parse state consistent.

https://bugzilla.gnome.org/show_bug.cgi?id=779831
2017-03-22 11:42:53 +11:00
Tim-Philipp Müller 834fd18dfa bytereader: fix peek value when scanning for 00 00 01 with non-0 offset
We would add the offset a second time in _scan_for_start_code()
when we found a result, but it's already been added to the data
pointer at the beginning of _masked_scan_uint32_peek(), so the
peeked value would be wrong if the initial offset was >0, and
we would potentially read memory out-of-bounds.

Add unit test for all of this.

https://bugzilla.gnome.org/show_bug.cgi?id=778365
2017-02-22 11:07:24 +00:00
Stefan Sauer c189827619 gstbasesink: xref symbol in docs 2017-02-15 21:37:31 +01:00
Thibault Saunier a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Julien Isorce b2c05cac8e baseparse: correctly handle non-flush seek
Otherwise when seeking/looping to the start when reaching the end,
the sink waits for the duration of the stream. So the user hears
nothing for the duration of the stream before it actually loop again.
See example attached to the bug for that.

Existing test:
gst-plugins-good/tests/icles/test-segment-seeks foo.flac
Without the patch the user hears a crack/cut at each seek.

https://bugzilla.gnome.org/show_bug.cgi?id=777780
2017-01-26 16:51:21 +00:00
Mark Nauwelaerts 9bcebaacc7 baseparse: also unset DISCONT on buffers in reverse playback fragments 2016-12-28 13:46:33 +01:00
Fabrice Bellet de65529d52 basesink: fix a use after free case
The event may be disposed while being pushed, so we make sure the
debug infrastructure won't use it after the gst_pad_push().
2016-12-17 09:40:25 +05:30
Olivier Crête e6febb5bc1 basesink: Document the interaction between unlock() and wait_preroll()
This was totally non-obvious, the kind of big problem is that subclasses must
be able to unblock their streaming thread and continue exactly where they left off
on unpause!

https://bugzilla.gnome.org/show_bug.cgi?id=773912
2016-11-23 11:58:43 -05:00
Sebastian Dröge f08c8d2da3 basetransform: Ensure to set the RECONFIGURE flag again if reconfiguration failed
It might've failed just because of flushing or other things, and we
should retry again on the next possibility if something ever calls in
here again.

https://bugzilla.gnome.org/show_bug.cgi?id=774623
2016-11-18 12:04:18 +02:00
Jan Schmidt 2e579a7c1b baseparse: Fix previous commit
Check the correct segment format value.

parse->segment.format is the format we're outputting in,
not the upstream format. Use parse->priv->upstream_format instead,
and make sure it's set in pull mode.
2016-11-16 00:30:26 +11:00
Jan Schmidt d81c0aec81 baseparse: Restrict query/convert responses when demuxing
If the parser is not parsing a raw elementary stream, restrict
the position, duration and conversion query replies to
things we can sensibly answer about - especially don't do
random conversions to/from bytes.
2016-11-16 00:12:22 +11:00
Scott D Phillips 1e30725331 typefindhelper: Update prototype of helper_find_suggest()
forward declaration prototype is updated to match the change in:

 5a72c23 Change some types to match their prototypes

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-15 14:29:36 +02:00
Scott D Phillips 5a72c23a54 Change some types to match their prototypes
Particularly note that the underlying integer type of the enum
GstTypeFindProbability is implementation dependent and may not match
guint.

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-14 21:03:57 +02:00
Nicolas Huet 9cd2677791 adapter: fix distance when getting prev pts/dts at offset
https://bugzilla.gnome.org/show_bug.cgi?id=765662
2016-11-11 18:18:23 +00:00
Guillaume Desmottes fcb938caae basetransform: fix pool leak when early returning in decide_allocation
https://bugzilla.gnome.org/show_bug.cgi?id=769023
2016-11-11 13:29:35 +00:00
Seungha Yang 562681a1b7 basesrc: Support PROTECTION event from application
Application may want to send PROTECTION event to the src element.

https://bugzilla.gnome.org/show_bug.cgi?id=769775
2016-11-11 13:07:51 +00:00
Nirbheek Chauhan accd0b4129 meson: Add GstBase-1.0.gir to gst_base_dep
Without this, GIR generators can't find and use it
2016-11-11 04:41:39 +05:30
Tim-Philipp Müller bce5d0fc55 baseparse: add since marker for new API to docs and fix win32 .def file 2016-11-10 13:49:29 +00:00
Vincent Penquerc'h 4caf66fbca baseparse: expose gst_base_parse_drain 2016-11-10 12:47:37 +00:00
Thibault Saunier 0079aea21c meson: Advertise dependency on gst_dep generating girs
And do not simply link to libgst as the gir information
location only exist in declare_dependecy

https://bugzilla.gnome.org/show_bug.cgi?id=774044
2016-11-09 17:00:49 -03:00
Nicolas Dufresne 7c8087f49a basesink: Make sure we never drop the preroll buffer
This is cosmetic as 'late' should never be set during preroll (in pause).
Though code may evolve in the future, so this is good for preventing
potential bugs.

https://bugzilla.gnome.org/show_bug.cgi?id=772468
2016-11-03 15:26:06 -04:00
Nicolas Dufresne 5ca63b7f04 basesink: Don't nest prepare/render calls
When the first buffer arrives, we endup calling:

  ->prepare()
    ->prepare()
    ->preroll()
  ->render()

This will likely confuse any element using this method. With this patch,
we ensure the preroll take place before the first render prepare() is
called. This will result in:

  ->prepare()
  ->preroll()
  ->prepare()
  ->render()

https://bugzilla.gnome.org/show_bug.cgi?id=772468
2016-11-03 13:19:46 -04:00
Luis de Bethencourt c53b2e3740 basesink: fix typo in documentation
Small typo in the documentatin of gst_base_sink_set_drop_out_of_segment().
Fixing it.
2016-11-02 16:28:08 +00:00
Sebastian Dröge c6a5798c74 basesink: Fix gst_base_sink_set_drop_out_of_segment() documentation
Also silences a GI warning.
2016-11-02 16:35:59 +02:00
Sebastian Dröge 9ea6af280d Revert "baseparse: fix draining with less data than min frame size available"
This reverts commit 2e278aeb71.

Some parsers, specifically audio parsers, assume to get all remaining
data on EOS and just pass them onwards. While the idea here is correct,
we will probably need a property for this on baseparse for parsers to
opt-in.

https://bugzilla.gnome.org/show_bug.cgi?id=773666
2016-11-02 09:35:05 +02:00
Jan Schmidt bf3a7c54f7 Add new basesink API to exports and Since markers
Add Since markers to the new basesink API to drop
out-of-segment buffers, and add them to the
win32 exports
2016-11-02 11:34:47 +11:00
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