Commit graph

3614 commits

Author SHA1 Message Date
Edward Hervey
50f92fab89 adaptivedemux: Workaround for live seek ranges when advancing
This is a workaround for a regression introduced by
f4190a49c0
 ( adaptivedemux: Check live seeking range more often )

The goal of the previous commit was to be able to cope with non-1.0
rates on live streams which have a "seeking window" (i.e. the server
keeps around quite a bit of the live stream so you can seek back into
it).

Without that commit, two different kind of issues would happen:
* When doing reverse playback, you would never check whether you
  are outside of the seekable region. And would then continuously
  try to download fragments that are no longer present.
* When doing fast forward, you would end up requesting fragments
  which are not present yet.

In order to determine whether one was *really* outside of the seekable
window, we check whether the current stream position is still
within the seekable region.

The *problem* though with that commit is that it assumes that subclasses
will return continuously updated seeking ranges (i.e. dependent on the
current time), which is *NOT* the case.

For example:
* dashdemux does use the current UTC to determine the seekable region
* hlsdemux uses the values from the last updated manifest

Therefore if one downloads fragments faster than realtime, for HLS
we would end up at the end of the last manifest seekable range, and
the previous commit would consider the stream as being ended... which
is not the case.

In the long run, we need to figure out a way to cope with non-1.0
rates on live streams for all types of stream (including HLS).

https://bugzilla.gnome.org/show_bug.cgi?id=783075
2017-07-13 14:44:11 +02:00
Thiago Santos
33afa6bd18 adaptivedemux: small refactor to avoid repeated code
Move segment event update to a function

https://bugzilla.gnome.org/show_bug.cgi?id=773159
2017-07-12 10:13:39 +02:00
Edward Hervey
1df725e5cd adaptivedemux: Handle prepared streams on seeks
This is a race that was exposed by the {hls|dash}.scrub_forward_seeking
validate test.

The "race" is that a subclass might want to change format, causing
a new stream to be created (but not exposed/switched yet) and put on the
prepared_streams list. That stream will have values (including pending
segment) from the pre-seek state.

Before the stream is exposed/switched, a new seek comes in and the stream
values get updated ... but the ones that will be changed don't get updated
causing them to push out wrong segments once they are exposed.

https://bugzilla.gnome.org/show_bug.cgi?id=773159
2017-07-12 10:13:39 +02:00
Jan Schmidt
6083ad6287 glfilter: Remove hard-coded pad templates
Add a function to install the default RGBA pad templates,
but don't make them required so that there can be
GstGLFilter sub-classes with different input/output
caps if they want. Remove the hard-coded RGBA restriction in
the set_caps_features call, as it will be taken care
of by intersecting with the pad templates.

Update all the sub-classes to match
2017-07-12 15:50:24 +10:00
Jan Schmidt
cb3a65a19a glupload: Don't throw assertions on invalid allocation query
basesrc can send an allocation query with no caps, in which
case we should just fail it without throwing assertions.
2017-07-12 15:48:23 +10:00
Nicolas Dufresne
2f8980d70d Revert "adaptivedemux: Allow application to force EOS"
This reverts commit 8a070cf9af.
2017-07-07 17:20:38 -04:00
Nicolas Dufresne
8a070cf9af adaptivedemux: Allow application to force EOS
Adaptive demuxers are special demuxers that runs their own sources
internally. In this patch we flag the demuxer as being a source in order
to receive the downstream events. We then handle the EOS event by
resetting the internal state and pushing EOS on all pads. This handling
is done asynchronously to avoid blocking user thread.

https://bugzilla.gnome.org/show_bug.cgi?id=723868
2017-07-07 14:36:38 -04:00
Mathieu Duponchelle
3899b2f6e9 aggregator: Invalidate pad's tail position ...
when dequeuing a segment event.

https://bugzilla.gnome.org/show_bug.cgi?id=784593
2017-07-06 16:22:01 +02:00
Mathieu Duponchelle
0478773155 videoaggregator: fix gaps at end of streams.
When the pad has received EOS, its buffer may still be mixed
any number of times, when the pad's framerate is inferior
to the output framerate.

This was introduced by my patch in
https://bugzilla.gnome.org/show_bug.cgi?id=782962, this patch
also correctly addresses the initial issue.
2017-07-06 04:02:38 +02:00
Tim-Philipp Müller
2db4ff751f codecparsers: h264: flesh out documentation for GST_H264_PARSER_NO_NAL_END 2017-07-04 15:28:36 +01:00
Stefan Sauer
179b583693 aggregator: fix "'aggclass' may be used uninitialized in this function" 2017-07-01 20:23:25 +02:00
Julien Isorce
86ae9777ad glupload: add GST_CAPS_FEATURE_MEMORY_DMABUF
Insert before SystemMemory to advice upstream elements that it is
preferable for them to push dmabuf with the caps feature.

Examples:

/* Discard memory:DMABuf caps feature */
GST_GL_PLATFORM=egl GST_GL_API=gles2 GST_GL_WINDOW=x11 gst-launch-1.0 \
    filesrc location=test.mp4 ! qtdemux ! h264parse ! vaapih264dec ! \
    capsfilter caps="video/x-raw(memory:SystemMemory)" ! glimagesink

/* Force memory:DMABuf caps feature. */
GST_GL_PLATFORM=egl GST_GL_API=gles2 GST_GL_WINDOW=x11 gst-launch-1.0 \
    filesrc location=test.mp4 ! qtdemux ! h264parse ! vaapih264dec ! \
    capsfilter caps="video/x-raw(memory:DMABuf)" ! glimagesink

