Commit graph

514 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
Nicolas Dufresne
e24e902d2f basesink: Only drop buffer if their PTS is out of segment
As of now, even for stream completly inside segment, there is no
guarantied that the DTS will be inside the segment. Specifically
for H.264 with B-Frames, the first few frames often have DTS that
are before the segment.

Instead of using the sync timestamp to clip out of segment buffer,
take the duration from the start/stop provided by the sub-class, and
check if the pts and pts_end is out of segment.

https://bugzilla.gnome.org/show_bug.cgi?id=752791
2015-08-05 15:51:27 -04:00
Song Bing
8e2c72f125 basesink: Shouldn't drop buffer when sync=false
Shouldn't drop buffer when sync=false

https://bugzilla.gnome.org/show_bug.cgi?id=751819
2015-07-06 11:38:48 +03:00
Hyunjun Ko
85aad81647 basesink: need to deep-copy last buffer list in drain
https://bugzilla.gnome.org/show_bug.cgi?id=751420
2015-06-24 10:52:56 +02:00
Sebastian Dröge
37a6e8d6df basesink: Unset the last buffer list if we only got a buffer
Also remember any preroll buffer list.
2015-06-22 14:04:45 +02:00
Hyunjun
7c34b4ed0f basesink: enable to get last sample including buffer list if needed
In case of a buffer list rendering, last-sample is not updated.
It needs to be updated and enable to get buffer list from last-sample.

https://bugzilla.gnome.org/show_bug.cgi?id=751026
2015-06-22 13:28:54 +02:00
Matthew Waters
8bc0a6c562 basesink: use the slightly more correct take_sample for last-sample
gst_value_take_buffer() and gst_value_take_sample() both resolve to
g_value_take_boxed().  Use the method with the correct name if we
ever change that.
2015-05-25 21:05:56 +10:00
Jian
4f79c5e8da basesink: Fix QoS/lateness checking if subclass implements prepare/prepare_list vfuncs
In basesink functions gst_base_sink_chain_unlocked(), below code is used to
checking if buffer is late before doing prepare call to save some effort:
    if (syncable && do_sync)
      late =
          gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
          GST_CLOCK_EARLY, 0, FALSE);

    if (G_UNLIKELY (late))
      goto dropped;

But this code has problem, it should calculate jitter based on current media
clock, rather than just passing 0. I found it will drop all the frames when
rewind in slow speed, such as -2X.

https://bugzilla.gnome.org/show_bug.cgi?id=749258
2015-05-14 11:18:12 +03:00
Tim-Philipp Müller
01e44969df basesink: handle empty buffer list more gracefully
Don't abort, just ignore it. It's like a buffer
without memories.
2015-03-14 21:09:50 +00:00
Thiago Santos
5e15d4aa60 basesink: drain on allocation query
Allows buffers to be reclaimed when caps is to be renegotiated so
that bufferpools can be stopped. As the allocation query is
serialized all buffers have been already drained from the pipeline,
except this last_sample one.

https://bugzilla.gnome.org/show_bug.cgi?id=682770
2015-03-13 19:03:01 +00:00
Thiago Santos
901fea5985 basesink: when draining, deep copy the last buffer to unref old memory
Use gst_buffer_copy_deep() to force the copy of the underlying
memory instead of possibly doing a shallow copy of the buffer
and just referencing the memory

https://bugzilla.gnome.org/show_bug.cgi?id=745287
2015-03-13 18:37:04 +00:00
Wim Taymans
4b174b14f5 basesink: clean up the need_preroll variable
Based on patch from Song Bing <b06498@freescale.com>

Don't just set the need_preroll flag to TRUE in all cases. When we
are already prerolled it needs to be set to FALSE and when we go to
READY we should not touch it. We should only set it to TRUE in other
cases, like what the code above does.

