Commit graph

10123 commits

Author SHA1 Message Date
Vivia Nikolaidou
5817c659e6 qtmux: Add option to create a timecode trak in non-mov flavors
Even if timecode trak is officially unsupported in non-mov flavors,
some software still supports it, e.g. Final Cut Pro X:

https://developer.apple.com/library/archive/technotes/tn2174/_index.html

The user might still expect to see the timecode information in the
non-mov file despite it being officially unsupported , because other
software e.g. QuickTime will create a timecode trak even in mp4 files.
Furthermore, software that supports timecode trak in non-mov flavors
will also display the file duration in "timecode units" instead of real
clock time, which is not necessarily the same for 29.97 fps and friends.
This might confuse users, who see a different duration for the same
framerate and amount of frames depending on whether the container is mp4
or mov.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/512
2020-04-03 18:19:38 +00:00
Sebastian Dröge
db69f02dd8 rtpLXXdepay: Set the UNPOSITIONED flag on the audio-info when configuring an unpositioned layout
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/688
2020-04-03 17:57:23 +00:00
Kristofer Björkström
586fc57e55 rtpjpeg: Use gst_memory_map() instead of gst_buffer_map()
gst_buffer_map () results in memcopying when a GstBuffer contains
more than one GstMemory.
This has quite an impact on performance on systems with limited amount
of resources. With this patch the whole GstBuffer will not be mapped at
once, instead each individual GstMemory will be iterated and mapped
separately.
2020-04-03 17:01:24 +02:00
Kristofer Björkström
54b6ee0c55 buffermemory: keep track of buffer size and current offset
Added the possibility to get current offset and the total size of the
buffer.
2020-04-03 17:01:24 +02:00
Havard Graff
d9aaa15a30 rtpopuspay: make depay ! pay work
There is a use-case for a server to re-payload opus going through it.

Problem was that the payloader requires channels in the caps, but
this is not something the depayloader can parse out of the stream, meaning
caps-negotiation would fail.

Removing the requirement of channels in the template-caps fixes this.
2020-04-03 09:04:32 +00: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
78eaa7c6ed matroska: Check the return value of gst_segment_do_seek()
gst_segment_do_seek() can fail.
2020-04-02 05:23:17 +00:00
Sebastian Dröge
f757fbe0f7 qtdemux: Send instant-rate-change event if requested in the SEEK event
Handle an instant rate change seek immediately by reflecting
it downstream as an instant-rate-change event, and do no
further seek handling.
2020-04-02 05:23:17 +00:00
Sebastian Dröge
5d0657d4ae matroska-demux: Send instant-rate-change event if requested in the SEEK event
Short-circuit instant rate change events by generating
a downstream instant-rate-change event and doing no further
seek processing.
2020-04-02 05:23:17 +00:00
Seungha Yang
cb8c83e799 matroska: Update for video-hdr struct change
See the change of -base https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/594
2020-04-01 05:19:24 +00:00
Aaron Boxer
3b65663846 rtpbin: make warning messages more meaningful 2020-03-31 15:51:27 -04:00
Nicolas Pernas Maradei
ce0fb9bd29 rtpsession: rename RTCP thread
RTP session starts a new thread for RTCP and names it
"rtpsession-rtcp-thread" which happens to be longer than the maximum 16B
allowed by pthread_setname_np and causes the naming to fail.
See docs for more details.

This commit simply shortens the thread's name so it can actually be set.
2020-03-31 13:34:07 +02:00
Havard Graff
3368ed44a3 rtpjitterbuffer: create specific API for appending buffers, events etc
To avoid specifying a bunch of mystic variables.
2020-03-31 10:02:57 +00:00
Havard Graff
818b38ebdd rtpjitterbuffer: fix waiting timer/queue code
Changing the types from boolean to guint due to the ++ operand used on
them, and only call JBUF_SIGNAL_QUEUE after settling down,
or else you end up signaling the waiting code in chain() for every buffer
pushed out.
2020-03-30 22:32:21 +02:00
Sebastian Dröge
d427b9bddf qtmux: Error out instead of crashing if reserved-max-duration is 0 or no samples could be created in prefill mode 2020-03-27 10:35:04 +00: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
Xavier Claessens
6e1758d509 Fix usage of C99
It's 2020, way too early for that, let's stick to C89 for now.
2020-03-23 21:32:04 -04:00
Havard Graff
a710bda1ab rtptimerqueue: remove ->num from the timer
This concept was only used by the "multi"-lost timer, and since that
one is not around any longer, the "num" concept is superfluous.
2020-03-20 13:17:20 +00:00
Havard Graff
f1ff80ced0 rtpjitterbuffer: remove the concept of "already-lost"
This is a concept that only applies when a buffer arrives in the chain
function, and it has already been scheduled as part of a "multi"-lost
timer.