/* Auto select memory:DMABuf caps feature.  */
GST_GL_PLATFORM=egl GST_GL_API=gles2 GST_GL_WINDOW=x11 gst-launch-1.0 \
    filesrc location=test.mp4 ! qtdemux ! h264parse ! vaapih264dec ! \
    glimagesink

https://bugzilla.gnome.org/show_bug.cgi?id=774649
2017-06-30 08:31:20 +01:00
Matthew Waters
effda87a0b gl: reset gl->DrawBuffer to the necessary values
GL_COLOR_ATTACHMENT0 when a framebuffer is bound
GL_BACK if no framebuffer is bound

https://bugzilla.gnome.org/show_bug.cgi?id=784210
2017-06-29 14:59:12 +10:00
Hyunjun Ko
02ef39f48a glmemory: reset the draw buffer to GL_BACK
The draw buffer should be reset to GL_BACK since the framebuffer is already
unbound.

https://bugzilla.gnome.org/show_bug.cgi?id=784210
2017-06-29 14:59:12 +10:00
Nicolas Dufresne
55e701a373 meson: Re-add pkg-config support for bcm_host
Now we just fallback to find_library for Rasbian jessy and older.

https://bugzilla.gnome.org/show_bug.cgi?id=784026
2017-06-22 12:20:25 -04:00
Guillaume Desmottes
859daad65d gl: meson: use cc.find_library() to detect 'bcm_host'
On the raspberry pi no pkg-config file is provided for the bcm_host
library. We are using AC_CHECK_LIB to detect this lib with autotools,
cc.find_library() library is a closer meson equivalent.

https://bugzilla.gnome.org/show_bug.cgi?id=784026
2017-06-21 11:44:22 -04:00
Sebastian Dröge
450b1c92ab gl/cocoa: Put gstglwindow_cocoa.h into noinst_HEADERS again
And remove gstgldisplay_cocoa.h instead, which got moved to the
installed headers earlier.
2017-06-20 19:20:19 +03:00
Sebastian Dröge
f845208d79 glupload: Fix DirectVIV uploader for formats with a single plane
We have to pass the "height" as height = vmeta->offset[1] / width to the
API, which of course does not work well for formats with only a single
plane. Use the whole memory size instead of the offset in that case.
2017-06-12 22:29:01 +03:00
Vincent Penquerc'h
e5a0c4a751 jpeg2000sampling: fix critical when sampling is missing from caps
This can happen with real files
2017-06-08 16:17:43 +01:00
Seungha Yang
87cb9fa49e adaptivedemux: Clear "cancelled" on uridownloader before processing manifest
Previous commit let demux call gst_uri_downloader_cancel() on _demux_reset().
Note that, _demux_reset() called during PAUSED_TO_READY and READY_TO_PAUSED.
And, it will set "cancelled" on uridownloader which blocks the use of
uridownloader. The issue is that, subclass can use the uridownloader not only
live streaming for manifest update, but also for fetching another manifests
such as variant and rendition m3u8 of hls streaming. So to unblock it,
demux should clear "cancelled" before processing initial manifest.

https://bugzilla.gnome.org/show_bug.cgi?id=783401
2017-06-06 19:21:56 -07:00
Mathieu Duponchelle
694da006e0 adaptivedemux: release the manifest lock ...
before broadcasting preroll.

The deadlock was as follows:

-> The subclass pushes a buffer on a newly-created stream in T1
-> We take the preroll lock in T1, to handle_preroll
-> The demuxer is stopped in T2, we take the MANIFEST_LOCK
-> T1 starts blocking because it received a reconfigure event
   and needs to take the MANIFEST_LOCK
-> T2 deadlocks because it now wants the preroll_lock.

https://bugzilla.gnome.org/show_bug.cgi?id=783255
2017-06-01 15:27:07 +02:00
Thiago Santos
5a693fdd9d adaptivedemux: do not erase data while updates-loop is running
Make sure the manifest update loop is stopped before proceeding with the
resetting of the manifest data. Otherwise, the updates loop will try to
use it and it leads to a segfault

https://bugzilla.gnome.org/show_bug.cgi?id=783028
2017-06-01 15:27:07 +02:00
Jeremy Hiatt
3620268325 glutils: Fix GValue leak in gst_gl_value_set_texture_target_from_mask() 2017-06-01 14:39:49 +03:00
Mathieu Duponchelle
c88125045f adaptivedemux: make sure to free all "old streams"
As we release the MANIFEST_LOCK in stop_tasks,
demux->priv->old_streams can be set, we need to free these
otherwise we may end up trying to dispose elements in the
READY state.

https://bugzilla.gnome.org/show_bug.cgi?id=783256
2017-06-01 11:13:46 +02:00
Edward Hervey
b104fb203a adaptivedemux: Don't be too aggressive with seek ranges
When an accurate seek is requested on a live stream, only requests the
exact value for the "starting position" (i.e. start in forward playback
and stop in reverse playback).

https://bugzilla.gnome.org/show_bug.cgi?id=782698
2017-05-31 11:34:41 +02:00
Edward Hervey
304a628de7 nonstreamaudio: Avoid using wrong variable
And to make that 100% obvious, only use variables declared within the
switch cases instead of function-wide ones.

Also remove useless one-time-use-only variable.

