Commit graph

2412 commits

Author SHA1 Message Date
Olivier Crête
cc605f4560 aggregator: Consistently lock some members
Some members sometimes used atomic access, sometimes where not locked at
all. Instead consistently use a mutex to protect them, also document
that.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
ee04b09233 videoaggregator: Lock access to members of GstAggregatorPad
Take the pad's object lock before accessing members of the
GstAggregatorPad structure.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
68ac6438f0 aggregator: Protect exported pad members with the pad's object lock
https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
cc3f418516 aggregator: Replace event lock with pad's object lock
Reduce the number of locks simplify code, what is protects
is exposed, but the lock was not.

Also means adding an _unlocked version of gst_aggregator_pad_steal_buffer().

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
0a2dc1185c aggregator: Protect data with the same mutex as GCond
Whenever a GCond is used, the safest paradigm is to protect
the variable which change is signalled by the GCond with the same
mutex that the GCond depends on.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:17 +01:00
Nirbheek Chauhan
878b53f8fc videoaggregator: If getting a timeout before having caps, just advance our position
This can happen if this is a live pipeline and no source produced any buffer
and sent no caps until an output buffer should've been produced according to the
latency.

This fix is similar in spirit to commit be7034d1 by Sebastian for audiomixer.
2015-01-29 09:47:32 +01:00
Matthew Waters
6d9dc9c81c gl/calayer: add resize callback based on the bounds rectangle 2015-01-29 18:32:04 +11:00
Matthew Waters
2ab0e1517f gl/caopengllayer: draw asynchronously
This essentially makes the CAOpenGLLayer draw every refresh cycle.
2015-01-29 18:32:04 +11:00
Matthew Waters
f3273cafc4 gl/cocoa: don't segfault if we have a NULL draw/resize/close callback 2015-01-29 18:32:04 +11:00
Matthew Waters
8d5ba8d96a cgl/calayer: use a callback instead of hardcoding the draw functionality 2015-01-29 18:32:04 +11:00
Matthew Waters
693cdb47cd cgl: install the gl context and gl layer headers 2015-01-29 18:32:04 +11:00
Matthew Waters
9caf706185 cgl: add a header for the CAOpenGLLayer support 2015-01-29 18:32:04 +11:00
Philippe Normand
cfc0230e04 gl/dispmanx: fix build
Commit ab48bb6f0f changed the API of
GstGLWindow.
2015-01-27 21:31:21 +11:00
Matthew Waters
08dbd8bbd7 glmemory: more compatibility defines for gles2 systems 2015-01-27 14:52:47 +11:00
Matthew Waters
eea03967e4 glmemory: add some thread safety for gl operations 2015-01-27 12:26:05 +11:00
Matthew Waters
9a55a3f98c glmemory: use pbo's for download
In order to use pbo's efficiently, the transfer operation has to
be separated from the use of the downloaded data which requires some
rearchitecturing around glcolorconvert/gldownload and elements
2015-01-27 12:26:04 +11:00
Matthew Waters
f2667ebc7b glprototypes: add some (un)map buffer variants for GL/GLES 2015-01-27 12:26:04 +11:00
Tim-Philipp Müller
21168dd199 videoaggregator: fix crash when receiving buffer without timestamps
Unset out buffer in clip function when we unref the buffer to be
clipped, otherwise aggregator will continue to use the already-
freed buffer. Fixes crash when buffers without timestamps are
being fed to aggregator. Partly because aggregator ignores the
error flow return.

https://bugzilla.gnome.org/show_bug.cgi?id=743334
2015-01-26 09:24:40 +00:00
Edward Hervey
aebec9bd24 codecparsers: Indent file
Someone's been commiting without using gst-indent :)
2015-01-23 12:26:16 +01:00
Edward Hervey
3da1c9c8d5 codecparsers: Add READ_UE_MAX macro
READ_UE_ALLOWED was almost exclusively used with min == 0, which doesn't
make much point for unsigned integers.