However, "multi"-lost timers are now a thing of the past, making this
whole concept superflous, and this buffer is now simply counted as "late",
having already been pushed out (albeit as a lost-event).
2020-03-20 13:17:20 +00:00
Havard Graff
5dacf366c0 rtpjitterbuffer: immediately insert a lost-event on multiple lost packets
There is a problem with the code today, where a single timer will
be scheduled for a series of lost packets, and then if the first packet
in that series arrives, it will cause a rescheduling of that timer, going
from a "multi"-timer to a single-timer, causing a lot of the packets
in that timer to be unaccounted for, and creating a situation in where
the jitterbuffer will never again push out another packet.

This patch solves the problem by instead of scheduling those lost packets
as another timer, it instead asks to have that lost-event pushed straight
out.

This very much goes with the intent of the code here: These packets are
so desperately late that no cure exists, and we might as well get the
lost-event out of the way and get on with it.

This change has some interesting knock-on effect being presented in
later commits. It completely removes the concept of "already-lost", so
that is why that test has been disabled in this commit, to be
removed later.
2020-03-20 13:17:20 +00:00
Havard Graff
2fa7e6a6d4 rtpjitterbuffer: refactor lost_timeout code
Split it up in code related to the timer, (do_lost_timeout) and code
to insert a lost-item/event and update private jitterbuffer-variables.
2020-03-20 13:17:20 +00:00
Seungha Yang
4f443c81cf qtmux: Fix build warning
gstqtmux.c(644): warning C4133: '=':
  incompatible types - from 'gboolean (__cdecl *)(GstAggregator *,GstAggregatorPad *,GstEvent *)'
  to 'GstFlowReturn (__cdecl *)(GstAggregator *,GstAggregatorPad *,GstEvent *)'