CID #1409857
2017-05-26 17:44:40 +02:00
Edward Hervey
2a193cde84 nonstreamaudio: Avoid using un-initialized value
We would end up with cur_position not set but proceed being at its
default value of TRUE. Instead, properly set proceed to FALSE

CID #1409855
2017-05-26 17:44:17 +02:00
Edward Hervey
cf362be9ff adaptivedemux: Fix debugging message
GstSegment position is a guint64 and not a gint64

CID #1409910
2017-05-26 17:30:34 +02:00
Edward Hervey
f4190a49c0 adaptivedemux: Check live seeking range more often
The live seeking range was only checked when doing actual seeks. This was
assuming that the rate would always be 1.0 (i.e. the playback would
advance in realtime, and therefore fragments would always be available
since the seeking window moves at the same rate).

With non-1.0 rates, this no longer becomes valid, and therefore we need
to check whether we are still within the live seeking range when advancing.

https://bugzilla.gnome.org/show_bug.cgi?id=783075
2017-05-26 11:51:14 +02:00
Edward Hervey
2cf4ece73b adaptivedemux: Don't create invalid event
tags could potentially be NULL
2017-05-26 09:55:42 +02:00
Matthew Waters
430a90df20 adaptivedemux: retry download MAX_DOWNLOAD_RETRY_COUNT times before erroring
What we want is to retry downloading the fragment on 4xx/5xx errors
however returning EOS will cause waiting for a manifest update for live
(which may be a really long time) or stop everything for non-live.

Change that to only return EOS/ERROR once we've reached the error limit.

https://bugzilla.gnome.org/show_bug.cgi?id=776609
2017-05-25 13:33:35 +03:00
Sebastian Dröge
be08f0f9a8 gl: Fix indentation 2017-05-25 13:06:03 +03:00
Sebastian Dröge
2434305ec5 glframebuffer: #define GL_READ_FRAMEBUFFER / GL_DRAW_FRAMEBUFFER if not defined yet
Just like we do elsewhere already.
2017-05-25 13:05:23 +03:00
Haihua Hu
c2b2c68bea glformat: fix the usage of GST_GL_RGB565
GL_RGB565 is sized internal glformat, the corresponding glformat
should be GL_RGB and type is GL_UNSIGNED_SHORT_565. Otherwise will
return GL_INVALID_ENUM when creating texture.

https://bugzilla.gnome.org/show_bug.cgi?id=783066
2017-05-25 12:34:12 +03:00
Haihua Hu
405d059a22 glframebuffer: check frame buffer status need use specific fbo target
https://bugzilla.gnome.org/show_bug.cgi?id=783065
2017-05-25 12:34:04 +03:00
Olivier Crête
86a256aebc aggregator: Process serialized queries through the queue
This ensures that they really get processed in order with
buffers. Just waiting for the queue to be empty is sometimes not
enough as the buffers are dropped from the pad before the result is
pushed to the next element, sometimes resulting in surprising
re-ordering.
2017-05-23 12:35:58 +02:00
Olivier Crête
9e2640ba95 aggregator: Set flow to FLUSHING on pad stop
Fixes a rare race where the pad is being stopped while doing a query.
2017-05-23 12:35:58 +02:00
Carlos Rafael Giani
2e4c6d6a49 audio: Add nonstreamaudiodecoder base class
https://bugzilla.gnome.org/show_bug.cgi?id=768576
2017-05-22 16:34:05 +02:00
Olivier Crête
5443aa9ac8 audioaggregate: Don't hold object locks across calls to aggregate_one
https://bugzilla.gnome.org/show_bug.cgi?id=782878
2017-05-21 18:44:53 +02:00
Olivier Crête
fbfc427552 aggregator: Request pad templates which are not request pad
https://bugzilla.gnome.org/show_bug.cgi?id=782920
2017-05-21 18:39:49 +02:00
Olivier Crête
8f0fba54b5 aggregator: Don't restrict sink pad names
Sink pads could have other names than sink_%u

https://bugzilla.gnome.org/show_bug.cgi?id=782920
2017-05-21 18:39:09 +02:00
Olivier Crête
68bb5bfecc videoaggregator: Declare that it supports the video meta on input
https://bugzilla.gnome.org/show_bug.cgi?id=782918
2017-05-21 18:17:54 +02:00
Olivier Crête
431dc9720a aggregator: Implement propose allocation
https://bugzilla.gnome.org/show_bug.cgi?id=782918
2017-05-21 18:17:54 +02:00
Olivier Crête
20bf97f089 aggregator: Check for the result of caps events
https://bugzilla.gnome.org/show_bug.cgi?id=782918
2017-05-21 18:17:54 +02:00
Olivier Crête
a463859eba aggregator: Caps event always goes to the aggregate thread
So no need to check it here.