Add a READ_UE_MAX variant and use that instead. Also replaced two usages
of CHECK_ALLOWED (a,0,something) by CHECK_ALLOWED_MAX (a, something)
2015-01-23 12:24:52 +01:00
Matthew Waters
27e5e0c2df gl/window/eagl: fix a couple of typos 2015-01-23 16:52:25 +11:00
Matthew Waters
06fdbd44b9 glwindow: cleanup/reorganize functions/members into logical groups 2015-01-23 16:39:44 +11:00
Matthew Waters
ab48bb6f0f glwindow: remove width/height from _draw()
Depending on the platform, it was only ever implemented to 1) set a
default surface size, 2) resize based on the video frame or 3) nothing.
Instead, provide a set_preferred_size () that elements/applications
can use to request a certain size which may be ignored for
videooverlay/other cases.
2015-01-23 16:11:31 +11:00
Matthew Waters
4fc554054c glcontext/cocoa: avoid destroying a possibly 0 GSource id 2015-01-22 21:43:51 +11:00
Matthew Waters
e10d2417e2 gl/cocoa: move to CGL and CAOpenGLLayer for rendering
Removes the use of NSOpenGL* variety and functions.  Any Cocoa
specific functions that took/returned a NSOpenGL* object now
take/return the CGL equivalents.
2015-01-22 21:29:52 +11:00
Matthew Waters
fe8fdbdc7c glcontext/cocoa: add debug category 2015-01-22 21:27:44 +11:00
Sebastian Dröge
80e02cbdf9 Constify some static arrays everywhere 2015-01-21 10:18:50 +01:00
Thiago Santos
9ebbce381a adaptivedemux: do not skip the first fragment
Avoid advancing fragment right after downloading the header. If it
is the header, by default, don't advance to the next fragment.
2015-01-20 14:55:05 -03:00
Thiago Santos
919b93ae35 adaptivedemux: add explicit cast to make clang happy
Fixes compilation
2015-01-20 09:23:02 -03:00
Thiago Santos
229a15b393 adaptivedemux: refactor chunk downloading flow
Add more power to the chunk_received function (renamed to data_received)
and also to the fragment_finish function.

The data_received function must parse/decrypt the data if necessary and
also push it using the new push_buffer function that is exposed now. The
default implementation gets data from the stream adapter (all available)
and pushes it.

The fragment_finish function must also advance the fragment. The default
implementation only advances the fragment.

This allows the subsegment handling in dashdemux to continuously download
the same file from the server instead of stopping at every subsegment
boundary and starting a new request
2015-01-19 15:30:04 -03:00
Thiago Santos
9336077057 adaptivedemux: fix multi-period playback
If we say it is the first segment after a new period it will resync
the segment.start value and all buffers will be late for the new period
we are trying to play. Otherwise we want to keep the segment.start with
the previous value to allow the running time to smoothly increase
2015-01-19 08:36:42 -03:00
Lasse Laursen
174ea7af7b glapi: fix compilation with latest MSVC
https://bugzilla.gnome.org/show_bug.cgi?id=743041
2015-01-17 10:56:20 +11:00
Matthew Waters
989af902fe glmemory: use the correct size for the pbo
It was missing the GstVideoAlignment padding which could cause GL
errors related to overrunning the size of the pbo.
2015-01-17 10:56:20 +11:00
Thiago Santos
3a79bd91c7 adaptivedemux: prevent early EOS when switching at last fragment
Check if there is a next fragment before advancing to avoid causing
a bitrate switch (and maybe exposing new pads) only to push EOS.
This causes playback to stop with an error instead of properly
finishing with EOS message.
2015-01-16 17:07:22 -03:00
Thiago Santos
516f1ae0f4 adaptivedemux: add a special return to signal subsegment boundary
The subsegment boundary return tells the adaptivedemux that it can
try to switch to another representation as the stream is at a suitable
position for starting from another bitrate.
2015-01-16 15:00:11 -03:00
Thiago Santos
9b260d1ba5 adaptivedemux: Actually use the byte range for the fragment url
Otherwise we would always download the full fragment. This would
make handling subsegments in DASH impossible.
2015-01-16 15:00:11 -03:00
Thiago Santos
5c3a87c117 adaptivedemux: allow downloads of headers only
In order to get some subsegment information, subclasses might want
to download only the headers to have enough data (the index)
to decide where to start downloading from the subsegment.
2015-01-16 15:00:11 -03:00
Thiago Santos
f7e9a58c58 adaptivedemux: refactor common code to function
Reuse the same function when finishing downloading and signaling to
the download loop thread to get the next fragment or abort
2015-01-16 15:00:11 -03:00
Thiago Santos
5823f8b408 adaptivedemux: inform subclass when headers/index are being downloaded
This allows the subclasses to know if the chunks that are downloaded are
part of the header or of the index and will parse the parts that are
of their interest.
2015-01-16 15:00:11 -03:00
Vincent Penquerc'h
0b499484b4 uridownloader: a few leak fixes 2015-01-16 11:43:22 +00:00
Vincent Penquerc'h
59bd35aed1 fragment: fix caps and buffer leaks in get_property 2015-01-16 11:43:22 +00:00
Matthew Waters
8fef381417 glmemory: remove spurious gst_video_info_align
That will be taken care of by the calling code (typically a bufferpool).
The GstVideoAlignment is purely informational to compute plane data sizes.
2015-01-15 09:50:02 +11:00
Nirbheek Chauhan
4b9924557a aggregator: Nitpick spacing/punctuation in debug logging 2015-01-14 19:21:31 +01:00
Vincent Penquerc'h
c73a5e0c54 h264parser: fix stack smashing
Ensure that we do not trust the bitstream when filling a table
with a fixed max size.
Additionally, the code was not quite matching what the spec says:
- a value of 3 broke from the loop before adding an entry
- an unhandled value did not add an entry
The reference algorithm does these things differently (7.3.3.1
in ITU-T Rec. H.264 (05/2003)).