2020-03-19 19:20:05 +00: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
Zebediah Figura
71bb53a648 mpegaudioparse: Use a constant bit rate to convert between time and bytes if possible.
This should result in no worse accuracy than the base parse element, and may
result in better accuracy. In particular, the number of bytes processed at any
given point, as accumulated by baseparse, can be only accurate to
(1 / # of frames) bytes per second, and if we try to seek immediately after
pausing the pipeline to a large offset, this small inaccuracy can propagate to
something noticeable.

The use case that prompted this patch is a 45-minute MPEG-1 layer 3 file, which
has a constant bit rate but no seek tables. Trying to seek the pipeline
immediately after pauisng it, without the ACCURATE flag, to a location 41
minutes in, yields a location that is, even with <https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/374>,
still audibly incorrect. This patch yields a much closer position, no longer
audibly incorrect, and likely within a frame of the most correct position.
2020-03-19 14:02:44 +00:00
Mathieu Duponchelle
56e5243f03 qtmux: fix renegotiation check
By the time sink_event is called, the pad's current caps have
already been updated. To address this, implement sink_event_pre_queue,
and check if the pad can be renegotiated there.

Fixes #707
2020-03-19 23:34:52 +11: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
Stian Selnes
81a87c26f9 rtpvp8pay, rtpvp9pay: fix caps leak in set_caps() 2020-03-12 16:49:58 +00:00
Edward Hervey
5a893f2a95 videomixer: Don't leak peer caps 2020-03-12 11:22:56 +01: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
yychao
7f89085251 qtdemux: Add support for AC4
The caps received from qtdemux for AC-4 content are audio/x-gst-fourcc-ac_4

Based on patch by: Savinderjit Kaur

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/413
2020-03-10 15:28:01 +00:00
Matthew Waters
dacdc74043 imagefreeze: handle reconfigure events on the srcpad 2020-03-10 21:22:20 +11:00
Matthew Waters
07a8a1c484 imagefreeze: properly ignore setting caps failures
Ignore the return value of gst_pad_set_caps() so that setcaps will set a
framerate that is usable.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/705
2020-03-10 21:22:03 +11:00
Matthew Waters
28f49e1fd5 imagefreeze: don't fail sending sticky events downstream
They will be repropagated anyway.
2020-03-10 21:08:45 +11:00
Markus Ebner
5dcbb6b0d8 videocrop: Add support for Y41B and Y42B 2020-03-10 08:24:56 +00:00
Markus Ebner
b562235283 videocrop: Add support for Y444
- Refactored the planar transform method to support all video formats
  that are stored planar, independent of the used subsampling
- Added support for Y444
2020-03-10 08:24:56 +00:00
Markus Ebner
4a9e5bbf8b videocrop: Use G_VALUE_INIT to initialize GValues 2020-03-10 08:24:56 +00:00
Ognyan Tonchev
a78a74bff0 rtph26x: Use gst_memory_map() instead of gst_buffer_map() in avc mode
gst_buffer_map () results in memcopying when a GstBuffer contains
more than one GstMemory and when AVC (length-prefixed) alignment is used.
This has quite an impact on performance on systems with limited amount of
resources. With this patch the whole GstBuffer will not be mapped at once,
instead each individual GstMemory will be iterated and mapped separately.
2020-03-06 10:44:16 +00:00
Havard Graff
4046970b01 rtptwcc: make RTPTWCCManager a GObject 2020-03-04 16:48:04 +01:00
Havard Graff
026223cde2 rtpjitterbuffer: fix stalling when resetting timers
When calling gst_rtp_jitter_buffer_reset you pass in a seqnum.

This is considered the starting-point for a new stream.

However, the old behavior would unref this buffer, basically lying to
the thread that is pushing out buffers saying that it can expect
this buffer, when it would never arrive. The resulting effect being no
more buffer pushed out of the jitterbuffer, and it would buffer
incoming data indefinitely.

By instead inserting the buffer in the gap_packets queue, the _reset()
function will take responsibility for using that as the first buffer
of the new stream.

Fixes #703
2020-03-04 12:55:52 +01: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
Jan Schmidt
54f68ff36b qtmux: Remove warning in the log for mono video
Vanilla mono video was generating a spurious warning into the debug log
that's just misleading. Handle mono caps explicitly to avoid the warning.
2020-03-04 04:14:40 +00:00
Guillaume Desmottes
d43ad6e029 deinterlace: add alternate support
In this mode each field is carried using its own buffer.
Allow deinterlace to negotiate caps with the Interlaced feature and
adjust the algorithm fetching lines.

Fix #620
2020-03-03 17:15:00 +00:00
Guillaume Desmottes
b3d96e06c6 deinterlace: add wrapper to get field lines from history
No semantic change so far, will be used to implement alternate support.
2020-03-03 17:15:00 +00:00
Guillaume Desmottes
f0eb1419f6 deinterlace: stop checking line index boundaries
The LINE2() macro already prevents out of bound indexes using CLAMP_HI()
and CLAMP_LOW().
2020-03-03 17:15:00 +00:00
Guillaume Desmottes
cca8008779 deinterlace: fix video info on output frames
Output frames used to have their interlace mode set to the same one as
the input. This breaks their field and comp heights when deinterlacing
an alternate stream.
2020-03-03 17:15:00 +00:00
Guillaume Desmottes
6dde6038cc deinterlace: use output caps to compute buffer size
In interlace-mode=alternate the input buffers have half the size of the
output ones as each field has its own buffer.
2020-03-03 17:15:00 +00:00
Jennifer Berringer
3287f1cb3f flacparse: fix broken reordering of flac metadata
Each FLAC metadata block starts with a flag denoting whether it is the
last metadata block. The existing flacparse code moves any existing
VORBISCOMMENT block to immediately follow the STREAMINFO block without
changing any block's last-metadata-block flag. If no VORBISCOMMENT block
exists, it created one with the last-metadata-block flag set to true.
This results in gstflacdec sometimes giving bad headers to libflac when
trying to play perfectly valid FLAC files depending on the file's
metadata ordering. Depending on the contents of the other metadata
blocks, current versions of libflac may or may not return
FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER when given this broken
metadata. This is most noticeable with files that have a large cover art
image attached where VORBISCOMMENT is the very last metadata block with
no PADDING afterwards.

This patch changes that behavior so that:

1. For FLAC files that already have a VORBISCOMMENT block, the metadata
   order is preserved.
2. For FLAC files that do not have a VORBISCOMMENT block, the generated
   dummy VORBISCOMMENT is placed immediately after STREAMINFO and
   inherits the last-metadata-block flag from STREAMINFO.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/484
2020-03-03 08:03:32 +00:00
Sebastian Dröge
885d330ee6 qtdemux: Try to infer useful header values for raw audio if the sound sample descriptions contain zero values 2020-02-28 13:52:40 +00:00
Sebastian Dröge
9e9af6711d qtdemux: Also use the enda atom for determining endianess of in32, fl32 and fl64 formats
Previously it was only used for in24.
2020-02-28 13:52:40 +00:00
Sebastian Dröge
67be373221 qtdemux: Fix up header information for various fixed-format raw audio formats
Sometimes the headers contain useless, wrong or zero values for e.g. the
sample size with these formats. There's only a single valid value for
them so let's set these instead.
2020-02-28 13:52:40 +00:00
Sebastian Dröge
2c5f6e508c qtdemux: Don't print "unhandled type" warnings for various other raw audio fourccs 2020-02-28 13:52:40 +00:00
Sebastian Dröge
65b30ecce6 qtdemux: Add some more raw audio fourccs to the header instead of duplicating them 2020-02-28 13:52:40 +00:00
Nirbheek Chauhan
42e7864e90 rtpjitterbuffer: Don't use glib format modifiers with sscanf
We do not have a way to know the format modifiers to use with string
functions provided by the system. G_GUINT64_FORMAT and other string
modifiers only work for glib string formatting functions. We cannot
use them for string functions provided by the stdlib. See:
https://developer.gnome.org/glib/stable/glib-Basic-Types.html#glib-Basic-Types.description

```
../gst/rtpmanager/gstrtpjitterbuffer.c: In function 'gst_jitter_buffer_sink_parse_caps':
../gst/rtpmanager/gstrtpjitterbuffer.c:1523:32: error: unknown conversion type character 'l' in format [-Werror=format=]
           || sscanf (mediaclk, "direct=%" G_GUINT64_FORMAT, &clock_offset) != 1)
                                ^~~~~~~~~~
In file included from /home/nirbheek/cerbero/build/dist/windows_x86/include/glib-2.0/glib/gtypes.h:32,
                 from /home/nirbheek/cerbero/build/dist/windows_x86/include/glib-2.0/glib/galloca.h:32,
                 from /home/nirbheek/cerbero/build/dist/windows_x86/include/glib-2.0/glib.h:30,
                 from /home/nirbheek/cerbero/build/dist/windows_x86/include/gstreamer-1.0/gst/gst.h:27,
                 from /home/nirbheek/cerbero/build/dist/windows_x86/include/gstreamer-1.0/gst/rtp/gstrtpbuffer.h:27,
                 from ../gst/rtpmanager/gstrtpjitterbuffer.c:108:
/home/nirbheek/cerbero/build/dist/windows_x86/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here
 #define G_GUINT64_FORMAT "llu"
                            ^
../gst/rtpmanager/gstrtpjitterbuffer.c:1523:32: error: too many arguments for format [-Werror=format-extra-args]
           || sscanf (mediaclk, "direct=%" G_GUINT64_FORMAT, &clock_offset) != 1)
                                ^~~~~~~~~~
```

See also: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/379
2020-02-26 19:05:24 +05:30
Sebastian Dröge
35a1cedb97 qtmux: Add support for 8k resolutions in prefill mode with ProRes 2020-02-25 15:46:44 +02:00
Sebastian Dröge
3998b7cb4c rtpjitterbuffer: Include string.h for memcpy() / memset()
Usually something else is pulling it in somehow already, but not on
Windows.
2020-02-25 09:07:47 +00:00
Håvard Graff
fdf002d069 rtpsession: fix crash when no extension-header present for twcc 2020-02-24 13:06:27 +00:00
Johan Bjäreholt
ce802f033c matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.

Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.

Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).