https://bugzilla.gnome.org/show_bug.cgi?id=782918
2017-05-21 18:17:54 +02:00
Carlos Rafael Giani
d6e46b905a gl/viv-fb: Fix user-choice string comparisons
https://bugzilla.gnome.org/show_bug.cgi?id=782921
2017-05-21 16:52:23 +02:00
Olivier Crête
892693865f videoaggregator: Create normal video pool as a fallback
https://bugzilla.gnome.org/show_bug.cgi?id=746529
2017-05-21 13:24:29 +02:00
Olivier Crête
ea26b9aa37 audioaggregator: Use downstream allocator and params if available
https://bugzilla.gnome.org/show_bug.cgi?id=746529
2017-05-21 13:24:29 +02:00
Olivier Crête
31bbfd6773 videoaggregator: Get the buffer from the pool if available
https://bugzilla.gnome.org/show_bug.cgi?id=746529
2017-05-21 13:24:29 +02:00
Olivier Crête
12197e4bb5 aggregator: Add downstream allocation query
https://bugzilla.gnome.org/show_bug.cgi?id=746529
2017-05-21 13:24:26 +02:00
Olivier Crête
7b1235940f videoaggregator: Return to parent on reconfigure
The caps negotiation is now in the parent, so need to return there
if a reconfiguration is needed, otherwise it will loops forever.
2017-05-21 12:45:07 +02:00
Tim-Philipp Müller
06ae762211 gl: x11: fix compiler warning 2017-05-21 11:44:37 +01:00
Matthew Waters
15e13bd44e glcontext: add public swap_buffers function
That simply calls the implementation
2017-05-21 12:12:02 +02:00
Graham Leggett
711b006cb9 adaptivedemux: fix debug message printf format
Match gsize to G_GSIZE_FORMAT in the debug message.

https://bugzilla.gnome.org/show_bug.cgi?id=782873
2017-05-20 18:20:34 +01:00
Olivier Crête
583e655234 aggregator: Remove unused GST_FLOW_NOT_HANDLED 2017-05-20 16:21:17 +02:00
Matthew Waters
7c53043386 aggregator: add simple support for caps handling
Modelled off the videoaggregator caps handling as that seems the most
mature aggregtor-using implementation that has caps handling there is.

https://bugzilla.gnome.org/show_bug.cgi?id=776931
2017-05-20 16:21:17 +02:00
Nicolas Dufresne
ed8512c53e aggregator: Reset upstream latency on first buffer
In the case an aggregator is created and pads are requested but only
linked later, we end up never updating the upstream latency.
This was because latency queries on pads that are not linked succeed,
so we never did a new query once a live source has been linked, so the
thread was never started.

https://bugzilla.gnome.org/show_bug.cgi?id=757548
2017-05-20 16:21:17 +02:00
George Kiagiadakis
39d2526c34 videoaggregator: delay using new caps from a sink pad until the next buffer in the queue is taken
When caps changes while streaming, the new caps was getting processed
immediately in videoaggregator, but the next buffer in the queue that
corresponds to this new caps was not necessarily being used immediately,
which resulted sometimes in using an old buffer with new caps. Of course
there used to be a separate buffer_vinfo for mapping the buffer with its
own caps, but in compositor the GstVideoConverter was still using wrong
info and resulted in invalid reads and corrupt output.

This approach here is more safe. We delay using the new caps
until we actually select the next buffer in the queue for use.
This way we also eliminate the need for buffer_vinfo, since the
pad->info is always in sync with the format of the selected buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=780682
2017-05-20 16:21:16 +02:00
Olivier Crête
d2335bce9b aggregator: Always handle sync'ed events on output thread
Having all synchronized events always be handled on the output
thread should make synchronization easier.

https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
4cec1925e3 aggregator: Delay clipping to output thread
This is required because the synchronized events like caps or segments
may only be processed on the output thread.

https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
a6710944e8 aggregator: Make pad eos as soon as all buffers are processed, dont way for events
https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
6e96bebd5b aggregator: Only count buffers when declaring queue full
https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
4d408ea920 aggregator: Simplify clip function
The return value was ignored anyway

https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
20aee5f575 aggregator: Only declare first buffer on actual buffer
The function needs to be unlocked if any data is received, but only
end the first buffer processing on an actual buffer, synchronized events
don't matter on the first buffer processing.

https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
1ab33d78fe aggregator: Set initial position on first buffer
Set the initial position on the first buffer, otherwise the queue
will grow without limits before the output thread is started.

https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
82f7b00ea3 aggregator: Reset the pad's first buffer flag with the rest
There is not reason to have separate code to reset this one.

https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
05374aa22c aggregator: Reset pad on init
Factor out the pad reset code from the flushing and use it on init as well

https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
Olivier Crête
d722e064fd aggregator: Fix indentation
https://bugzilla.gnome.org/show_bug.cgi?id=781673
2017-05-20 16:21:16 +02:00
fvanzile
eca91d6772 glcontext: keep a ref to the active thread
With the macOS/iOS implementations, the active thread can change
multiple times over the life of a pipeline which would expose a race in
the thread tracking.

Fix by taking a ref on the active thread while the context is active.