This plays (apparently correctly) the original repro file, with
no stack smashing.

Based on a patch and bug report by André Draszik <git@andred.net>
2015-01-14 11:39:55 +00:00
Matthew Waters
d5c3693791 gl: split glcolorconvert usage from glupload
the separation allows the transfer operation to occur in a separate
thread/time which may increase performance in specific circumstances.
2015-01-14 22:22:13 +11:00
Matthew Waters
4ccf45823e glmemory: offset the data pointer for upload for GstVideoAlignment
otherwise we attempt to read from the padding data
2015-01-14 22:22:13 +11:00
Matthew Waters
d1e923765b glmemory: use pbo's for upload 2015-01-14 22:22:13 +11:00
Matthew Waters
8c2d5dac72 glupload: relax the GLMemory uploader check for input caps features
As there may be a sysmem caps features with GLMemory filled buffers.
e.g.

videotestsrc ! glimagesink
2015-01-14 22:22:13 +11:00
Nicola Murino
442451a30d glcolorconvert: fix memleak
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2015-01-13 15:20:34 +11:00
Nicola Murino
3c6d775766 glupload: fix some memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2015-01-13 15:19:39 +11:00
Matthew Waters
4c73e20553 glcontext: allow wrapped contexts to be utilised like non-wrapped contexts
Fill in the missing pieces like get_proc_address, the gl function vtable
2015-01-13 15:18:41 +11:00
Stefan Sauer
4732962c85 gitignore: ignore more files 2015-01-12 22:52:36 +01:00
Sebastian Dröge
fa5c433e7e gl/cocoa: Disable hack for NSApp iteration with a special #define
The hack causes deadlocks and other interesting problems and it really
can only be fixed properly inside GLib. We will include a patch for
GLib in our builds for now that handles this, and hopefully at some
point GLib will also merge a proper solution.

A proper solution would first require to refactor the polling in
GMainContext to only provide a single fd, e.g. via epoll/kqueue
or a thread like the one added by our patch. Then this single
fd could be retrieved from the GMainContext and directly integrated
into a NSRunLoop.

https://bugzilla.gnome.org/show_bug.cgi?id=741450
https://bugzilla.gnome.org/show_bug.cgi?id=704374
2015-01-10 15:54:30 +01:00
Olivier Crête
9ba9873b1f aggregator: Remove pointless atomic
It is only modified from the streaming thread
2015-01-09 22:08:08 -05:00
Olivier Crête
22ea83e7fa aggregator: Fix query leak 2015-01-09 22:02:53 -05:00
Sebastian Dröge
713205fbe6 aggregator: Print jitter from clock waiting in the debug logs 2015-01-09 16:43:58 +01:00
Sebastian Dröge
1b2de14000 gl/cocoa: Don't init and clear static GMutex / GCond
We would potentially use it from the main loop later in
gst_gl_window_cocoa_init_nsapp() if it timed out before.
2015-01-08 09:36:24 +01:00
Luis de Bethencourt
75cc750efc glfilter: remove logically dead code
Soon after setting two variables to 1, the code checks if their values are
different from each other. This would never be true. Removing this.

