Commit graph

18115 commits

Author SHA1 Message Date
Alessandro Decina
5f547c5600 gl: initial support for texture targets other than GL_TEXTURE_2D
Make GstGLMemory hold the texture target (tex_target) the texture it represents
(tex_id) is bound to. Modify gst_gl_memory_wrapped_texture and
gst_gl_download_perform_with_data to take the texture target as an argument.

This change is needed to support wrapping textures created outside libgstgl,
which might be bound to a target other than GL_TEXTURE_2D. For example on OSX
textures coming from VideoToolbox have target GL_TEXTURE_RECTANGLE.

With this change we still keep (and sometimes imply) GL_TEXTURE_2D as the
target of textures created with libgstgl.

API: modify GstGLMemory
API: modify gst_gl_memory_wrapped_texture
API: gst_gl_download_perform_with_data
2015-01-30 00:34:08 +11:00
Alessandro Decina
12e8bb4a66 gstglcolorconvert: micro optimization
Don't call glClear && glClearColor at each draw since we're going to draw the
whole viewport anyway. Gets rid of a glFlush triggered by glClear on OSX.
2015-01-30 00:34:08 +11:00
Alessandro Decina
e91989136a applemedia: corevideobuffer: make mapping the CVPixelBuffer in CPU optional
Mapping is not necessary and impacts performance when doing texture sharing with
downstream
2015-01-30 00:34:08 +11:00
Alessandro Decina
c7284a6390 gstglcolorconvert: relax caps features check
Require caps to have the GST_CAPS_FEATURE_MEMORY_GL_MEMORY feature but allow
them to have more features.
2015-01-30 00:34:08 +11:00
Vincent Penquerc'h
5c44bceeb3 opusenc: change audio property to audio-type
This is now an enum with values generic (default) and voice.

https://bugzilla.gnome.org/show_bug.cgi?id=740891
2015-01-29 13:23:57 +00:00
Matthew Waters
1e6011bcdf gl/win32: fixup compilation 2015-01-29 23:46:57 +11:00
Luis de Bethencourt
26692836f2 audiovisualizer: remove double-setting of render function
No need to set the audiovisualizer->render function twice. Once is enough.
2015-01-29 11:55:13 +00:00
Matthew Waters
6cf97eb221 glwindow: make showing a window explicit
Also fixes the cgl context always displaying a window to render to for
every GstGLContextCocoa created
2015-01-29 22:26:37 +11:00
Thibault Saunier
71e4c485f0 aggregator: Cleanup locking around AggregatorPad flush related fields
And document the locking

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Mathieu Duponchelle
b27fb0dbac aggregator: keep chain functions as dumb as possible.
+ A pad chain function has no business checking other pads,
  that's what the aggregate thread is for.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Thibault Saunier
ccf329d527 aggregator: More fixes around locking when accessing protected private fields
In some more places we were accessing GstAggregator->segment
and GstAggregator->seqnum without holding the GST_OBJECT_LOCK

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Thibault Saunier
1a07467d5f aggregator: Make the PAD_LOCK private
Instead of using the GST_OBJECT_LOCK we should have
a dedicated mutex for the pad as it is also associated
with the mutex on the EVENT_MUTEX on which we wait
in the _chain function of the pad.

The GstAggregatorPad.segment is still protected with the
GST_OBJECT_LOCK.

Remove the gst_aggregator_pad_peak_unlocked method as it does not make
sense anymore with a private lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Thibault Saunier
d8eef43123 aggregator: Hide GstAggregatorPad buffer and EOS fileds
And add a getter for the EOS.

The user should always use the various getters to access
those fields

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
fb6ba27ae5 audiomixer: Make flush start/stop test non-racy
The flush stop could have happened between the source trying
to push the segment event and the buffer, this would cause a warning.
Prevent that by taking the source's stream lock while flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
f98e457f99 audiomixer: Replace racy timeout based tested with drain query
Using the drain query, we can be certain that the buffer has done going
through the aggregator by taking the stream locks.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
93d0b51dba aggregator: Document locking of GstAggregatorPrivate members
Most of them are protected by the object lock, specify
which ones use a different lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
ea76d39738 aggregator: Document how the segment is protected
Document that it can only be accessed with the object lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
9df8ac0a98 aggregator: Protect all latency related members with the object lock
The locking was not consistent, now consistently use the object lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
41d26673d6 aggregator: Document locking for gst_aggregator_get_latency_unlocked()
Renamed it to _unlocked() to make it clear.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
f7070dcfdc aggregator: Protect the srcpad caps negotiation with the stream lock
Instead of adding another lock, use the srcpad stream lock, which is already
taken anyway to push out the new caps if needed.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
4a5882ee08 aggregator: Protect the tags with the object lock
The tags related variables were sometimes protected, sometimes not and
sometimes atomic. Put them all under the object lock.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
94e2d78479 audiomixer: Avoid race in caps negotiation
With the current audiomixer, the input caps need to be the same,
otherwise there is an unavoidable race in the caps negotiation. So
enforce that using capsfilters

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
eddd5fd259 aggregator: Consistenly lock the flow_return state
Use the object's lock to protect it.

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
Olivier Crête
a2f1aa30c8 audiomixer: Clear GstAudioInfo the the caps
When clearing the caps, also clear the matching GstAudioInfo

https://bugzilla.gnome.org/show_bug.cgi?id=742684
2015-01-29 10:24:18 +01:00
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
067b44e0b8 audiomixer: Don't reset caps on flush
A flush event doesn't invalidate the previous caps event.

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
Sebastian Dröge
e9b49018ed decklinkvideosink: Always lock the mutex before starting the streams 2015-01-28 17:02:59 +01:00
Sebastian Dröge
837eee7085 decklinkvideosink: Fix deadlock 2015-01-28 16:59:30 +01:00
Sebastian Dröge
4eb5cd9156 decklink{audio,video}sink: Only start scheduled playback once both sources are ready and we are in PLAYING
Otherwise we might start the scheduled playback before the audio or video streams are
actually enabled, and then error out later because they are enabled to late.

We enable the streams when getting the caps, which might be *after* we were
set to PLAYING state.
2015-01-28 16:13:16 +01:00
Sebastian Dröge
e2ff5587fe decklink{audio,video}src: Only start the streams once both sources are ready and we are in PLAYING
Otherwise we might start the streams before the audio or video streams are
actually enabled, and then error out later because they are enabled to late.

We enable the streams when getting the caps, which might be *after* we were
set to PLAYING state.
2015-01-28 16:13:16 +01:00
Sebastian Dröge
00176a1ddf decklink: Make sure our clock never returns NONE, always advances and does not jump when going from PAUSED to PLAYING
It basically behaves the same as the audio clocks.
2015-01-28 16:13:16 +01:00
Sebastian Dröge
b3a4772834 decklinkvideosink: Handle the clock returning GST_CLOCK_TIME_NONE properly 2015-01-28 16:13:16 +01:00
Sebastian Dröge
8a5d2c561c decklinkvideo{sink,src}: Make elements more similar to the audio elements by enabling the video input/output only when getting the actual caps
This will also make it easier later to support caps changes and support
selecting the mode based on the caps if that should ever be implemented.
2015-01-28 16:13:16 +01:00
Sebastian Dröge
f3ae93e504 decklinkvideosrc: Properly report caps if mode!=auto and handle caps changes properly for mode=auto 2015-01-28 16:13:16 +01:00
Sebastian Dröge
7fb57938c1 decklinkaudiosrc: Don't release input device twice on errors in set_caps() 2015-01-28 16:13:16 +01: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