https://bugzilla.gnome.org/show_bug.cgi?id=779202
2017-05-20 16:19:38 +02:00
Josep Torra
f805608075 cocoa: fix a recently introduced typo
Fixes gstgldisplay_cocoa.m:175:26: error: use of undeclared identifier 'singletone'.
2017-05-20 12:19:08 +02:00
Josep Torra
ef5d42b0a7 cocoa: fix macOS 10.12 deprecation warnings
Add #defines to allow older versions of macOS to use the new constant names.
2017-05-20 12:16:50 +02:00
Edward Hervey
be6465fc35 adaptivedemux: Add various comments to the code 2017-05-18 19:04:57 +02:00
Edward Hervey
3f42783857 adaptivedemux: Store QoS time
Allows subclasses to know where downstream is and make decisions
based upon that
2017-05-18 19:04:57 +02:00
Edward Hervey
4532277715 adaptivedemux: Add a macro to know if we are in trickmode-keyunit
Reduces the amount of lines of code in subclasses
2017-05-18 19:04:57 +02:00
Haihua Hu
ff8898bbda glformat: Add missing GST_GL_RGB565 in some switch statement
https://bugzilla.gnome.org/show_bug.cgi?id=782736
2017-05-17 20:33:13 +02:00
Sebastian Dröge
4fdd715c4b cocoa: Install gstgldisplay_cocoa.h
It's needed by e.g. qmlglsink.
2017-05-17 17:38:01 +03:00
Sebastian Dröge
634cd87c76 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:23 +03:00
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Edward Hervey
6a6ddb26b4 adaptivedemux: Handle stop_type:SET, stop:NONE
Seek values of type GST_SEEK_TYPE_SET with values of GST_CLOCK_TIME_NONE
are perfectly valid (we essentially don't modify the existing position)
2017-05-15 18:11:35 +02:00
Sebastian Dröge
65545ecfa3 glshader: Make reference counting of attach() consistent
https://bugzilla.gnome.org/show_bug.cgi?id=747990
https://bugzilla.gnome.org/show_bug.cgi?id=702960
2017-05-15 12:07:13 +03:00
Matthew Waters
7b615e92b6 build/gl/meson: check for GLES3/gl3ext.h existence
791e7522eb for meson

https://bugzilla.gnome.org/show_bug.cgi?id=781885
2017-05-11 20:06:47 +10:00
Jens Georg
791e7522eb build: Check for GLES3/gl3ext.h existence
Some OpenGL drivers do not ship this but use GLES2/gl2ext.h instead.
This is also in line with Khronos's recommendations

https://bugzilla.gnome.org/show_bug.cgi?id=781885
2017-05-11 20:05:14 +10:00
Sebastian Dröge
0730a55af3 glmemory: Only use glDrawBuffer if available
Otherwise fall back to glDrawBuffers. Also check if glReadBuffer exists
before using it.

glDrawBuffer does not exist for GLES, only glDrawBuffers does.

https://bugzilla.gnome.org/show_bug.cgi?id=782376
2017-05-09 11:26:13 +02:00
Edward Hervey
ea6e58d27f adaptivedemux: Handle more live seeking use-cases
This commit fixes the following assumptions with live seeking:
1) start was always valid and of type GST_SEEK_TYPE_SET
2) direction was always forward
3) stop should be offsetted when handling non-accurate seeks before
   the range start position.

In order to handle more live seeking use-cases (including reverse playback),
only do non-accurate start/stop value clamping for GST_SEEK_TYPE_SET values.

Also add a bit more debugging lines for issues

https://bugzilla.gnome.org/show_bug.cgi?id=782330
2017-05-09 09:02:07 +02:00
Edward Hervey
df60e12203 adaptivedemux: Implement GST_SEEK_TYPE_END usage for live
When dealing with live streams, we can't rely on GstSegment calculation
since it uses the segment duration to calculate the absolute values.

But since we are dealing with live *and* we know the ranges, we can
compute the absolute seeking values using the range stop (i.e. "now")
as the END position.

Allows seeking back to "live" by using start_type:GST_SEEK_TYPE_END
and start:0

https://bugzilla.gnome.org/show_bug.cgi?id=782228
2017-05-09 09:02:07 +02:00
Edward Hervey
6772981668 adaptivedemux: Allow live seeking range to go back to "now"
The allowed live seek ranges returned by subclasses are "inclusive", that is
to say that the "range_stop" value they return is the highest acceptable position
one can seek to (i.e. "now").

Allow seeking to exactly that value
2017-05-05 18:28:33 +02:00
Haihua Hu
beab384557 glupload: passthrough composition caps features in directviv upload
https://bugzilla.gnome.org/show_bug.cgi?id=782046
2017-05-02 14:18:43 +03:00
Tim-Philipp Müller
142469ab91 tests: fix link problem on centos7
And put LIBS before -lgstfoo in adaptivedemux Makefile.am
2017-04-27 21:33:25 +01:00
Matthew Waters
0886160123 adaptivedemux: separate manifest update task from download tasks
Rationale is to allow the manifest update task to continue running while
seeks are occurring.  Otherwise, if the user reliably performs a seek
before the manifest is updated, then as the manifest task is reset on
seeks (and thus the time to wait between manifest updates), the manifest
would never be updated.

This fix makes the manifest update task free-running and continously
update even during seeks.
2017-04-25 14:16:15 +10:00
Edward Hervey
e00be27585 adaptivedemux: Don't hold locks when pushing FLUSH_START
Some actions (Qos, reconfigure, ...) might take place before we finish pushing out flush_start.

One problem would be that:
1) The QOS handling in adaptivedemux takes the MANIFEST LOCK
  That QOS event comes from basesink with its PREROLL_LOCK taken
2) FLUSH_START is sent from adaptivedemux with the MANIFEST_LOCK taken and the basesink flushing handler needs to take the PREROLL_LOCK

 => deadlock

https://bugzilla.gnome.org/show_bug.cgi?id=781320
2017-04-15 08:18:39 +02:00
Edward Hervey
44ec6bb2f3 adaptivedemux: Fix segment creation/adaptation some more
Take into account the segment stop and the negative rates

