Commit graph

2626 commits

Author SHA1 Message Date
Stian Selnes
ff9a78196c harness: Fix race for gst_harness_element_ref
In order for gst_harness_new_full to be MT-safe the increase and
decrease of HARNESS_REF must be MT-safe. This allows for creating
multiple harnesses from different threads wrapping the same element.

https://bugzilla.gnome.org/show_bug.cgi?id=754661
2015-09-07 11:31:33 +01:00
Stian Selnes
615e5b01c6 harness: Allow-none for custom stress init func
It should be allowed to not have a function to initialize the user data
since it's often not necessary; it may already be initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=754661
2015-09-07 11:30:37 +01:00
Havard Graff
b2ce23074e harness: misc bugfixes
1. Get a list of pad templates from the element class, not the
factory. This allows us to interact with test-elements that does
not have a factory.

2. Use the pad_template_caps in caps-queries when caps is not set
explicitly on the pad. Not doing so is simply wrong, and prohibits
interactions with special templates used for testing.

https://bugzilla.gnome.org/show_bug.cgi?id=754193
2015-08-31 12:03:09 +01: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
Tim-Philipp Müller
a887d81bfa baseparse: avoid tag list spam if upstream provides bitrate tags already
Explicitly keep track again whether upstream tags or parser tags
already contain bitrate information, and only force a tag update
for a bitrate if we are actually going to add the bitrate to the
taglist later. This fixes constant re-sending of the same taglist,
because upstream provided a bitrate already and we didn't add it,
so we didn't save the 'posted' bitrate, which would then in turn
again trigger the 'bitrate has changed too much, update tags'
code path. Fixes tag spam with m4a files for example.

https://bugzilla.gnome.org/show_bug.cgi?id=679768
2015-08-18 15:51:53 +01:00
Tim-Philipp Müller
4ec358773a baseparse: fix tag handling
In 0.10 there were no sticky events, and all tag events
sent would just be merged with the previously-received
tags. In 1.x we have sticky events, and the tags in the
tag event(s) should at all times carry the complete tags,
so we can't just push some tags and then just push tags
with just bitrates to update the bitrates, etc.

Instead we need to keep track of the upstream stream tags
received, of the tags set by the video decoder subclass,
and send an updated tag event with the combined tags
including our own bitrate tags (if applicable) whenever
the upstream tags, the subclass tags or any of our bitrates
change.

https://bugzilla.gnome.org/show_bug.cgi?id=679768
2015-08-16 14:32:24 +01:00
Tim-Philipp Müller
41b85d91eb baseparse: add API for subclass to set tags
This is needed so that we can do proper tag handling
all around, and combine the upstream tags with the
tags set by the subclass and any extra tags the
base class may want to add.

API: gst_base_parse_merge_tags()

https://bugzilla.gnome.org/show_bug.cgi?id=679768
2015-08-16 14:32:23 +01:00
Tim-Philipp Müller
d60c249f51 baseparse: save upstream stream tags
We'll need those later.

https://bugzilla.gnome.org/show_bug.cgi?id=679768
2015-08-16 12:29:10 +01:00
Tim-Philipp Müller
bc1fb2d8b0 baseparse: minor code simplification
Use gst_pad_peer_query_duration() and remove a few
unnecessary levels of indentation. Rest of code might
looks a bit questionable, but leave it as is for now.
2015-08-15 18:41:31 +01:00
Thiago Santos
e0cc0e0888 basetransform: rework accept-caps
According to the design docs:
The ACCEPT_CAPS query is not required to work recursively, it can simply
return TRUE if a subsequent CAPS event with those caps would return
success.

So make it a shallow check instead of recursivelly check downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=748635
2015-08-13 14:07:35 -03:00
Thiago Santos
42acf05b22 basetransform: remove some dead code
Doesn't seem like it is going to get back to life anytime soon

Also removes a {} block that was likely used to keep the dead
code around.
2015-08-13 12:45:35 -03:00
Thiago Santos
7ec54c2217 basetransform: respect accept-caps intersect flag
GstPad has a flag for suggesting if the accept-caps
query should use intersect instead of the default
subset caps operation to verify if the caps would be
acceptable.

basetransform currently always uses the subset check and
this patch makes it honor the flag for using intersect
if it is set.

https://bugzilla.gnome.org/show_bug.cgi?id=748635
2015-08-13 06:01:36 -03:00
Vineeth TM
039ac81ee3 basetransform: remove unreachable return statement
https://bugzilla.gnome.org/show_bug.cgi?id=753538
2015-08-12 10:34:59 +01:00
Havard Graff
28100e0b6a harness: add _set_forwarding function
To be able to disable the slightly "magic" forwarding of the
necessary events between the harnesses.

Also introduce a new test-suite for GstHarness, that documents the
feature, and should hopefully expand into documenting most of the
features the harness possesses.