CID 1226443
2015-01-07 16:53:41 +00:00
Thiago Santos
c1251ab861 adaptivedemux: only update segment if we have a valid PTS
Otherwise we set the position to GST_CLOCK_TIME_NONE and it disrupts
bitrate switching
2015-01-07 09:30:40 -03:00
Thiago Santos
af78e2501c adaptivedemux: prepare for supporting seeks in live streams
Add function to allow subclasses to specify seeking range for
live streams

https://bugzilla.gnome.org/show_bug.cgi?id=725435
2015-01-05 17:58:54 -03:00
Tim-Philipp Müller
fbd4cf9810 aggregator: don't use iterator when setting flush pending on pads 2015-01-04 17:25:45 +00:00
Tim-Philipp Müller
4da01dadcc aggregator: check if pads are ready more efficiently
No need to use an iterator for this which creates a temporary
structure every time and also involves taking and releasing the
object lock many times in the course of iterating. Not to mention
all that GList handling in gst_aggregator_iterate_sinkpads().
2015-01-04 17:07:43 +00:00
Tim-Philipp Müller
3e38003218 aggregator: name vfunc arguments consistently 2015-01-04 12:59:19 +00:00
Tim-Philipp Müller
10d5e878d8 aggregator: add g-i transfer and scope annotations 2015-01-01 15:48:08 +00:00
Tim-Philipp Müller
82f74cd9e0 aggregator: register names of iterate_sinkpads functions with debug system 2015-01-01 14:10:05 +00:00
Tim-Philipp Müller
22d4c7a5c5 aggregator: reduce debug messages for taking/releasing logs to TRACE level
Don't spam debug log with this stuff.
2015-01-01 14:04:24 +00:00
Tim-Philipp Müller
6e30a98fd5 aggregator: move property member into private structure
Our locking (or lack thereof) while accessing this also
looks generally quite dodgy.
2014-12-31 18:18:03 +00:00
Tim-Philipp Müller
b00ea0cc08 aggregator: remove empty dispose function 2014-12-31 14:50:58 +00:00
Tim-Philipp Müller
ad40a65a01 aggregator: give private functions namespace prefix
Especially the GST_DEBUG_FUNCPTR ones.
2014-12-31 12:36:08 +00:00
Tim-Philipp Müller
d0068899bf aggregator: fix up some docs comments in header 2014-12-31 12:35:06 +00:00
Tim-Philipp Müller
7b282513f3 aggregator: remove now-unused system clock member 2014-12-30 23:44:46 +00:00
Tim-Philipp Müller
c1f6ef5f53 aggregator: make GstAggregatorPadForeachFunc take an GstAggregatorPad 2014-12-30 19:22:01 +00:00
Tim-Philipp Müller
6fc474c30a videoaggregator: update for aggregator start/stop vfunc change 2014-12-30 17:56:35 +00:00
Tim-Philipp Müller
b4d2deb6d6 aggregator: bring start/stop vfunc semantics in line with other baseclasses
Sub-class should not have to chain up to GstAggregator's start/stop
vfuncs, same as in GstBaseSrc, GstBaseSink, GstBaseTransform etc.
2014-12-30 17:55:05 +00:00
Tim-Philipp Müller
45ae4d7f9c aggregator: remove pointless GST_DEBUG_FUNCPTR
Not useful for GObject vfuncs.
2014-12-28 18:26:49 +00:00
Tim-Philipp Müller
773e426616 aggregator: remove duplicate pad parent_class variable
G_DEFINE_TYPE already provides one, just need to use it.
2014-12-28 18:25:00 +00:00
Tim-Philipp Müller
813ada29ad aggregator: add _CAST() variants for cast macros 2014-12-28 18:22:57 +00:00
Tim-Philipp Müller
83de85a2f3 aggregator: make padding larger
Esp. the class structures, can't have enough
spare space for virtual functions.
2014-12-28 01:13:33 +00:00
Nirbheek Chauhan
2a6446e519 aggregator: Log to the pad instead of the element
More correct way of doing the same thing as before
2014-12-27 11:06:09 +00:00
Sebastian Dröge
ba1b53113a aggregator: Make sure that the minimum latencies are never GST_CLOCK_TIME_NONE 2014-12-27 09:49:43 +01:00
Sebastian Dröge
6449e3d897 aggregator: Wait for the minimum latency, not the maximum
The minimum latency is the latency we have to wait at least
to guarantee that all upstreams have produced data. The maximum
latency has no meaning like that and shouldn't be used for waiting.
2014-12-27 09:45:08 +01:00
Nirbheek Chauhan
46f857b314 aggregator: Clamp the min latency at the max if it's greater 2014-12-27 09:45:08 +01:00
Nirbheek Chauhan
3193094cbc aggregator: Print the sinkpad name while logging latency queries
Very useful while debugging.
2014-12-27 09:45:08 +01:00
Nirbheek Chauhan
f3efb9e7d6 aggregator: Take the stream lock when iterating sink pads
When iterating sink pads to collect some data, we should take the stream lock so
we don't get stale data and possibly deadlock because of that. This fixes
a definitive deadlock in _wait_and_check() that manifests with high max
latencies in a live pipeline, and fixes other possible race conditions.
2014-12-27 09:45:08 +01:00
Thiago Santos
c65aeedb6f adaptivedemux: check if element exists before setting it to null
Under certain error conditions it might happen that the element
has been freed already and trying to set it to NULL causes an
assertion
2014-12-23 10:08:57 -03:00
Thiago Santos
3dfab51b92 adaptivedemux: make sure task has stopped before freeing it
Otherwise the thread will be running and its memory will get freed.
This leads to memory corruption
2014-12-23 10:08:56 -03:00
Thiago Santos
0bef1974e2 adaptivedemux: fix segment start when exposing new streams
Segment start needs only to be updated when starting the streams
or after a seek, doing it during bitrate changes will cause the
running time to go discontinuous (jump back to a previous ts)
and QOS will drop buffers
2014-12-23 10:08:56 -03:00
Thiago Santos
73fb0850c9 adaptivedemux: allow subclass to use new pads group when switching bitrate
Fix pad groups switching when bitrate changes to allow HLS to use this feature
2014-12-23 10:08:51 -03:00
Sebastian Dröge
6771db209d aggregator: Don't leak flush-start events 2014-12-23 11:45:05 +01:00
Sebastian Dröge
e7867a3586 aggregator: Also change the default latency to 0, not just the minimum 2014-12-23 10:24:27 +01:00
Sebastian Dröge
c04bb6983e aggregator: Fix docs and default value of the latency property 2014-12-23 09:52:20 +01:00
Sebastian Dröge
800f0ac49b aggregator: Also include the subclass latency in the result of the latency query 2014-12-22 22:19:52 +01:00
Sebastian Dröge
ad9fe1fe7b videoaggregator: Use the src query implementation of aggregator as the default case 2014-12-22 22:12:02 +01:00
Sebastian Dröge
5dd1dfdadc aggregator: Post a latency message if the value of the latency property changes 2014-12-22 15:27:25 +01:00
Sebastian Dröge
a27ff89d42 aggregator: Wake up the src thread after handling a latency query
Due to changed latencies or changed live-ness we might have to
adjust if we wait on a deadline at all and how long.
2014-12-22 15:03:59 +01:00
Sebastian Dröge
341e5291c3 aggregator: Don't count the number of times we need to wake up but instead check all conditions for waiting again
This simplifies the code and also makes sure that we don't forget to check all
conditions for waiting.

Also fix a potential deadlock caused by not checking if we're actually still
running before starting to wait.
2014-12-22 15:00:36 +01:00
Nicolas Dufresne
207308446b glbufferpool: Always recalculate buffer size
Actually we should always recalculate buffer size since our buffer size
even when not-padded is smaller for many sub-sampled formats. This is
because we don't add padding between the planes.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 12:25:41 -05:00
Nicolas Dufresne
170a49f901 glmemory: No need for padding
A memory object cannot be put on stack, so no need for padding.
2014-12-19 12:12:08 -05:00
Nicolas Dufresne
9954de1ccd gl: Add support for GstVideoAlignment
This allow saving a copy with libav video decoders or decoders with
similar padding requirement.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 12:11:08 -05:00
Nicolas Dufresne
da3ae06cd1 glmemory: Handle upload/download flags from map
Problem was that if buffer was mapped READWRITE (state of buffers from
libav right now), mapping it READ/GL will not upload. This is because the
flag is only set when the buffer is unmapped. We can fix this by setting
the flags in map. This result in already mapped buffer that get mapped
to be read in GL will be uploaded. The problem is that if the write
mapper makes modification afterward, the modification will never get
uploaded.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 11:45:35 -05:00