https://bugzilla.gnome.org/show_bug.cgi?id=781267
2017-04-14 08:02:29 +02:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Thibault Saunier
a49c114d4e docs: Stop linking to inexistant symbols 2017-04-12 12:07:51 -03:00
Thibault Saunier
4f9328a514 aggregator: Make instance var name match between .c and .h
Making GI happy
2017-04-12 12:07:26 -03:00
Claudio Saavedra
61ba3f1986 meson: add missing gstglrenderbuffer.h header
https://bugzilla.gnome.org/show_bug.cgi?id=781179
2017-04-11 16:54:04 +03:00
Scott D Phillips
fc0c7d664d meson: gl: set default value of 0 for glconf vars
meson's configure_file emits only a comment like /* #undef ... */
for values which are unset in the configuration_data. For
gstglconfig.h, this differs from the autotools build where the
preprocessor definitions are always either 0 or 1. So loop over a
list of variables to set to zero as default.

Also sync up the gstglconfig.h.meson file with the additional
macros defined by the autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=781043
2017-04-09 11:20:43 +03:00
Vincent Penquerc'h
cd78fc58ec gstaggregator: fix event use after free
https://bugzilla.gnome.org/show_bug.cgi?id=781017
2017-04-09 11:17:19 +03:00
Vincent Penquerc'h
3fd5608e21 glcontext: fix display leak
https://bugzilla.gnome.org/show_bug.cgi?id=781019
2017-04-09 11:16:56 +03:00
Vincent Penquerc'h
884e4b7810 gldisplay: fix list leak
Windows aren't always removed in time, and it turns out to be
very, very hard to remove a window in a way that's not racy and
not deadlocky. Since the window itself doesn't leak, freeing
the list on object destruction is enough.

https://bugzilla.gnome.org/show_bug.cgi?id=781018
2017-04-09 11:16:48 +03:00
Vincent Penquerc'h
9eab67a4af mpegts: fix invalid memory access in language descriptor
Also add a couple sanity asserts/returns

https://bugzilla.gnome.org/show_bug.cgi?id=781024
2017-04-09 11:16:37 +03:00
Seungha Yang
ea588ae0e0 adaptivedemux: Retry downloading a fragment immediately if any in live streaming
At the moment that demux is waiting manifest update, the target sequence
of fragment was advanced already. So, checking stream_has_next_fragment()
means looking for the next fragment of target fragment.
This might cause unexpected buffering if each fragment has
large duration and manifest is listing only limited number of fragments.

https://bugzilla.gnome.org/show_bug.cgi?id=780494
2017-04-09 10:56:32 +03:00
Jan Schmidt
b8f37d1074 gl: Remove duplicate typedef of GstGLFramebufferClass
The GstGLFramebufferClass struct is typedeffed in
gstgl_fwd.h, and having a duplicate elsewhere is
breaking the cerbero build on my OSX machine,
even though it seems to be working in CI.
2017-04-08 21:28:58 +10:00
Mathieu Duponchelle
4d63aee36c videoaggregator: Do not mix the same buffer twice when EOS.
When entering this code path, we know that:

We received EOS on this pad.
We consumed all its buffers.

In any case, we want to replace vaggpad->buffer with NULL,
otherwise we will end up mixing the same buffer twice.

https://bugzilla.gnome.org/show_bug.cgi?id=781037
2017-04-07 18:55:54 +02:00
Matthew Waters
e212753094 adaptivedemux: add some reasons on warning reporting 2017-04-07 16:39:09 +10:00
Sebastian Dröge
58370ed6cf uridownloader: Use a GWeakRef to the parent to prevent a reference cycle
https://bugzilla.gnome.org/show_bug.cgi?id=780140
2017-04-03 11:35:51 +03:00
Thiago Santos
45a6449e64 adaptivedemux: set uridownloader's parent
Allows internal http source to request contexts and share cookies
with the pipeline in case the server imposes any restriction based
on cookies.
2017-04-03 11:35:51 +03:00
Thiago Santos
8cf858fb27 uridownloader: add new gst_uri_downloader_set_parent
If set, the parent is used to proxy need-context messages from
uridownloader's http source in order to get cookies/headers
from the pipeline.

Based on a patch from Philippe Normand

https://bugzilla.gnome.org/show_bug.cgi?id=726314
2017-04-03 11:35:51 +03:00
Josep Torra
1456c65295 glwindow/cocoa: fix warnings reported by XCode 8.1.0
gstglwindow_cocoa.m:345:16: error: unused variable 'window' [-Werror,-Wunused-variable]
  GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
               ^
gstglwindow_cocoa.m:445:11: error: unused variable 'external_view' [-Werror,-Wunused-variable]
  NSView *external_view = (__bridge NSView *)priv->external_view;
          ^
2017-04-01 16:49:15 +02:00
Nicolas Dufresne
0c4eb22a7d gldisplay: Fix assert caused by missing debug category 2017-03-29 23:45:21 -04:00
Jan Schmidt
a3b61c8ab8 adaptivedemux: Don't send EOS on pads when there's a pending switch
When there are new pads pending for a bitrate switch, don't allow
EOS through from the old streams. It will be sent when the new pads are
ready, just before the old streams are removed.

This fixes racy bitrate switching with hlsdemux in urisourcebin
where old pads EOS before new pads appear and the entire pipeline can
EOS if those propagate fast enough
2017-03-23 00:51:52 +11:00
Seungha Yang
e25da85a65 player: Make use of GstStreams API with playbin3
Allow use of playbin3 and GstStreams API by setting
the environment variable "GST_PLAYER_USE_PLAYBIN3"

https://bugzilla.gnome.org/show_bug.cgi?id=775487
2017-03-22 15:17:30 +02:00
Scott D Phillips
8408c01e7d build: declare dependency from gl on allocators
libgstgl has a dependency on libgstallocators starting with:

 ed1e4c1 glupload: Add support for Vivante DirectTexture uploads

