Commit graph

296 commits

Author SHA1 Message Date
Jan Schmidt
1316dd9c65 splitmuxsink: Never start a new fragment with no reference buffers
If there has been no bytes from the reference stream muxed into
the current fragment, then time can't have advanced, there's no
GOP... this fragment would be broken or empty, so wait for some
data on the reference buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/798>
2020-10-31 02:50:50 +00:00
Olivier Crête
c79a520946 splitmuxsrc: Implement segment query
Fixes #239

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/713>
2020-09-18 10:54:23 -04:00
Mathieu Duponchelle
19860200ed splitmuxsink: fix sink pad release while PLAYING
- Release the split mux lock while removing the probes

- Flush the sinkpad to unblock other pads

- Turn check_completed_gop into a do while statement, when
  waking up we want to recheck whether the current GOP is
  ready for sending

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/719>
2020-09-09 19:03:12 +02:00
Jan Alexander Steffens (heftig)
28a616f693 splitmuxsink: Make sure flushing doesn't block
* Trying to disconnect a stream from a running splitmuxsink by flushing
  it results in the FLUSH_START blocking in the stream queue's
  gst_pad_pause_task because the flush did not unblock
  complete_or_wait_on_out, so add a check for ctx->flushing there.

* Add a GST_SPLITMUX_BROADCAST_INPUT so check_completed_gop notices
  flushing changed and the incoming push is unblocked.

* Pass the FLUSH_STOP along to the muxer without waiting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/687>
2020-08-04 15:15:27 +00:00
Tim-Philipp Müller
4f555ecf8e splitmuxsink: flesh out docs for format-location* signals
Make explicit that the returned strings need to be g_free()-able.

Fixes #753

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/652>
2020-06-26 18:31:10 +00:00
Sebastian Dröge
13331e051f splitmuxsink: Add new properties for setting muxer/sink presets
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/644>
2020-06-25 17:53:00 +03:00
Mathieu Duponchelle
f63299ff2f plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:42:25 +02:00
Mathieu Duponchelle
37c619f995 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-03 22:44:09 -04:00
Edward Hervey
cfb9a5d53a slitmuxsrc: Properly stop the loop if not part reader is present
Previously this would end up in a refcounting loop of hell.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/578>
2020-05-05 15:32:58 +02:00
Seungha Yang
ca48f5265e splitmuxsink: Enhancement for timecode based split
The calculated threshold for timecode might be varying depending on
"max-size-timecode" and framerate.
For instance, with framerate 29.97 (30000/1001) and
"max-size-timecode=00:02:00;02", every fragment will have identical
number of frames 3598. However, when "max-size-timecode=00:02:00;00",
calculated next keyframe via gst_video_time_code_add_interval()
can be different per fragment, but this is the nature of timecode.
To compensate such timecode drift, we should keep track of expected
timecode of next fragment based on observed timecode.
2020-04-20 21:39:49 +09:00
Seungha Yang
fe73c3b0f3 splitmuxsink: Post error when requested timecode interval is invalid
In case we cannot rely on max-size-timecode for split decision,
post error instead of crashing
2020-04-19 20:23:32 +09:00
Sebastian Dröge
d75ea5b340 splitmuxsink: Do split-at-running-time splitting based on the time of the start of the GOP
If the start of the GOP is >= the requested running time, put it into a
new fragment. That is, split-at-running-time would always ensure that a
split happens as early as possible after the given running time.

Previously it was comparing against the current incoming timestamp,
which does not tell us what we actually want to know as it has no direct
relation to the GOP start/end.
2020-04-15 17:52:41 +03:00
Sebastian Dröge
0ab0f92cac splitmuxsink: Fix off-by-one in running time comparison for split-at-running-time
If we get a keyframe exactly at the requested running time we would only
split on the next keyframe afterwards due to wrong usage of > vs. >=.
2020-04-15 13:33:17 +03:00
Seungha Yang
599066726f splitmuxsink: Don't send too many force key unit event
splitmuxsink should requst keyframe depending on configured
threshold and previously requested time in order to avoid too many
keyframe request.
2020-04-03 15:00:37 +09:00
Jan Schmidt
00a08c69ac splitmuxsrc: Fix some deadlock conditions and a crash
When switching the splitmuxsrc state back to NULL quickly, it
can encounter deadlocks shutting down the part readers that
are still starting up, or encounter a crash if the splitmuxsrc
cleaned up the parts before the async callback could run.