Before

| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
|  + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
|  + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
|  + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
|  + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
|  + Frame with size 338

After

| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
|  + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
|  + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
|  + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
|  + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
|  + Frame with size 336
2020-02-21 12:49:28 +00:00
Stefano Buora
2d3dccdba7 rtspsrc: remove useless function calls
Comparing gst_rtspsrc_loop_interleaved and gst_rtspsrc_loop_udp, and investigating on timeout issues, it sounds like a piece of code has been originally copied from udp to the interleaved one. The timeout variable is never used inside the interleaved one. No side effect has been seen in the removed function calls.

The debug message removed is pointless as the timeout used is "src->tcp_timeout" that is fixed.

The presence of the two timeout drove my team in investigating if the reference to the tcp_timeout was correct (it is). Hence we removed the misleading reference to the local timeout variable.
2020-02-20 08:27:35 +00:00
Matthew Waters
1326fcdbcc rtpbin: fix typo setting max-dropout/misorder-time
we were setting the max-dropout-time to the value of the
max-misorder-time which by default has a factor of 30 difference in
value.
2020-02-20 13:46:06 +11:00
Seungha Yang
f286f30640 qtdemux: Parse VP Codec Configuration Box
The VP Codec Configuration Box (vpcC) contains vp9 profile and
colorimetry information. Especially the profile information might
be useful for downstream to select capable decoder element.
2020-02-19 23:18:51 +09:00
Yeongjin Jeong
e836640bd5 flvmux: Support rollover in timestamp
For live streams, if we keep the stream for a long time, the timestamp
will be larger than max_uint32. In that case, timestamp should be handled
as a rollover timestamp rather than a backward timestamp.
2020-02-18 18:39:31 +09:00
Havard Graff
63ae338c24 rtpjitterbuffer: don't use the timer-object after JBUF_UNLOCK
It could have been freed (rtp_timer_free) in the meantime.
2020-02-17 15:04:45 +01:00
Havard Graff
1df706448c rtpmanager: Google Transport-Wide Congestion Control RTP Extension
Generating and parsing the RTCP-messages described in:
https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01
2020-02-14 10:09:02 +00:00
Håvard Graff
9ba9837058 rtpfunnel: various cleanups
* Organize GstRtpFunnelPad and GstRtpFunnel separately
* Use G_GNUC_UNUSED instead of (void) casts
* Don't call an event "caps"
* Use semicolons after GST_END_TEST (helps gst-indent)
2020-02-14 10:08:05 +00:00
Sebastian Dröge
9593a3679e qtdemux: Merge sample tables for raw audio streams with one container sample per audio sample
Instead of having chunks with one sample per raw audio sample, have
chunks with a single sample that contains lots of raw audio samples. If
necessary these are still split again later when reading the stream.