https://bugzilla.gnome.org/show_bug.cgi?id=752746
2015-08-09 16:02:37 +01: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
Luis de Bethencourt
60de1f26c7 harness: don't run code inside g_assert
Even though asserts can't be disabled in GstHarness, Coverity still
complains about running code inside them. Moving the code to outside the
g_asserts().

CID #1311326, #1311327, #1311328
2015-08-05 14:05:27 +01:00
Nicolas Dufresne
d47b567f2f doc/gsthardness: Fix typo in GstAllocationParams
It's not GstAllocatorParams but GstAllocationParams.
2015-07-28 15:50:40 -04:00
Nicolas Dufresne
67e53e4adc doc/gstharness: Remove unknown parameter
sink_elenment_name is not a parameter of gst_harness_add_sink_harness()
function, but still it show up in documentation.
2015-07-28 15:46:09 -04:00
Olivier Crête
5e5a14028a basetransform: Return FLOW_FLUSHING if negotiation fails during shutdown
https://bugzilla.gnome.org/show_bug.cgi?id=752800
2015-07-27 13:53:26 -04:00
Olivier Crête
815b5f69e8 harness: Fix indendation 2015-07-22 18:55:29 -04:00
Nicolas Dufresne
f9aa306747 basetransform: Avoid increasing query reference
gst_query_find_allocation_meta() requires the query to be
writable to work. This patch ensure avoids taking a reference
on the query, so we can now check if a certain allocation meta
is present.

https://bugzilla.gnome.org/show_bug.cgi?id=752661
2015-07-22 13:29:35 -04:00
Havard Graff
c97f82e32b harness: add functions for adding sub-harnesses directly
By introducing gst_harness_add_src_harness and gst_harness_add_sink_harness
we collect all sub-harness setup in one function, making the previous
sub-harness creation functions now calls these directly, and making it
much easier (and less error-prone) to add your own src or sink-harness
using the more generic harness-creation functions.
2015-07-20 15:30:11 +01:00
Nicolas Dufresne
5b5cebf540 baseparse: Don't override gst_segment_do_seek()
This line has no purpose, clearly gst_segment_do_seek() is doing
the right job, also, having the start time (a timestamp) be that
same as time (the stream time) is quite odd.

https://bugzilla.gnome.org/show_bug.cgi?id=750783
2015-07-17 17:44:52 -04:00
Nicolas Dufresne
8b6e8701d5 baseparse: Fix extrapolation of seeksegment.stop
The stop shall be relative to start if extrapolated from the
duration.

https://bugzilla.gnome.org/show_bug.cgi?id=750783
2015-07-17 17:44:44 -04:00
Tim-Philipp Müller
997115e462 harness: fix indentation 2015-07-16 17:50:49 +01:00
Tim-Philipp Müller
36267ca0e2 harness: fix pad template leak 2015-07-16 17:50:06 +01:00
Havard Graff
0841b2a97e harness: don't re-establish the harness sink and src pads
Given that the element has the possibility to have one, they should
already be there.

https://bugzilla.gnome.org/show_bug.cgi?id=752498
2015-07-16 17:09:27 +01:00
Stian Selnes
8597284d0b harness: Improve detection of element type
The element flag does not indicate wether a bin should be tested as a
source or as a sink, eg. a bin with the sink flag may still have a
source pad and a bin with the source flag may have a sink pad. In this
case it is better to determine the element type by looking at the
available pads and pad templates.

Also rename srcpad and sinkpad where it actually represents
element_srcpad_name and element_sinkpad_name.

https://bugzilla.gnome.org/show_bug.cgi?id=752493
2015-07-16 16:23:20 +01:00
Stian Selnes
fe6f694dbb harness: Forward sticky events to sink harness
Fixes issue where if a sink harness was added late the sticky events
would not be forwared.

https://bugzilla.gnome.org/show_bug.cgi?id=752494
2015-07-16 16:18:08 +01:00
Tim-Philipp Müller
e066058fac harness: make header nicer to read 2015-07-16 12:41:51 +01:00
Vineeth TM
6d78d32d51 baseparse: estimate duration on EOS
For files which are smaller than 1.5 seconds, the duration
estimation does not happen. So the duration will always be
displayed as 0. Updating the duration on EOS when the estimation
has not happened already

https://bugzilla.gnome.org/show_bug.cgi?id=750131
2015-07-10 15:23:43 -04:00
Hyunjun Ko
427400be1d adapter: change log message properly
https://bugzilla.gnome.org/show_bug.cgi?id=752116
2015-07-10 10:46:38 +03:00
Hyunjun Ko
af62e2874f adapter: fix to get valid (buffer_)list
get_list/get_buffer_list should be done with buffers in adapter remaining
while take_list/take_buffer_list flushes each buffer one by one.