The dependency wasn't stated in the Makefile, so the build could
occasionally fail if you got unlucky with the ordering of build
steps.

https://bugzilla.gnome.org/show_bug.cgi?id=780330
2017-03-21 12:05:14 +11:00
Scott D Phillips
1586357a2f gl/format: correct return enums in gst_gl_format_from_video_info
In commit

> 956c4d0 gl/format: use our own GL format enum's instead of gstvideo's

the name and return type of gst_gl_format_from_video_info changed,
but some returns of the old type were missed. Here they are
updated to the correct type.

https://bugzilla.gnome.org/show_bug.cgi?id=780064
2017-03-15 14:32:14 +11:00
George Kiagiadakis
20d4aca0d4 glupload: adjust memory offset calculation for dmabuf buffers
The data in the dmabuf fd may not start from byte 0, therefore
we need to inform EGL about this additional offset.

https://bugzilla.gnome.org/show_bug.cgi?id=779790
2017-03-14 17:07:40 +02:00
Matthew Waters
fd8d35298f Revert "adaptivedemux: answer duration queries for live streams"
Completely disabling duration reporting with live streams is not cool.

This reverts commit e1b68d9a65.

https://bugzilla.gnome.org/show_bug.cgi?id=753879
2017-03-14 16:50:30 +11:00
Matthew Waters
efc015f27d gl: GL_ARRAY_BUFFER is not a part of VAO state
As a result we need to bind it on every draw in order to have the
correct state in the GL state machine.
2017-03-14 14:15:00 +11:00
Matthew Waters
956c4d0bde gl/format: use our own GL format enum's instead of gstvideo's
They can describe in more detail (such as component sizes) the requested format.
2017-03-13 21:10:58 +11:00
Vincent Penquerc'h
04f8c7d729 glupload: fix GValue leak
https://bugzilla.gnome.org/show_bug.cgi?id=779869
2017-03-13 09:27:41 +00:00
Haihua Hu
79be2e8b7b player: Fix setting of external subtitle URI
gst_player_set_uri_internal shouldn't free suburi which maybe set
by user to load external subtitle before start play. It just need
reset playbin's subutri property to NULL no matter if there was a
previous one or not.

https://bugzilla.gnome.org/show_bug.cgi?id=779453
2017-03-09 10:31:45 +02:00
Sebastian Dröge
2392ac7446 gl/eagl: It's -fobjc-arc not -fobj-arc 2017-03-08 15:13:45 +02:00
Nick Kallen
46bbc60d24 applemedia/gl: Update code to use ARC
All code interacting with Objective-C objects should now use Automated
Reference Counting rather than manual memory management or Garbage
Collection. Because ARC prohibits C-structs from containing
references to Objective-C objects, all such fields are now typed
'gpointer'. Setting and gettings Objective-C fields on such a
struct now uses explicit __bridge_* calls to tell ARC about
object lifetimes.

https://bugzilla.gnome.org/show_bug.cgi?id=777847
2017-03-07 13:37:07 +02:00
George Kiagiadakis
08c52c931e videoaggregator: redo src caps negotiation if a sink pad's caps have changed in the meantime
https://bugzilla.gnome.org/show_bug.cgi?id=755782
2017-03-06 17:20:56 +02:00
Arun Raghavan
b7065f5f8e gl: Missed one backwards compat define in GST_GL_TYPE_CONTEXT
Continued from 296b4251e3
2017-03-06 17:52:31 +05:30
Sebastian Dröge
be1eeba67d gl: Fixup for last commit 2017-03-04 11:47:04 +02:00
Sebastian Dröge
296b4251e3 gl: Fix backwards compat GST_GL_TYPE_* functions/macros
These have to be macros instead of inline function as they must behave
more or less like an integer literal, i.e. include the function call.
2017-03-04 11:17:35 +02:00
Sebastian Dröge
a0199d17a1 gl/viv-fb: Don't use deprecated symbols and make macros more consistent
https://bugzilla.gnome.org/show_bug.cgi?id=778825
2017-03-04 11:17:35 +02:00
Alex Ashley
e1b68d9a65 adaptivedemux: answer duration queries for live streams
For duration queries on live streams, adaptivedemux ignores the query.
The problem then is that the query is answered by the downstream
qtdemux element, with the duration of the currently passing fragment.

This commit changes the behaviour of adaptivedemux to answer the duration
queries for live streams, returning GST_CLOCK_TIME_NONE.

    https://bugzilla.gnome.org/show_bug.cgi?id=753879
2017-03-02 19:54:04 +02:00
Thomas Bluemel
8d10d29c24 adaptivemutex: Fix double mutex unlock
https://bugzilla.gnome.org/show_bug.cgi?id=779480
2017-03-02 19:02:32 +02:00
Sebastian Dröge
fef775d703 glcolorconvert: Check return value of gst_gl_context_check_framebuffer_status()
CID 1401588
2017-02-28 12:34:30 +02:00
Sebastian Dröge
9bd30e0277 gl: Add viv-fb to DIST_SUBDIRS to fix "make distcheck" 2017-02-28 12:31:54 +02:00
Sebastian Dröge
c9b5bee53d glutils: Mark private functions as G_GNUC_INTERNAL 2017-02-28 10:55:10 +02:00
Sebastian Dröge
ed1e4c16fb glupload: Add support for Vivante DirectTexture uploads
Together with the upcoming gstreamer-imx patch, this allows zerocopy
between imxvpudec and other elements and glimagesink.

