Commit graph

7 commits

Author SHA1 Message Date
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
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
99bb6f44ba splitmuxsrc: Implement state change asynchronously instead of blocking
Blocking in change_state() is a recipe for disaster, even more so if
we wait for another thread that also calls into various element API and
could then lead to deadlocks on e.g. the state lock.
2019-01-09 13:35:58 +02:00
Jan Schmidt
389dd4e3d0 splitmuxsrc: Pass seek flags when activating.
Pass all seek flags when activating a part
based on a seek, so that SNAP flags are preserved.
2017-01-03 01:34:02 +11:00
Jan Schmidt
f8d7a2a0af splitmuxsrc: Avoid stall when parts get out of sync
When one part moves ahead of the others - due to excessive
downstream queueing, or really small input files - then
we can end up activating parts more than once. That can lead to
effects like shutting down pad tasks prematurely.

https://bugzilla.gnome.org/show_bug.cgi?id=772138
2016-10-01 00:12:41 +10:00
Jan Schmidt
e7ec32801a splitmuxsrc: Use a separate lock to delay typefind.
Don't hold the main splitmux part lock over
the parent state change function, as it prevents
posting error messages that happen. Since the purpose
is to prevent typefinding from proceeding, use a
separate mutex just for that.
2015-07-29 23:03:18 +10:00
Jan Schmidt
5e2214d309 splitmux: Implement new elements for splitting files at mux level.
Implement 2 new elements - splitmuxsink and splitmuxsrc.

splitmuxsink is a bin which wraps a muxer and takes 1 video stream,
plus audio/subtitle streams, and starts a new file
whenever necessary to avoid overrunning a threshold of either bytes
or time. New files are started at a keyframe, and corresponding audio
and subtitle streams are split at packet boundaries to match
video GOP timestamps.

splitmuxsrc is a corresponding source element which handles
the splitmux:// URL and plays back all component files,
reconstructing the original elementary streams as it goes.
2015-02-06 04:26:59 +11:00