https://bugzilla.gnome.org/show_bug.cgi?id=752116
2015-07-08 18:59:31 +03:00
Arnaud Vrac
ea8cabe084 baseparse: put buffer in a correct state after gst_adapter_get_buffer call
We must make the buffer writable to write its PTS and DTS, and also
reset its duration.

The behaviour is now the same as before commit c3bcbadd, except metas
might still be attached to the buffer extracted from the adapter.

https://bugzilla.gnome.org/show_bug.cgi?id=752092
2015-07-08 13:33:37 +03:00
Tim-Philipp Müller
0728b219b9 harness: fix indentation and replace stress test function macros
These screw with indentation and seem a bit trivial. Just copy'n'paste.
2015-07-07 15:02:45 +01:00
Hyunjun Ko
eaf4153668 meta: transform_func: return FALSE if not supported or failed
https://bugzilla.gnome.org/show_bug.cgi?id=751778
2015-07-07 13:40:17 +03:00
Tim-Philipp Müller
b5cc88594e harness: make sure g_assert() statements are always active
We have code with side effects inside g_assert()s, so make
sure those are always enabled here (they might otherwise
get disabled for release builds).
2015-07-07 08:38:31 +01:00
Tim-Philipp Müller
ac79c7f05a harness: rename GstHarnessPrepareBuffer -> GstHarnessPrepareBufferFunc
https://bugzilla.gnome.org/show_bug.cgi?id=751916
2015-07-07 00:58:15 +01:00
Tim-Philipp Müller
49c896db3a docs: add GstHarness to documentation
https://bugzilla.gnome.org/show_bug.cgi?id=751916
2015-07-07 00:53:48 +01:00
Havard Graff
66e25da313 check: Add GstHarness convenience API for unit tests
http://gstconf.ubicast.tv/videos/gstharness-again-a-follow-up/

https://bugzilla.gnome.org/show_bug.cgi?id=751916
2015-07-06 23:36:37 +01:00
Vineeth TM
274f4b784a baseparse: reverse playback in pull mode
right now reverse playback is disabled in pull mode.
enabling the code for the same and changing a bit of logic
to make reverse playback work.

https://bugzilla.gnome.org/show_bug.cgi?id=750783
2015-07-06 09:56: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
Tim-Philipp Müller
d0f85838ab queuearray: allow storing of structs in addition to pointers
This way we don't have to allocate/free temporary structs
for storing things in the queue array.

API: gst_queue_array_new_for_struct()
API: gst_queue_array_push_tail_struct()
API: gst_queue_array_peek_head_struct()
API: gst_queue_array_pop_head_struct()
API: gst_queue_array_drop_struct()

https://bugzilla.gnome.org/show_bug.cgi?id=750149
2015-07-04 11:03:51 +01:00
Sebastian Dröge
231e77338c transform: Also copy POOL metas and make sure to copy over metas when creating subbuffers
POOL meta just means that this specific instance of the meta is related to a
pool, a copy should be made when reasonable and the flag should just not be
set in the copy.
2015-07-01 10:50:19 +02:00
Sebastian Dröge
fefd4622a3 adapter: Also copy POOL metas and make sure to copy over metas when creating subbuffers
POOL meta just means that this specific instance of the meta is related to a
pool, a copy should be made when reasonable and the flag should just not be
set in the copy.
2015-07-01 10:45:01 +02:00
Sebastian Dröge
c3bcbadd54 baseparse: Use new gst_adapter_get_buffer() API instead of gst_adapter_map()
This preserves GstMeta properly unless the subclass does special things. It's
enough to make h264parse's stream-format/alignment conversion pass through
metas as needed.

https://bugzilla.gnome.org/show_bug.cgi?id=742385
2015-06-30 18:40:28 +02:00
Sebastian Dröge
866f9ace5c adapter: Add get variants of the buffer based take functions
Main difference to gst_adapter_map() for all practical purposes is that
GstMeta of the buffers will be preserved.

https://bugzilla.gnome.org/show_bug.cgi?id=742385
2015-06-30 18:40:28 +02:00
Sebastian Dröge
e6757269db adapter: Copy over GstMeta from the input buffers to the output
All functions that return a GstBuffer or a list of them will now copy
all GstMeta from the input buffers except for meta with GST_META_FLAG_POOLED
flag or "memory" tag.

This is similar to the existing behaviour that the caller can't assume
anything about the buffer flags, timestamps or other metadata. And it's
also the same that gst_adapter_take_buffer_fast() did before, and what
gst_adapter_take_buffer() did if part of the first buffer or the complete
first buffer was requested.

https://bugzilla.gnome.org/show_bug.cgi?id=742385
2015-06-30 18:40:28 +02:00
Olivier Crête
3ed95158cc ptp: Init function can take a NULL interfaces array 2015-06-29 20:27:19 -04:00
Sebastian Dröge
c659446371 basetransform: Fix up documentation of transform_meta vfunc
By default we copy all metas that have no tags.
2015-06-29 13:58:04 +02:00