Commit graph

22425 commits

Author SHA1 Message Date
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 c0849df4ac tests: Test caps using query
Sending an event can accepted event if the caps were rejected
because the event could be queued and processed later.

Also send a drain query in the caps test to make sure that the
event has been processed.

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
Tim-Philipp Müller 918ad83e46 meson: add options to set package name and origin
https://bugzilla.gnome.org/show_bug.cgi?id=782172
2017-05-20 15:04:45 +01:00
Josep Torra 2c9b513695 examples: fix macOS 9.12 deprecation warnings
Add #defines to allow older versions of macOS to use the new constant names.
2017-05-20 12:41:51 +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
Sebastian Dröge be465a139b dashdemux: Use correct (sub) fragment start when clipping chunk size
If we didn't download anything yet, we shouldn't use fragment.start but
the start position of the current sidx entry.
2017-05-18 19:04:57 +02:00
Sebastian Dröge d5eee31918 dashdemux: Make sure to pass the next buffer after a seek with DISCONT flag
When we manually seek for skipping ahead in keyunit-only trickmode, we
have to enforce that ourselves as adaptivedemux does not know about the
seeks.
2017-05-18 19:04:57 +02:00
Sebastian Dröge d884ec2904 dashdemux: Ensure that we never ever download over the current SIDX entry
Even if downloading more than needed to try to get the moof and first
keyframe both together.
2017-05-18 19:04:57 +02:00
Sebastian Dröge 71259d9ad4 dashdemux: Take SIDX entry timestamp/duration into account for keyunit-only mode
And not the whole segment's timestamp/duration
2017-05-18 19:04:57 +02:00
Sebastian Dröge c3fd905f11 dashdemux: Reset parsing state correctly in various places 2017-05-18 19:04:57 +02:00
Sebastian Dröge 927c158303 dashdemux: Reset previous target_time when seeking 2017-05-18 19:04:57 +02:00
Sebastian Dröge e2a6573c7d dashdemux: Smooth out skip distances in keyframe-only trick modes
This ensures smoother playback. It looks weird if we first do a big
jump, then play a couple of consecutive frames, just to again skip ahead
quite a bit because we ran late again.
2017-05-18 19:04:57 +02:00
Sebastian Dröge ddef518701 dashdemux: Take configure max bitrate/framerate into account for keyframe skipping
And by default only produce up to 10 fps.
2017-05-18 19:04:57 +02:00
Sebastian Dröge 6a037a78de dashdemux: Try harder to not run into a loop over the same fragment over and over
While still making sure to not jump ahead one fragment further than
needed.
2017-05-18 19:04:57 +02:00
Sebastian Dröge ef8f194855 dashdemux: Add some debug output to the target time selection 2017-05-18 19:04:57 +02:00
Sebastian Dröge 6b6c7382c3 dashdemux: Use the current clock running time in addition to the QoS earliest time 2017-05-18 19:04:57 +02:00
Sebastian Dröge 133d1e86bd dashdemux: Download keyframes from the current position if we're far enough ahead
Far enough here means more than 500ms or 4 times the average keyframe
download time. There is no need to jump ahead by one average keyframe
download time in this case.

This makes playback smooth if the network is fast enough.
2017-05-18 19:04:57 +02:00
Sebastian Dröge 4efa3185bb dashdemux: Fix sync sample selection based on target time in reverse playback mode 2017-05-18 19:04:57 +02:00
Sebastian Dröge b3e2657ac1 dashdemux: Snap-seek for skipping ahead and use actual keyframe distance in the current fragment if applicable 2017-05-18 19:04:57 +02:00
Sebastian Dröge b7f87e2518 dashdemux: Don't adjust for fragment duration twice when seeking ahead in KEYUNITS mode 2017-05-18 19:04:57 +02:00
Sebastian Dröge 5d09bc04a2 dashdemux: Add current fragment duration in reverse playback mode to the position
We play from the end of the fragment to the beginning, not from the
beginning backwards.
2017-05-18 19:04:57 +02:00
Sebastian Dröge 9267b4a725 dashdemux: Never take more than the current fragment duration for estimations inside the fragment
Taking the average might give us from results.
2017-05-18 19:04:57 +02:00
Sebastian Dröge df420cc21f dashdemux: Don't increase current position if we just downloaded the moof in KEYUNIT mode 2017-05-18 19:04:57 +02:00
Edward Hervey 245d73e516 dashdemux: Improve key-unit trick mode downloading
When dealing with key-unit trick mode downloads, the goal is to
provide the best "Quality of Experience". This is achieved by:
1) maximizing the number of frames displayed per second
2) avoiding "stalling" as much as possible (i.e. not downloading and
  decoding frames fast enough)