See https://bugzilla.gnome.org/show_bug.cgi?id=736655
2015-03-11 16:40:17 +01:00
Sebastian Dröge
4a5ce862a2 Improve and fix LATENCY query handling
This now follows the design docs everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 17:53:04 +02:00
Edward Hervey
05092eda8e basesink: clamp reported position based on direction
When using a negative rate (rate being segment.rate * segment.applied_rate),
we will end up reporting decreasing positions, therefore adjust the clamping
against last reported value accordingly.

Fixes positions getting properly reported with applied_rate < 0.0

https://bugzilla.gnome.org/show_bug.cgi?id=738092
2014-12-01 10:46:42 +01:00
Sebastian Dröge
154eefecc9 Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.

Also normalize booleans in a few places.
2014-12-01 09:51:37 +01:00
Sebastian Dröge
acc295c93b basesink: Don't bother the subclass with setting the same caps multiple times 2014-11-09 10:42:55 +01:00
Thibault Saunier
56606c5264 basesink: Answer the query position when receiving it from upstream
Currently we are just returning FALSE, but we do have the information
we should just answer the query the same way as when answering through
the GstElement.query vmethod default implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=739580
2014-11-04 11:53:23 +01:00
Tim-Philipp Müller
989e97d1dd basesink: don't unlock mutex that is not locked
Fixes 'Attempt to unlock mutex that was not locked'
warning with newer GLibs when sink is shut down in
certain situations. Triggered by the decodebin
test_reuse_without_decoders unit test in -base
sometimes, esp. on slower machines.
2014-10-24 12:51:07 +01:00
Stefan Sauer
d5518edf12 fixme: bump leftover 0.11 fixme comments 2014-09-25 21:27:03 +02:00
Vincent Penquerc'h
2dc8839234 basesink: reset QoS on segment event
This avoids spurious warnings about slow machine when upstream
sends new segments without flushing.
2014-07-01 16:30:23 +01:00
Evan Nemerson
c38f3254f8 base: add (nullable) annotations to return values
https://bugzilla.gnome.org/show_bug.cgi?id=731542
2014-06-26 18:55:25 +02:00
Evan Nemerson
25af4ad652 base: use correct syntax in documentation more consistently
Previously, many constants were prefixed with # or unprefixed,
some functions and macros were prefixed with # instead of suffixed
with (), etc.

https://bugzilla.gnome.org/show_bug.cgi?id=731293
2014-06-06 15:09:21 -04:00
Nicolas Dufresne
3895e431bd basesink: Always render prepared buffer
Currently, if prepare() takes too much time, we skip the call to render().
The side effect of this, is that we endup starving the render(). The solution
in this patch is to always render frames that are on time before prepare() is
executed. This will maximize the number of frames we display and smoothly
degrade the rendering performance.

https://bugzilla.gnome.org/show_bug.cgi?id=729335
2014-05-02 18:52:44 -04:00
Tim-Philipp Müller
6eb6d9ec38 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 21:21:51 +01:00
Wim Taymans
093574053f basesink: copy last_sample on DRAIN
Make sure we don't hold a ref to a buffer from before the DRAIN query by
making a copy of the last_buffer.
2014-03-24 16:34:27 +01:00
Sebastian Dröge
ba943a82c0 basesink: Update start time when we lose our state
Otherwise we report not the correct position while the state is lost.
2014-03-18 18:11:15 +01:00
Sebastian Dröge
f7b71d3007 basesink: Don't clip the reported position in PAUSED to after the last buffer end timestamp
Otherwise we jump forward when pausing, and go backwards a bit again
when resuming playback.
2014-03-18 16:48:52 +01:00
Sebastian Rasmussen
53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Sebastian Rasmussen
e8ecf3c407 Fix some typos in code comments and debug messages
https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:09:39 +00:00
Jan Schmidt
5db5fc4227 basesink: Add debug into gst_base_sink_default_query() for accept_caps 2013-11-26 02:20:14 +11:00
Tim-Philipp Müller
9f669e5ea5 docs: cosmetic since marker fixes 2013-11-16 16:09:40 +00:00