With this we are allocating a lot less memory for the parsed sample
tables and can play files that previously triggered our limit of 200MB
for the sample table. For example, one file here would previously
allocate 3.5GB for the sample table and now only allocates 70KB.
2020-02-14 08:48:01 +00:00
Sebastian Dröge
be1c97d3c9 qtdemux: Add a minimum buffer size for raw audio to not output one buffer per frame
Outputting 48000 buffers per second is not a good idea performance-wise.
If a container sample is less than 1024 raw audio frames, combine
multiple samples to get at least 1024 raw audio samples as long as
they're stored contiguous in the file.

For the other direction, if a container sample contains more than 4096
samples there is already code for splitting them up.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=692750
2020-02-14 08:48:01 +00:00
Mathieu Duponchelle
1471100f37 rtspsrc: fix requested range
When the server replies with a range "now-", it is presumed to
be a "live" stream and we should request a similar range.

This was the case prior to my refactoring to make use of
gst_rtsp_range_to_string in 5f1a732bc7,
this commit restores the behaviour for that case.
2020-02-12 05:47:54 +00:00
Mikhail Fludkov
57b0522cd7 rtpptdemux: set payload to caps inside gst_rtp_pt_demux_get_caps
Refactoring to remove duplicate code and add test
2020-02-11 18:39:22 +00:00
Stian Selnes
629b71ac9c rtpptdemux: Fix debug to use GST_DEBUG_OBJECT 2020-02-11 18:39:22 +00:00
Mikhail Fludkov
851a2b7925 rtpbin: use max-streams on rtpssrcdemux
The proper way of capping on max-streams is to do it in rtpssrcdemux.
This patch uses the newly introduced property on rtpssrcdemux. Previous
behavior would not prevent rtpssrcdemux spawning new pads for every new
ssrc and potentialy causing performance trouble during teardown.
2020-02-11 15:12:07 +01:00
John Bassett
16d750bc01 rtpssrcdemux: Handle RTCP APP packets
Fix crash when processing RTCP APP packets.
2020-02-11 15:12:07 +01:00
John Bassett
5800950a2d rtpssrcdemux: Bad RTP/RTCP packet is not fatal
When used for processing bundled media streams within rtpbin the rtpssrcdemux element may
receive bad RTP and RTCP packets, these should not be treated as a fatal error.
2020-02-11 15:10:12 +01:00
Mikhail Fludkov
35596e7fac rtpssrcdemux: introduce max-streams property
The property is useful against atacks when the sender changes SSRC for
every RTP packet. The property with the same name introduced in rtpbin
was not enough, because we still can end up with thousands of pads
allocated in rtpssrcdemux.
2020-02-11 15:10:12 +01:00
Alexander Lapajne
54c4ba82f8 rtspsrc: Fix for segmentation fault when handling set/get_parameter requests
gstrtspsrc uses a queue, set_get_param_q, to store set param and get
param requests. The requests are put on the queue by calling
get_parameters() and set_parameter(). A thread which executs in
gst_rtspsrc_thread() then pops requests from the queue and processes
them. The crash occured because the queue became empty and a NULL
request object was then used. The reason that the queue became empty
is that it was popped even when the thread was NOT processing a get
parameter or set parameter command. The fix is to make sure that the
queue is ONLY popped when the command being processed is a set
parameter or get parameter command.
2020-02-10 09:43:17 +01:00
Olivier Crête
c00796eaa5 rtpsession: Add test for packet rate maths 2020-02-06 14:01:38 -05:00
olivier.crete@collabora.com
774ddb15b8 rtpstats: Base the packet rate average on the packet rate itself
Do this so that the average update speed is in time instead of varying
based on the actual packet arrival rate.
2020-02-06 14:00:48 -05:00
olivier.crete@collabora.com
a637ec3da8 rtpstats: Don't save the ts & seqnum if the avg is not updated
This makes it update correctly when you have more than one packet per
frame.
2020-02-06 14:00:48 -05: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
Juergen Werner
755dba4561 rtpjitterbuffer: fix scaling from RTP-time to NTP-time
The scaling was inverse.
2020-01-29 12:05:07 +01:00
Mathieu Duponchelle
a245e85fb1 rtprtxsend: allow generic input caps
When connected to an upstream rtpfunnel element, payload-type,
ssrc and clock-rate will not be present in the received caps.

