Commit graph

310 commits

Author SHA1 Message Date
Jan Schmidt
9499976fbb splitmuxsink: Fix some reference leaks in error cases.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1023>
2021-07-26 17:56:42 +10:00
Jan Schmidt
b50d3b9c9f splitmuxsink: Prevent hang going back to NULL after failures
Prevent a condition where splitmuxsink won't go back to NULL state
after a child element fails to change state by making sure that
a READY->READY state change doesn't fail, and by returning
GST_FLOW_ERROR or GST_FLOW_FLUSHING upstream to shut down streaming
as quickly as possible.

This can happen after (for example) setting an invalid filename
on the sink element. In that case, the READY->PAUSED transition
fails, but with internal elements still in the NULL state. Trying
to set splitmuxsink back to NULL then ends up trying to bring
those NULL elements up to READY with a READY->READY transition,
(which fails, prevent splitmuxsink from getting to NULL)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1023>
2021-07-26 16:22:23 +10:00
Mathieu Duponchelle
a6d6e99f59 splitmuxsink: always use factory property when set
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1024>
2021-07-08 02:23:02 +02:00
François Laignel
39f0905a7e Use gst_element_request_pad_simple
Instead of the deprecated gst_element_get_request_pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/958>
2021-05-05 06:17:20 +00:00
Stéphane Cerveau
894124835f multifile: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/876>
2021-03-29 12:45:22 +02:00
Vivia Nikolaidou
81d2f67ba5 splitmuxsink: Avoid deadlock when releasing a pad from a running muxer
Might not drain correctly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/838>
2020-12-16 06:17:08 +00:00
Jan Schmidt
d7a9a844f6 splitmuxsink: Fix for 'reference bytes muxed' check.
https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/798
introduced a check in the need-new-fragment logic to avoid starting a
new fragment unless there has been some data on the reference stream,
but the check is done against the number of bytes that have been
received on the input, not the number that were released for output
into the current fragment.

Fix the check to remember and test against bytes that have been sent
for output.

This also fixes a problem where starting a new fragment fails to
request a new filename from the format-location signal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/833>
2020-12-12 03:28:19 +11:00
Jan Schmidt
67f70af1bb splitmuxsink: Add debug for fragment opened/closed msgs
When posting fragment-opened and fragment-closed messages,
put a debug statement in the logs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/833>
2020-12-09 01:03:01 +11:00
Jan Schmidt
df8b147e75 splitmuxsink: Convert asserts into element errors.
Change some g_assert into element errors so that they can be
caught and the pipeline shut down.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/833>
2020-12-09 01:03:01 +11:00
Jan Schmidt
35cc0df53d splitmuxsink: Change EOS catching logic.
Add a new state for ending the overall stream, and use it to decide
whether to pass the final EOS message up the bus instead of dropping
it. Fixes a small race that makes the testsuite sometimes not generate
the last fragment(s) sometimes because the wrong EOS gets
allowed through too early.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/798>
2020-10-31 02:50:51 +00:00
Jan Schmidt
d12fa00195 splitmuxsink: Don't use the element state lock
Using the element state lock to avoid splitmuxsink shutting
down while doing element manipulations can lead to a deadlock on
shutdown if a fragment switch happens at exactly the wrong moment.

Use a private mutex and a shutdown boolean instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/798>
2020-10-31 02:50:51 +00:00
Jan Schmidt
41ca3b4e43 splitmuxsink: Don't busy loop on a non-ready pad.
If a pad gets into the check_completed_gop method and then
the underlying conditions change on the reference context,
things could get stuck in a busy loop when the context should
instead jump back out and wait for more data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/798>
2020-10-31 02:50:51 +00:00
Jan Schmidt
5ac4fdeb7a splitmuxsrc: Mark running=false on shutdown.
Make sure that any late gst_element_call_async() callbacks
know that the elements is shutting down and bail out instead
of operating on the element we're trying to stop.

Fixes a spurious test failure in elements_splitmuxsrc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/798>
2020-10-31 02:50:51 +00:00
Jan Schmidt
f0c24319de splitmuxsink: Forward EOS messages from async fragments.
Re-enable forwarding EOS messages from fragments that are completing
asynchronously, so that splitmuxsink itself won't go EOS until they
are complete. This was disabled to work around a bug in core that
is fixed in
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/683

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/798>
2020-10-31 02:50:50 +00:00
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