Taking the state lock to post async-start / async-done messages can
deadlock if the state change function is trying to shut down the
element, so use some finer grained locks for that.
2020-03-26 14:44:54 -04:00
Seungha Yang
a40eacabb4 splitmuxsink: Split fragment only if queued time is larger than threshold
The queued time includes the duration of the last queued frame
(i.e., new keyframe) so the condition check should not be inclusive.
Note that the new fragment will be cut excluding the last frame
and therefore if the condition is inclusive way,
the fragment might have one frame shorter duration for all keyframe
stream such as jpeg or all-inter video streams.
2020-03-25 13:22:31 +00:00
Seungha Yang
6256fc67e4 splitmuxsink: Don't need to trace next timecode for split decision
Since the commit 94bb76b6b9, splitmuxsink
will split fragments based on queued time and the threshold of that.
So don't need to store the next timecode for split decision.
2020-03-25 13:22:31 +00:00
Seungha Yang
0acd5d9f8b splitmuxsink: Mark some split decision related properties as MUTABLE_READY
The change of various criteria for split decision while muxing is on progress
wouldn't work well as expected.
2020-03-24 22:09:48 +09:00
Seungha Yang
94bb76b6b9 splitmuxsink: Take account queued time and max-size-timecode for split decision
Not only the requested keyframe time, the queued size should be
a criterion for the split decision of timecode based mode
(same as max-size-time based split case).
2020-03-24 22:04:21 +09:00
Jan Schmidt
c5181c23a4 splitmuxsink: Reset cleanly for reuse
Reset the splitmuxsink completely when changing states so that
it can be reused.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1241
2020-03-19 15:37:14 +00:00
Seungha Yang
18e09de0a2 splitmuxsink: Decouple keyframe request and the decision for fragmentation
Split the decision for keyframe request and fragmentation in order to
ensure periodic keyframe request.
2020-03-19 10:17:21 +00:00
Thibault Saunier
21bc0d527b imagesequencesrc: Cleanup and add some features
* Implement the GstURIHandlerInterface
* Rework the locking
* Implement backward seeking handling
* Generate documentation
2020-03-11 15:11:54 +00:00
Fabian Orccon
7511999083 Add an imagesequencesrc element to stream sequence of images
See: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/121
2020-03-11 15:11:54 +00:00
Jan Schmidt
f490c38416 splitmux: Avoid negative DTS
In order to concatenate fragments, splitmuxsrc offsets
the start of each fragment PTS to 0 to align it with the
previous file. This means that DTS can go negative for
the first fragment, with really bad results.

Add a fixed offset to outgoing timestamp ranges to
avoid that.
2020-03-04 05:42:21 +00:00
Sebastian Dröge
f6e383b749 splitmuxsink: Include actual sink element in the fragment-opened/closed messages
If not configuring the sinks via the "location" property this can be
useful to know for which sink the fragment was actually opened/closed,
especially if finalization of the fragments is happening asynchronously.
2020-01-29 13:30:00 +00:00
Sebastian Dröge
eb0b676fae splitmuxsink: Check the correct sink class for the existence of the "location" property 2020-01-27 15:53:40 +02:00
Seungha Yang
8445685a21 splitmuxsink: Fix assertion failure on set_property()
GValue might have null object.

(gst-inspect-1.0:10304): GStreamer-CRITICAL ...
    gst_object_ref_sink: assertion 'object != NULL' failed