rtprtxsend can already deal with only the clock rate being
present there, a new property is exposed to allow users to
provide a payload-type -> clock-rate map, this enables the
use of the max-size-time property for bundled streams.
2020-01-28 15:44:13 +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
Sebastian Dröge
5877d945a4 qtdemux: Always prefer information from v1/v2 sound sample description over sample description entry
ffmpeg is doing the same and various files in the wild have bogus
information in the sample description if the same information is also
duplicated afterwards in the v1/v2 sound sample desription.

Previously we only did this for non-raw audio due to
  https://bugzilla.gnome.org/show_bug.cgi?id=374914
but this specific file is already worked around differently. It still
works after this change.

Also remove ad-hoc GST_READ_DOUBLE_BE re-implementation and move the
switch for legacy audio formats after reading all the sample
descriptions as we want to override the values from there.
2020-01-27 14:14:50 +02:00
Sebastian Dröge
c4f6ce789d avimux: Add support for >2 raw audio channels
For this case write a WAVEFORMATEXTENSIBLE header and also reorder the
raw audio channels to the AVI channel order if needed.
2020-01-19 12:09:38 +00:00
Sebastian Dröge
451fc5c112 wavenc: Fix writing of the channel mask with >2 channels
The channel position is an enum but the conversion code assumed it's a
mask. Convert accordingly.
2020-01-13 19:50:06 +00:00
Kristofer Björkström
9c86414279 rtph265pay: TID for NALU type 48 was always set to 7
A typo bug: | instead of & resulted in TID alwasy being set to 7
for the aggregated NALU of type 48
2020-01-13 15:41:30 +01:00
Sebastian Dröge
c17d5e36ad imagefreeze: Add support for replacing the output buffer
By default imagefreeze will still reject new buffers after the first one
and immediately return GST_FLOW_EOS but the new allow-replace property
allows to change this.