This is losely based on a patch by Haihua Hu <b55597@freescale.com>
from https://github.com/Freescale/meta-freescale/blob/master/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/

https://bugzilla.gnome.org/show_bug.cgi?id=779067
2017-02-27 10:42:05 +02:00
Sebastian Dröge
5cdf3a3976 allocators: Add GstPhysMemoryAllocator abstraction
This can be used in a generic way as common interface by all platforms that,
in one way or another, pass around physical memory addresses.

https://bugzilla.gnome.org/show_bug.cgi?id=779067
2017-02-27 10:42:05 +02:00
Sebastian Dröge
e9327d4928 gl: Add support for Vivante EGL FB windowing system
This is very similar to how dispmanx on the Raspberry Pi works.

Based on a patch by Haihua Hu <b55597@freescale.com> from
https://github.com/Freescale/meta-freescale/tree/master/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad

https://bugzilla.gnome.org/show_bug.cgi?id=778825
2017-02-27 10:42:05 +02:00
Sebastian Dröge
bfdbdb7eb6 glmemory: Use glBlitFramebuffer() instead of glCopyTexImage2D() if available
glBlitFramebuffer() is new GLES3/GL3 API. They are probably often
implemented in terms of each other, and glBlitFramebuffer() can
potentially be implemented more flexible. Let's use it if available.

Also it actually works on imx6 with DirectVIV textures.

Based on a patch by Haihua Hu <jared.hu@nxp.com> from
https://github.com/Freescale/meta-freescale/blob/master/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/

https://bugzilla.gnome.org/show_bug.cgi?id=779070
2017-02-23 21:57:33 +02:00
Sebastian Dröge
0c902ff249 configure: Remove unused Mali EGL/fbdev_window support
This existed a long time ago but there's no actual code for this
anymore.
2017-02-16 20:09:40 +02:00
Jan Schmidt
dc56472777 adaptivedemux: Convert premature EOS on non-exposed pads to ERROR
If we need to send EOS on a pad that hasn't prerolled, generate
an error on the bus instead, otherwise the app will have no idea.

Fixes the HLS testFragmentNotFound test, which is waiting
for either EOS or an error.
2017-02-09 10:50:26 +11:00
Jan Schmidt
69d2f80954 adaptivedemux: Handle errors from prepared_streams too
Check both active and prepared_streams when we receive an
error on the bus, so we post errors for streams that are
still pre-rolling
2017-02-09 10:50:22 +11:00
Jan Schmidt
1f2bc4a684 adaptivedemux: Fix bitrate printed in debug
The download bitrate is already in bits per second,
no need to multiply it by 8 again when printing it
for debug.
2017-02-07 23:53:30 +11:00
Jan Schmidt
b2113f69c6 adaptivedemux: Preroll streams before exposing them
To ensure that pads have caps when they are exposed, do
the exposing when all pending streams have prerolled an
output buffer, and only then EOS and remove any old pads.

Improves the switching sequence by making caps available
as soon as a pad appears.

With fixes from Seungha Yang <sh.yang@lge.com>

https://bugzilla.gnome.org/show_bug.cgi?id=758257
2017-02-07 23:53:30 +11:00
Seungha Yang
780c57d6bb adaptivedemux: Handle SEEK event only once
send_event() of parent class (i.e., GstBinClass) iterates srcpads
to send SEEK event. And performing it per srcpad is inefficient.
So, let's drop duplicated SEEK event by checking seqnum

https://bugzilla.gnome.org/show_bug.cgi?id=776612
2017-01-31 13:26:08 +02:00
Thibault Saunier
cea4346d84 meson: Build GIR files 2017-01-23 12:48:53 -03:00
Lyon Wang
b22fec8293 player: Add support for selecting a specific video sink
- Add overlay video renderer "video-sink" property, so that can be set
- In create_video_sink, it returns video sink instead of always NULL
- Add new renderer_new_with_sink() API to set video sink

https://bugzilla.gnome.org/show_bug.cgi?id=776490
2017-01-17 13:14:59 +02:00
Sebastian Dröge
9bd99d3670 player: Add missing documentation for deprecated functions 2017-01-17 13:09:55 +02:00
Lyon Wang
2609aaa48b player: Add get video snapshot API
Add get video snapshot API:
  gst_player_get_video_snapshot()

https://bugzilla.gnome.org/show_bug.cgi?id=773709
2017-01-17 13:09:55 +02:00
Matthew Waters
03b539bdfc gl: update sys dependants for function removals
4315a4b54d forgot to change the androidmedia/videotoolbox/caopengllayer
sources as required.
2017-01-13 13:01:28 +11:00
Juan Pablo Ugarte
fb5339a387 glslstage: define GL constants if needed instead of using #ifdef
https://bugzilla.gnome.org/show_bug.cgi?id=777144
2017-01-13 11:20:51 +11:00
Matthew Waters
6919b4ca66 glutils: document functions 2017-01-13 11:20:51 +11:00
Matthew Waters
4de388278a glutils: privatise matrix multiplication/videoaffinetransformation retrieval 2017-01-13 11:20:51 +11:00
Matthew Waters
4315a4b54d gl/utils: also take care of the local GL context in query functions
Simplifies a deduplicates a lot of code in elements retrieving/setting
the local OpenGL context.
2017-01-13 11:20:51 +11:00