This implementation achives this by:
1) Knowing very precisely the current keyframe being download (i.e
  more accurate than at the fragment level which might contain more
  than one keyfram). This is the new "actual_position" variable
  introduced by this commit
2) Knowing the position of downstream (provided by QoS and stored
  in the adaptivedemuxstream qos_earliest_time variable)
3) Knowing how long it takes to request and fully download a keyframe
  (the average_download_time variable)

Taking those 3 variables into account, whenever a keyframe has been
pushed downstream we calculate a "target time" (target_time variable)
which is the ideal next keyframe time to request so that:
1) It will be requested/downloaded/demuxed/decoded in time to be
  displayed without being too late
2) It will not be too far ahead that it would cause too few frames
  per second to be displayed.

How far ahead we will request is inversily proportional to how close
the actual position (actual_position) is from the downstream
position (qos_earliest_time). The more is buffered between the source
and the sink, the "closer" the target time will be, and therefore
the more frames per seconds will be displayed (up to the limit
of keyframes_per_second * absolute_rate).
2017-05-18 19:04:57 +02:00
Edward Hervey 04224ad440 dashdemux: Store average download time
This will be used to bound the download rate when working in
keyframe-only trick mode
2017-05-18 19:04:57 +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
Sebastian Dröge 2379dc3f5b dashdemux: Collect keyunit distance and size statistics 2017-05-18 19:04:57 +02:00
Edward Hervey d8d1fc8bc4 dashdemux: Disable bitrate switching in key-unit trick mode
This creates too much havoc for now
2017-05-18 19:04:57 +02:00
Edward Hervey 8f400c1343 dashdemux: Use new adaptivedemux trickmode macro
Reduces the lines of code, and makes it a bit more readable
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
Jan Schmidt 47abc9a09c uvch264src: Apply timestamps to outgoing aux buffers
When extracting an aux buffer from an MJPG carrier, at
*least* put the original timestamp on it, even if we
fail to apply any other timestamp (which we always do
at the moment, because the timestamp calculating code
was never finished). Apply a DTS using the camera
supplied delay value as well, assuming that there's
no re-ordering going on (there isn't in the C920,
which is really the only extant camera doing this
stuff) and a warning if that turns out not to be true.
2017-05-18 17:49:46 +02:00
Simon Himmelbauer 67980f27ce qt: Use GST_GL_HAVE_PLATFORM_CGL instead of GST_GL_HAVE_PLATFORM_COCOA
The latter is not used/available anymore since years. Also fix a typo
in the include path for the Cocoa GL display header.
2017-05-18 15:24:13 +03:00
Dmitry Zhadinets f0a75cf029 motioncells: delay motionmaskcoords until caps arrive
motionmaskcoords is not applied on start because the information
about resolution isn't available until caps arrive.

https://bugzilla.gnome.org/show_bug.cgi?id=768666
2017-05-18 13:37:03 +02:00
Sebastian Dröge 732012a78e amcvideodec: Unref downstream caps after usage
https://bugzilla.gnome.org/show_bug.cgi?id=782771
2017-05-18 14:34:46 +03:00
Tim-Philipp Müller 80d66dfec8 Fix up package name and origin in some plugins 2017-05-18 10:58:20 +01:00
Tim-Philipp Müller 2ced01cc9f stereo: fix typo in plugin description 2017-05-18 10:53:48 +01:00
Sebastian Dröge eb1f1ff0a5 h265parse: Fix calculation of codec_data buffer size 2017-05-18 11:43:03 +03:00