Whenever updating the buffer we now also keep track of the configured
caps of the buffer and from the source pad task negotiate correctly
based on the potentially updated caps.

Only the very first time negotiation of a framerate with downstream is
performed, afterwards only the caps themselves apart from the framerate
are updated.
2020-01-11 08:04:43 +00:00
Alicia Boya García
8dd42666e3 qtdemux: Fix race on pad reconnection
Elements emitting frames through several srcpads should use a
flow combiner to aggregate the chain returns and therefore only return
GST_FLOW_NOT_LINKED to upstream when all the downstream pads have
received GST_FLOW_NOT_LINKED.

In addition to that, in order to handle pads being relinked downstream,
the flow combiner should be reset in response to RECONFIGURE events.
This ensures that a both srcpads process a chain operation before a
GST_FLOW_NOT_LINKED can be propagated upstream (which would usually stop
the pipeline).

Otherwise, in a configuration with two srcpads, only one linked at a
time, after the relink the element could chain data through the now
unlinked pad and the flow combiner would resolve as GST_FLOW_NOT_LINKED
(stopping the pipeline) just because the now linked pad has not been
chained yet to update the flow combiner.

This patch adds handling of RECONFIGURE events to qtdemux. Also, since
this event handling causes the flow combiner to be used from a thread
other than the qtdemux streaming thread, usages of the flow combiner
has been guarded by the object lock.
2020-01-09 18:43:02 +00: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
Daniel Molkentin
bb1ce82e39 videocrop: allow properties to be animated by GstController 2020-01-03 15:16:02 +01:00
Aaron Boxer
09d4514814 rtspsrc: improved handling of control concatenation with base
Also, `control_url` variable has been renamed to `control_path`,
as it is actually a path.
2019-12-30 16:52:45 +00:00
Aaron Boxer
ed6b5a3a63 rtspsrc: append aggregate control string to base URL before query string
Appending control string to end of query changes meaning of query string
Fixes #650
2019-12-30 16:52:45 +00:00
Niels De Graef
acab06b2e8 alpha: Cleanup using G_DECLARE_FINAL_TYPE
We started depending on GLib 2.44, so we can clean up all the GObject
boilerplate macros.
2019-12-28 04:05:13 +00:00
Stéphane Cerveau
b928517f1e good: use of g_value_dup_string
Use helper method to get string from GValue.
2019-12-20 09:30:26 +00:00
Havard Graff
8b96d8ee8d rtpbin: fix shutdown crash in rtpbin
The key is to make sure the jitterbuffer is set to NULL *before* the
ptdemux.

The race that existed would basically happen when ptdemux had reached
READY, and the jitterbuffer would then push a buffer, triggering a new
pad with a new payloadtype being added and ghosted to the rtpbin itself.

However, the srcpad of the ptdemux would now be inactive, and all the
sticky-event pushed on it would be swallowed, not allowing any to reach
the ghost-pad. Then the buffer in-flight would come to the ghostpad,
and we would assert that a buffer arrived before the necessary
events.

By simply re-ordering the state-changes, we ensure that there will be
no buffer racing into the ptdemux while its state is being changed,
and the problem disappears completely.

Notice also that there is not point in disconnecting the signals on the
ptdemux before this point, since we need the push-thread to settle
down before we can do this in a non-racy way.
2019-12-20 08:27:07 +00:00
Aaron Boxer
4155c59cc4 rtspsrc: avoid seek DISCONT when only rate changes in same direction
Not setting DISCONT avoids a noticable delay when seeking
with only rate changing, in the same direction as current
rate.
2019-12-19 05:54:38 +00:00