Commit graph

130 commits

Author SHA1 Message Date
Thibault Saunier 5ff769d731 Move files from gst-plugins-good into the "subprojects/gst-plugins-good/" subdir 2021-09-24 16:13:50 -03:00
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 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
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
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
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
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
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
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 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
Thibault Saunier 0a6a62aa76 docs: Port all docstring to gtk-doc markdown 2019-05-13 10:24:40 -04:00
Vivia Nikolaidou af0e30d545 splitmuxsink: Do not hardcode frames_of_daily_jam
Apart from the obvious drawbacks of hardcoding, the drawback here was
that, if we subtracted 2 frames (instead of 2.6) from the target running
time, we'd request the next keyframe a bit too far into the future,
which would make our files split at the wrong position.

https://bugzilla.gnome.org/show_bug.cgi?id=797293
2018-10-16 16:06:47 +03:00
Vivia Nikolaidou faee020994 splitmuxsink: Fix if condition in drop-frame timecode wrap-around
Was previously: if ( x | y && a == b). Changed it into if ((x & y) && (a
== b)).
2018-10-11 13:58:34 +03:00
Vivia Nikolaidou 1219712da0 splitmuxsink: Subtract daily jam offset when day wraps around
For drop-frame framerates, when the expected next max timecode wraps
around at the end of the day, we have to subtract the offset of the
daily jam, otherwise we end up with a duration that's a few frames too
long.

https://bugzilla.gnome.org/show_bug.cgi?id=797270
2018-10-11 13:51:08 +03:00