2020-01-07 01:24:01 +09:00
Sebastian Dröge
9f6ed9ec72 splitmuxsink: Increment fragment_id even if no fragment location was provided
Applications might handle locations and generally configuration of the
sink by themselves instead of having splitmuxsink set the location on
the sink. Nonetheless it makes sense to increment the fragment_id that
is passed to the signal so that applications know which fragment is
requested.
2019-12-13 22:59:55 +00:00
Stéphane Cerveau
b44d37a338 splitmuxsink: provides a start-index property
Allow to change the fragment-id start index.
2019-12-05 14:58:40 +00:00
Seungha Yang
a441779d39 splitmuxsink: Don't take lock during posting message
An application might try to access splitmuxsink from sync message handler
by g_object_{get,set} which takes lock also. In general, we don't
take lock around message handler.
2019-11-18 00:08:36 +00:00
Stéphane Cerveau
9dc1a32d5a splitmuxsink: add fakesink support
fakesink does not support "location" property and was generating
a warning.
2019-11-07 12:28:58 +01:00
Tim-Philipp Müller
c9a47c0c8d Remove autotools build system 2019-10-14 11:04:18 +01:00
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Jan Schmidt
31be44c47f splitmux: Add muxer-pad-map property
Add a property which explicitly maps splitmuxsink pads to the
muxer pads they should connect to, overriding the implicit logic
that tries to match pads but yields arbitrary names.
2019-09-06 12:38:56 +00:00
Jan Schmidt
8ec695e55d splitmuxsink: In async mode, retain previous muxer pad names.
When running in async-finalize mode, request new pads from the muxer
using the same names as old pads, instead of letting the muxer assign
new ones based on the pad template name.
2019-09-06 12:38:56 +00:00
Jan Schmidt
83ef7a6d1c splitmuxsink: Mark split-* signals as action signals. Doc fixes.
Add the G_SIGNAL_ACTION flag to the split-* signals on splitmuxsink,
and make some improvements to their docstrings
2019-09-06 12:38:56 +00:00
Jan Schmidt
436d33b288 splitmuxsink: add the ability to mux auxilliary video streams
The primary video stream is used to select fragment cut points
at keyframe boundaries. Auxilliary video streams may be
broken up at any packet - so fragments may not start with a keyframe
for those streams.
2019-07-15 11:46:36 +00:00
Jan Schmidt
b5d8484b0b splitmuxsrc: Add video_%d pad template.
splitmuxsrc actually supports multiple video pads. Make that clear,
especially since it was already creating pads named "video_0" etc.
2019-07-15 11:46:36 +00:00
Thibault Saunier
ac55681bbf docs: Fix link to strings
We can't link to #gchar* this way.
2019-06-14 17:34:43 -04:00
Mathieu Duponchelle
ddbbe5d277 splitmuxsink: set the same seqnum on flush_start / flush_stop
It's currently not made mandatory by aggregator, but it might
eventually be, and is more consistent behaviour

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/977
2019-06-13 16:44:47 +02:00
Jan Schmidt
f6b91fe303 splitmuxsrc: Protect initial pad configuration with the object lock
gst_splitmux_src_activate_part() configures the pad information
before starting the pad task, but occasionally the changes it makes
to the pad are not seen in the pad task because they're not
protected by the right locking. Use the pad's object lock to
protect those variables.
2019-06-12 02:46:48 +10:00
Jan Schmidt
715c6896a2 splitmuxsrc: Restart pad task on a reconfigure
On a reconfigure event, restart streaming on the pad so
that switching tracks in playbin works cleanly
2019-06-12 02:46:48 +10:00
Jan Schmidt
86c131b668 splitmuxsrc: Use an RW lock instead of a mutex to protect the pad list
Fix a deadlock around the pads list by using an RW lock to
allow simultaneous readers. The pad list doesn't really changes
except at startup and shutdown.
2019-06-12 02:46:48 +10:00
Jan Schmidt
26d6532702 splitmuxsrc: Ignore duplicate seeks
Use the seqnum to ignore duplicated seek events.
2019-06-12 02:46:41 +10:00
Jan Schmidt
18a7c10d4e splitmuxsink: Improve debug output
Make the debug output less confusing by not mentioning a src
pad when doing calculations on the sink pad side.

Improve debug around why a GOP is considered overflowing a fragment
2019-06-06 10:55:42 +10:00
Jan Schmidt
5ae55a4633 splitmuxsink: Give internal queues useful names
Makes debug output more useful
2019-06-06 10:55:42 +10:00
Sebastian Dröge
32c465a537 splitmuxsink: Only set running time on finalizing sink element when in async-finalize mode
There is only a single sink element in async-finalize mode, and we would
keep the running time from previous fragments set in that case. As we
don't ever set the running time for the very last fragment on EOS, this
would mean that the closing time reported for the very last fragment is
the same as the closing time of the previous fragment.
2019-05-28 17:21:06 +03:00
Mathieu Duponchelle
d704790519 doc: fix element section documentations
Element sections were not rendered anymore after the hotdoc
port, fixing this revealed a few incorrect links.
2019-05-25 16:57:31 +02:00
Seungha Yang
d2cac61113 multifilesink: Fix documentation of max-file-duration property
The max-file-duration property works with max-duration mode
2019-05-22 11:03:34 +09:00
Thibault Saunier
af01988534 doc: Port documentation to hotdoc 2019-05-13 11:34:56 -04:00