Commit graph

7837 commits

Author SHA1 Message Date
Sebastian Dröge
2a2e48fd9e onviftimestamp: Add missing break in set_property()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1257>
2020-05-10 11:17:19 +03:00
Nicolas Dufresne
269ab891c5 h264/h265parse: Fix initial skip
Account for start codes possibly be 4 bytes. For HEVC, also take into
account that we might be missing only one of the two identification
bytes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Nicolas Dufresne
3784bd4a73 h265parse: Ensure correct timestamps
If the input has a miss-placed filler zero byte (e.g. a filler without a 4
bytes start code on the next NAL), we would endup using the same timestamp
twice. Ask the base class to read the timestamp from the buffer were the NAL
actually starts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Nicolas Dufresne
dc4c470d75 h264parse: Properly handle 4 bytes start code
This will stop stripping four bytes start code. This was fixed and broken
again as it was causing the a timestamp shift. We now call
gst_base_parse_set_ts_at_offset() with the offset of the first NAL to ensure
that fixing a moderatly broken input stream won't affect the timestamps. We
also fixes the unit test, removing a comment about the stripping behaviour not
being correct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Sebastian Dröge
0dfd05e574 timecodestamper: Unref latency query after usage
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1249>
2020-05-06 20:05:06 +03:00
Tim-Philipp Müller
270f2f83a1 autoconvert: fix compiler warnings with g_atomic on recent GLib versions
The volatile is not needed here and causes compiler warnings
with newer GLib versions.

gstautoconvert.c: In function ‘gst_auto_convert_dispose’ (and elsewhere):
glib/gatomic.h:108:3: warning: initialization discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
gstautoconvert.c:224:24: note: in expansion of macro ‘g_atomic_pointer_get’
  224 |     GList *factories = g_atomic_pointer_get (&autoconvert->factories);

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1237>
2020-05-01 14:50:58 +01:00
Ederson de Souza
3ea0f694de clockselect: Add TAI clock support
Via new value for property clock-id, "tai", it's possible to use
GST_CLOCK_TYPE_TAI as pipeline clock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1009>
2020-04-30 19:21:37 +00:00
Olivier Crête
d9512dc132 ristrtpdeext: Expose the largest sequence number received
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête
f2e8d4dcf2 ristrtpdeext: Update RTP header extension packet to latest spec
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête
a602eb7eea ristrtpext: Update RTP header extension packet to latest spec
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête
03a60a47b5 rist: Document main profile support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête
15f89cd088 ristsrc: Add ristrtpdeext to the pipeline
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête
a0de749814 ristsink: Add ristrtpext to sink
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête
f8bb1e0b85 ristsink: Receive RIST seqnum ext and feed it to rtxsend
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:32 +00:00
Olivier Crête
fc76254dfc ristsink: Pass the session id to the on-app-rtcp callback
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête
e873780a1f ristrtxsend: Use externally given seqnum extension when available
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête
58e31e116b ristrtxsend: Store sent packets with extended seqnum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête
efd78bb8d8 rist: Factor our seqnum extension code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête
59b01048ae rist: Drop packets that are more than G_MAXINT16 seqnum late
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête
fa5d206c2c rist: Insert RTP seqnum extension header
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête
005bd960ee rist: Add element to remove the header extension
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Olivier Crête
7b0377c185 rist: Add element that inserts the RTP header extension
Currently can suppress the TS null packets, but can't insert
the seqnum extension yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
2020-04-30 18:31:31 +00:00
Nicolas Dufresne
0d637c14c5 h264/h265parse: Fix handling of very last frame
Baseparse will never call us back on draining, so going into more: label will
cause the current frame to be discarded. So if we have a complete NAL, but not
a complete AU, make sure to terminate the frame properly.

This is a gression introduce by commit e88d848070 and
a194a87b26.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1275

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1208>
2020-04-23 12:28:54 +00:00
Guillaume Desmottes
b5a28df0f3 transcodebin: fix caps NULL unref
gst_pad_get_current_caps() can return a NULL pointer which was raisin a CRITICAL.
2020-04-16 16:17:56 +00:00
Xavier Claessens
95134cfda8 h264parse: Remove unused arguments 2020-04-15 14:10:16 +00:00
Nicolas Dufresne
1ea21ad922 h264parse: Don't push NALs before we have HEADERS
Otherwise we may endup pushing incomplete caps, which cause a renegotiation.
Note that this has the effect that caps are no longer pushed twice in presence
of valid framerate in the headers.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
ff137a2059 h265parse: Don't push NALs before we have HEADERS
Otherwise we may endup pushing incomplete caps. Note that this has the side
effect that caps are no longer pushed twice in presence of VUI with valid
framerate.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
c51922b06c h265parse: Differentiate PREFIX SEI from SUFFIX
There is some code to fixup broken stream that uses the SEI location,
this code is meant to locate SUFFIX SEI only. This should prevent
unwanted side effect if SUFFIX SEI is used.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
1aede43af6 h265parse: Don't add latency when not needed
We no longer add latency when doing AU->AU, AU->NAL and NAL->NAL
parsing.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
ceb68c4cf8 h265parse: Propagate MARKER flag 2020-04-15 14:10:16 +00:00
Nicolas Dufresne
e88d848070 h265parse: Don't wait for next NAL if input is aligned
Waiting for the next NAL increases the latency. If alignment=nal/au
has been negotiated, assumes the the buffer contains a complete
NAL and don't expect a second start-code. This way, nal -> nal,
au -> au and au -> nal no longer introduce latency.

As a side effect, the collect_pad() function was not able to poke at the
following NAL. This call is now moved before processing the NAL, so
it's looking at the current NAL before it's ingested into the parser
state in order to dermin if the end of an AU has been reached. The AUD
injection state as been adapted to support this.

This change will break pipelines if alignment=nal is used without respecting the
alignment. Effectively, the parser will no longer fix the broken aligment
which will result in parser error and the termination of the pipeline. Such
issue existed in tsdemux element and might exist in any forks of that code.

Related to https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1193
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
7cba3847ec h265parse: Set PTS/DTS and DISCONT on crafted NAL
When we inject a NAL in the bitstream before another one, make
sure to pass both DTS and PTS. Also make sure to transfer the
DISCONT flag properly.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
c52fdf994c h264parse: Don't add latency when not needed
We no longer add latency when doing AU->AU, AU->NAL and NAL->NAL
parsing.
2020-04-15 14:10:15 +00:00
Nicolas Dufresne
ba8b605c6f h264parse: Propagate MARKER flag 2020-04-15 14:10:15 +00:00
Nicolas Dufresne
a194a87b26 h264parse: Don't wait for next NAL if input is aligned
Waiting for the next NAL increases the latency. If alignment=nal/au
has been negotiated, assumes that the buffer contains a complete
NAL and don't expect a second start-code. This way, nal -> nal,
au -> au and au -> nal no longer introduce latency.

As a side effect, the collect_pad() function was not able to poke at the
following NAL. This call is now moved before processing the NAL, so
it's looking at the current NAL before it's ingested into the parser
state in order to dermin if the end of an AU has been reached. The AUD
injection state as been adapted to support this.

This change will break pipelines if alignment=nal is used without respecting the
alignment. Effectively, the parser will no longer fix the broken aligment
which will result in parser error and the termination of the pipeline. Such
issue existed in tsdemux element and might exist in any forks of that code.

Related to https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1193
2020-04-15 14:10:15 +00:00
Nicolas Dufresne
ea99aee881 h264parse: Set PTS/DTS and DISCONT on crafted NAL
When we inject a NAL in the bitstream before another one, make
sure to pass both DTS and PTS. Also make sure to transfer the
DISCONT flag properly.
2020-04-15 14:10:15 +00:00
Nicolas Dufresne
596dfbdf37 h264parse: Remove no-op assignment
upstream was set to *out_ts, setting *out_ts to upstream here will
have no effect.
2020-04-15 14:10:15 +00:00
Sebastian Dröge
5394269c91 mpegtsmux: Chain up pad dispose function to the one of the parent class
Otherwise we will leak various memory.
2020-04-15 09:07:24 +00:00
Sebastian Dröge
b41ed0fbb0 mpegtsmux: Properly release requests pads by chaining up to aggregators function 2020-04-15 09:07:24 +00:00
Vivia Nikolaidou
fecd38c8f6 tsmux: Ability for streams to disappear and reappear
Until now, any streams in tsmux had to be present when the element
started its first buffer. Now they can appear at any point during the
stream, or even disappear and reappear later using the same PID.
2020-04-15 09:07:24 +00:00
Nicolas Dufresne
4a91a98ea1 mpegtsdemux: Don't pretend doing NAL alignment
Per specification in 2.14.2 "For PES packetization, no specific data
alignment constraints apply". So we should not advertise NAL
alignment.

This bug was introduced at the same moment the alignment field was introduced
10 years ago. The plan was that alignment=none (or no alignment field) was to
be used for mpegtsdemux, but no one noticed the error. The reason is that at
the same moment, everything dealing with H264 started defaulting to AU
alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=606662#c22

This patch will have a side effect that a parser is now needed after the
tsdemux element. The following pipeline will not negotiate anymore as the
mpegtsmux element requires alignment={nal,au}.

  ... ! tsdemux ! mpegtsmux ! ...

As a side effect, anyone that forked from tsdemux should updated their code to
fix this bug.
2020-04-14 11:36:16 -04:00
Seungha Yang
462a8130a6 h264parse: Remove useless comparison
sei_pic_struct is unsigned and GST_H264_SEI_PIC_STRUCT_FRAME is zero.

CID: 1461467
2020-04-13 12:28:14 +00:00
Nicolas Dufresne
eea520fe6d h264parse: Fix content light level value changes
Same as for H265, was found by Coverity.
2020-04-08 14:01:23 -04:00
Nicolas Dufresne
84a58b3633 h265parse: Fix content light level value changes
The comparision was not testing anything meaninful. This fixes the comparision
so we now update the caps whenever the value differ. This was detected by
coverity.

CID 1461291
2020-04-08 13:58:51 -04:00
Jan Alexander Steffens (heftig)
6680b70781
rtmp2: Avoid a deadlock when getting stats
We need to do this without holding the lock as the `g_async_queue_pop`
waits on the loop thread to deliver the stats. The loop thread might
attempt to take the lock as well, leading to a deadlock.

Taking a reference to the connection should be enough to keep this
safe.
2020-04-08 18:41:01 +02:00
Seungha Yang
be8cec5348 h264parse: Add support for inband timecode update
Add new property "update-timecode" to allow updating timecode
in picture timing SEI depending on timecode meta. Since the picture
timing SEI message requires proper VUI setting but we don't support
re-writing SPS, this might not work for some streams
2020-04-08 15:39:12 +00:00
Seungha Yang
fffbec11e4 h264parse: Don't unconditionally append timecode meta
If upstream buffer has its own timecode metatdata, don't append
new timecode meta into the buffer.
2020-04-08 15:39:12 +00:00
Seungha Yang
1a09251699 h264parser: Parse all SEI payload type even if it's not handled by parser
... so that user can handle it from outside of parser API
2020-04-08 15:39:12 +00:00
Michael Olbrich
01628fa847 sdpdemux: don't send EOS for unknown SSRC
The rtpbin sends signals for all SSRCs. Don't send an EOS when the SSRC
does not match the stream SSRC.

This avoids problems when an SSRC from another receiver times out.
2020-04-08 13:24:34 +00:00
Philippe Normand
12ff0a4797 fakevideosink: Allow allocation meta flags fine-tuning
In some scenarios the fakevideosink shouldn't advertize the overlay-composition
meta for instance, so that overlay elements perform subtitles blending
themselves.
2020-04-07 14:40:37 -04:00
Michael Olbrich
468408c6a6 mpegtspacketizer: be more tolerant when parsing the adaptation field
According to the specification, the adaptation field length must be 183 if
there is no payload data and < 183 if the packet contains an adaptation
field and payload data.

Unfortunately some payloaders always set the flag for payload data, even if
the adaptation field length is 183.

Don't return with an error in this case. Clear the payload data flag
instead and parse the adaptation field as usual. This avoids visual
artefacts for such streams.
2020-04-07 08:21:04 +00:00
Jan Schmidt
b9ebd885ff tsdemux: Send instant-rate-change event if requested in the SEEK event
Convert instant-rate-change seek events into a downstream
instant-rate-change event and skip any further local seek handling.
2020-04-02 11:26:46 +00:00
Seungha Yang
f05effe024 h264parse,h265parse: 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:18:11 +00:00
Zeeshan Ali
355719bae7 h265parse: Set duration on buffers base on framerate 2020-03-31 14:13:30 +00:00
Zeeshan Ali
158d69fd45 h265parse: Derive src fps from vui_time_scale & vui_num_units_in_tick 2020-03-31 14:13:30 +00:00
Zeeshan Ali
51bc67d4ef h265parse: Handle interlaced video
For interlaced video:
* set the interlace mode in the src caps
* double the height from SPS in the caps.
* set field latency, instead of frame latency.

Fix #778
2020-03-31 14:13:30 +00:00
Seungha Yang
d81438a69e h264parse: Print all the syntax elements of frame packing for debugging
Other values might be useful for debugging
2020-03-31 08:30:50 +00:00
Seungha Yang
7f5347a664 rtmp2src: Add idle-timeout property
Add new property to signalling that there is no incoming data
from peer. This can be useful if users want to stop the streaming
when the connection is alive but no packet is arriving.
2020-03-27 10:25:37 +00:00
Guillaume Desmottes
c3a9d2dc64 interlace: add alternate support
Allow downstream elements to negotiate the alternate interlace mode,
splitting each input buffer in two fields, each having their own buffer.
2020-03-24 09:57:53 +01:00
Guillaume Desmottes
2db7c4e22c interlace: factor out interlace_mode_from_pattern() 2020-03-24 09:53:43 +01:00
Guillaume Desmottes
e755c45863 interlace: factor out gst_interlace_push_buffer() 2020-03-24 09:53:43 +01:00
Guillaume Desmottes
5bfbddf859 interlace: factor out gst_interlace_decorate_buffer_ts() 2020-03-24 09:53:43 +01:00
Guillaume Desmottes
eb914c127d interlace: rename copy_field()
It is actually copying both fields (to a single frame/buffer).
2020-03-24 09:53:43 +01:00
Seungha Yang
085f10340e tsdemux: Set mpegversion for AAC ADTS stream based on parsed ADTS header
Both 2 and 4 are supported version of AAC ADTS format stream.
So we need to set correct version to help negotiation
especially for non-autopluggable pipeline.
2020-03-23 10:57:26 +00:00
rubenrua
6c3f092afc asfmux: Fix typo in property description
s/milisecs/milliseconds/g
2020-03-12 18:38:11 +01:00
Thibault Saunier
fb888dada1 timecodestamper: Plug a leak 2020-03-11 21:38:13 -03:00
Edward Hervey
fa2916a159 mpegts: Add a property to ignore broken PCR streams
Some mpeg-ts (HLS, DVB, ...) streams out there have completely broken
PCR streams on which we can't reliably recover correct timestamps.

For those, provide a property that will ignore the program PCR stream
(by faking that it's not present (0x1fff)).
2020-03-11 16:28:03 +00:00
Seungha Yang
8e45fd27d1 mpegdemux: Add ignore-scr property to ignore broken SCR
Some MPEG-PS streams might not be compliant but the SCR can be ignored
if PTS/DTS in PES header is consistently increased.
2020-03-11 21:06:20 +09:00
Seungha Yang
f6328cec89 mpegdemux: Remove whitespace 2020-03-11 17:42:18 +09:00
Seungha Yang
4b06b1a56e h265parse: In-band sps/pps update if only codec_data differs in src caps
Apply in-band sps/pps resending implementation to h265parse.
2020-03-10 08:51:04 +00:00
Seungha Yang
82a7d1cd99 h264parse: In-band sps/pps update if only codec_data differs in src caps
Initially the case "only codec_data is different" was addressed in
https://bugzilla.gnome.org/show_bug.cgi?id=705333 in order for
unusual bitstreams to be handled. That's the case where sps and pps
are placed in bitstream. When sps/pps are signalled only via caps
by upstream, however, the updated codec_data is mandatory for decoder
and therefore we shouldn't ignore them.
2020-03-10 08:51:04 +00:00
Dong Il Park
691b066ec6 tsdemux: Add format_identifier for AC4 codec
According to following spec document, add format_identifier for AC4 in tsdemux.

ETSI TS 103 190-2 V1.2.1 : Annex D : AC-4 in MPEG-2 transport stream
2020-03-10 16:32:59 +09:00
yychao
adc3d12741 tsdemux: Add support for AC4
According to following two specs, add support for AC4 in tsdemux.

1. ETSI TS 103 190-2 V1.2.1 (2018-02) : Annex D (normative): AC-4 in MPEG-2 transport streams
2. ETSI EN 300 468 V1.16.1 (2019-08) : Annex D (normative):Service information implementation of AC-3, EnhancedAC-3, and AC-4 audio in DVB systems
2020-03-09 21:54:09 +00:00
Seungha Yang
959320264a h265parser: Add helper macro for nal type classification
Add some macros to remove code duplication and to make it more readable
2020-03-05 23:22:34 +09:00
Thibault Saunier
924006279a transcodebin: Avoid elements name duplication
By just letting GStreamer choose a good name
2020-03-05 09:17:49 -03:00
Guillaume Desmottes
469d2cac2f transcodebin: add converters before filters
User doesn't have any guarantee about the actual raw format decodebin will
produce so their filters may or may not fit.

Fix #1228
2020-03-04 14:15:34 +00:00
Guillaume Desmottes
667eadac92 transcodebin: fix logs when failing to link filter
- Display caps of the pad we actually tried to link.
- Use the template caps as the filter is likely to not have any caps set
  yet.
- Log pad name as well.
2020-03-04 14:15:34 +00:00
Thibault Saunier
a0423ee20f timecodestamper: Add seeking support
The approach is quite simple and doesn't take all use cases into account,
it only implements support when we are using the internal timecode we
create ourself.

Also the way we compute the sought frame count is naive, but it works
for simple cases.
2020-03-04 12:36:45 +00:00
Jan Alexander Steffens (heftig)
e83888302d rtmp2: Only grab stats on close when connection exists
If the connection attempt failed, self->connection is NULL.
2020-03-03 10:27:31 +00:00
Guillaume Desmottes
09367da35c transcodebin: mark properties as GST_PARAM_MUTABLE_READY
They are all used in the READY to PAUSED transition so should not be
changed after.
2020-02-28 16:57:30 +00:00
Guillaume Desmottes
de4ea94766 transcodebin: force decoding if a filter is defined
Filter operates on raw data so don't allow decodebin to produce
encoded data if one is defined.

My use case here is keeping the video stream untouched but apply a filter
on the audio one, while keeping the same audio format.
2020-02-28 16:57:30 +00:00
Guillaume Desmottes
4b6164339f transcodebin: logs when inserting, or not, a filter
It's not easy atm to figure out from the logs if a filter has actually be
inserted or not.
2020-02-28 16:57:30 +00:00
Olivier Crête
26ac42f7c0 fakevideosink: Align max-lateness/processing-deadline to GstVideoSink
To emulate correctly the timing video of a real sink, let's set those
properties just like a real video sink.
2020-02-27 23:25:44 +00:00
Guillaume Desmottes
2cb7c66ac7 transcodebin: consider 'any' as no restriction
gstreamer-rs set 'any' as default restriction which actually means 'no
restriction' so handle it as the absence of restriction.
2020-02-26 13:12:37 +00:00
Guillaume Desmottes
54d8360baa transcodebin: fix caps leak
encodecaps was leaked if the profile has restrictions.
2020-02-26 03:23:20 +00:00
Jan Alexander Steffens (heftig)
91a033a85e
rtmp2: Allow setting flash-version
In case the application has to deal with fussy servers. User agent
sniffing is so last decade.

Adds a property to set the Flash version on both the sink and the src.
The default stays the same (IIRC, Flash plugin for Linux from 2009).
2020-02-25 15:10:28 +01:00
Jan Alexander Steffens (heftig)
02a6a794ec
rtmp2: Expose connection stats as property
Save the stats before we destroy the connection, so we can still
retrieve them afterwards.
2020-02-21 19:26:35 +01:00
Jan Alexander Steffens (heftig)
f1a9a3146a
rtmp2: Add gst_rtmp_connection_get_stats and _get_null_stats
The former uses a thread-safe way of getting statistics from the
connection without having to protect the fields with a lock.

The latter produces a zeroed statistics structure for use when no
connection exists.
2020-02-21 19:26:35 +01:00
Jan Alexander Steffens (heftig)
5d720eb59e
rtmp2: Count outgoing bytes and acked bytes
For statistics.
2020-02-21 19:26:33 +01:00
Jan Alexander Steffens (heftig)
0c344a7efb rtmp2sink: Add a property for the outgoing chunk size 2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
f7bb2cdeb7 rtmp2: Add gst_rtmp_connection_set_chunk_size 2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
63ec837824 rtmp2: Handle outgoing set chunk/window size properly
Apply outgoing sizes only after writing the chunk to the peer. This is
important particularly for the set chunk size and allows exposing it
without threading issues.
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
a566461294 rtmp2: Chunk messages as buffers in loop thread
Move output chunking from gst_rtmp_connection_queue_message into
gst_rtmp_connection_start_write, which effectively moves it from the
streaming thread into the loop thread.

This allows us to handle the outgoing chunk-size message (which is
generated by changing the future chunk-size property) properly, which
could come from any other thread.
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
9a13df9ba5 rtmp2: Consistently use GstBuffer for RTMP chunks 2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
b03780233e rtmp2: Add gst_rtmp_chunk_stream_serialize_all
Serializes an RTMP message into a series of chunks, all in one buffer.

Similar to what gst_rtmp_connection_queue_message does to serialize
into a GByteArray.
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
cb7f0c4be7 rtmp2: Add gst_rtmp_output_stream_write_all_buffer_async
Similar to gst_rtmp_output_stream_write_all_bytes_async, but takes a
GstBuffer instead of a GBytes. It can also return the number of bytes
written, which might be lower in case of an error.
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
286a3829b6 rtmp2: Improve handling incoming set chunk/window size
Reject out-of-spec sizes and warn about suspiciously small sizes.
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
14fd7e0884 rtmp2: Lock self->lock before OBJECT_LOCK
OBJECT_LOCK is used to protect property access only. self->lock is
used to access the RtmpConnection, mostly between the streaming thread
and the loop thread.

To avoid deadlocks involving these two locks, we obey a lock order:
If both self->lock and OBJECT_LOCK are needed, self->lock must be locked
first. Clarify this.
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
6583e00d50 rtmp2: Reject oversized messages
We only have 24 bits for the size, so reject anything larger.
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
0044e7a1ba rtmp2: Count in_bytes_acked instead of in_bytes_unacked
This is nicer for statistics.
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
11a1de0053 rtmp2: rtmpconnection: Use more appropriate size types
- guint32 for chunk size and window size
- guint64 for running counters
2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
279e3c333c rtmp2: Add a g_return_val_if_fail 2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
03c3257f0f rtmp2: Replace explicit unref with g_main_context_invoke_full 2020-02-21 15:20:41 +00:00
Jan Alexander Steffens (heftig)
baad4fd91b rtmp2: rtmpconnection: Use GST_*_OBJECT logging
GstRtmpConnection isn't a GstObject with a name or path, but we still
get the GObject's type and address.
2020-02-21 15:20:41 +00:00
Marc Leeman
424c593871 rist: fix two minor memory leaks 2020-02-21 12:16:31 +01:00
Marc Leeman
6da6b6f3f0 rtpmanagerbad: fix two minor memory leaks 2020-02-21 12:16:28 +01:00
Marc Leeman
a710fbc12b rtpmanagerbad: reduce lock in rtpsink 2020-02-21 12:16:21 +01:00
Marc Leeman
61b062a12e rtpmanagerbad: documentation comment fix 2020-02-21 12:16:17 +01:00
Vivia Nikolaidou
3df3c3c5f6 tsparse: Add split-on-rai property
If set, buffers sized smaller than the alignment will be sent so that
RAI packets are at the start of a new buffer.

Fixes: #1190
2020-02-11 10:56:54 +00:00
Thiago Santos
0a128155b3 sdpdemux: check if connections are available on media entry before get
Otherwise we trigger an assert.
2020-02-02 22:15:40 +00:00
Vivia Nikolaidou
8d522bf3e6 mpegtsparse: Moved dispose function into finalize
dispose can be called several times and would double-free the flow
combiner in that case.
2020-01-29 20:39:44 +00:00
Vivia Nikolaidou
0d2e908523 mpegtsparse: Added alignment property
alignment works like in mpegtsmux, joining several MpegTS packets into
one buffer. Default value of 0 joins as many as possible for each
incoming buffer, to optimise CPU usage.
2020-01-29 20:39:44 +00:00
Vivia Nikolaidou
2f946274d5 mpegtsparse: Set delta unit flag on non-random-access buffers
If they don't have the random access flag set, they cannot be decoded
independently.
2020-01-29 20:39:44 +00:00
Vivia Nikolaidou
34af8ed66a mpegtsparse: Packetize output on default srcpad
Align buffer boundaries with mpeg-ts packets, instead of keeping
whatever packetization we have from the source (network, file reading).
2020-01-29 20:39:44 +00:00
Vivia Nikolaidou
e44cbfb1da mpegtsparse: Factor common code into mpegts_packet_to_buffer
The same code was used twice for turning an MpegTSPacketizerPacket into
a GstBuffer.
2020-01-29 20:39:44 +00:00
Vivia Nikolaidou
68f69d419b mpegtspacketizer: Fix typo in flag name 2020-01-29 20:39:44 +00:00
Sebastian Dröge
287f9b18b0 mpegdemux: Update the last_ts correctly if we have no DTS
If we have no DTS but a PTS then this means both are the same, and we
should update the last_ts with the PTS. Only if both are unknown then we
don't know the current position and should not update it at all.

Previously we would always update the last_ts to GST_CLOCK_TIME_NONE if
the DTS is unknown, which caused the position to jump around and to
cause spurious gap events to be sent.
2020-01-21 23:50:52 +00:00
Sebastian Dröge
5f95a9ec61 mpegpsdemux: Send gap events for late streams whenever updating the SCR
Instead of doing it on each packet and doing it based on the distance to
the previous SCR instead of based on the DTS.

Previously we would send gap events for audio all the time if the SCR
distance was 400ms because the threshold for audio is 300ms and by only
ever updating the position when the SCR updates we would always be 100ms
above the threshold and send needless gap events.

This fixes audio glitches on various files caused by gap events.
2020-01-21 10:08:53 +00:00
Jan Schmidt
e2bdc0c48d yadif: Re-renable MMX asm on x86_64 with meson
The meson build doesn't automatically set HAVE_CPU_* defines
like autotools did, so the yadif plugin was being built without
the MMX assembler support
2020-01-19 08:50:19 +00:00
Jan Schmidt
1986d4f942 yadif: Only build inline Asm with gcc/clang 2020-01-19 08:50:19 +00:00
Tim-Philipp Müller
415c798b73 mxfdemux: add support for Apple ProRes 2020-01-15 11:51:20 +00:00
Sebastian Dröge
f72aaed9c7 timecodestamper: Add property to set the extra latency to introduce for waiting for LTC timecodes
Default to 150ms instead of 8 frames, which seems to work in the
majority of cases.
2020-01-13 18:17:23 +00:00
Sebastian Dröge
fdca7ebb4c timecodestamper: Add some more debug output 2020-01-13 18:17:23 +00:00
Josep Torra
bebf20c906 h264parse: do not push wrong PTS with some raw files
Some raw h264 encoded files trigger the assignment of wrong PTS to buffers
when some SEI data is provided. This change prevents it to happen.

Also ensure this behavior is being tested.
2020-01-10 15:03:38 +00:00
Sebastian Dröge
a4c925f694 timecodestamper: Skip over invalid LTC timecodes immediately 2020-01-10 15:59:27 +02:00
Sebastian Dröge
a1443518e0 timecodestamper: Clean up old LTC timecodes on LTC discontinuity
We might have some old timecodes that are in the future now and have to
drop those to make sure that our queue is correctly ordered and we don't
have multiple timecodes for the same running time.
2020-01-10 15:59:26 +02:00
Sebastian Dröge
bbdb392abe timecodestamper: Fix waiting for the first video frame in case of live video input 2020-01-10 15:59:25 +02:00
Sebastian Dröge
d7bb5b8a16 timecodestamper: Fix up handling/queueing of LTC timecodes
Directly read them out of the decoder as soon as we passed audio and
then store them in a queue that we handle internally together with their
timestamps. This cleans up memory management and gives us proper control
over the queue instead of guessing how the queue inside the LTC decoder
actually works and when it overflows.
2020-01-10 15:59:24 +02:00
Sebastian Dröge
0a53f6560a timecodestamper: Only allow requesting LTC audio pad in NULL/READY states
And don't introduce any latency at all if not LTC audio pad was
requested.
2020-01-10 15:59:21 +02:00
Sebastian Dröge
0a499242e9 timecodestamper: In live mode wait correctly for the latency to pass
And also introduce 6 instead of 2 frames of latency compared to the LTC
audio input as that seems to be an upper bound for how much the LTC
library is lagging behind.
2020-01-10 15:58:29 +02:00
Sebastian Dröge
31d7862051 timecodestamper: Use the internal LTC timecode tracker instead of the last one we retrieved
Otherwise we don't interpolate between LTC timecodes but only ever put
an LTC timecode on buffers once we actually received one.
2020-01-10 15:58:06 +02:00
Stéphane Cerveau
4b8c47ee37 h26xparse: Handle state change on IDR first slice
As the H265/H264 bitstream can support multiple slices,
mastering_display_info_state and content_light_level_state
should be changed only on first slice segment.

Fix #1152
2020-01-07 08:55:28 +00:00
Stéphane Cerveau
d414e90eff h265parse: use same algo for MDCV and CLL SEI management 2020-01-07 08:55:28 +00:00
Stéphane Cerveau
b481edd745 h264parser: add MDCV and CLL SEI message parsing
Allow to parse SEI message for:
- mastering display colour volume
- Light level infomation

Set to caps if necessary.

Fix #958
2020-01-07 08:55:28 +00:00
Thibault Saunier
1e5c117c7c fakevideosink: Use our pad template to create pad 2020-01-06 20:35:00 +00:00
Mark Nauwelaerts
42b60627fa mpegtsdemux: resurrect actual and efficient seeking of all kinds
... by seeking to target offset determined by new seek segment,
rather than that of the previous segment.  The latter would typically
seek back to start for a non-accurate seek, and lead to a lot
of skipping in case of an accurate seek.
2019-12-31 10:44:35 +01:00
Stéphane Cerveau
add7878e14 bad: use of g_value_dup_string
Use helper method to get string from GValue.
2019-12-30 14:13:03 +00:00
Sebastian Dröge
0dc783d719 timecodestamper: Refactor LTC audio waiting and properly handle live inputs
If one of the inputs is live, add a latency of 2 frames to the video
stream and wait on the clock for that much time to pass to allow for the
LTC audio to be ahead.

In case of live LTC, don't do any waiting but only ensure that we don't
overflow the LTC queue.

Also in non-live LTC audio mode, flush too old items from the LTC queue
if the video is actually ahead instead of potentially waiting forever.
This could've happened if there was a bigger gap in the video stream.
2019-12-30 09:36:23 +00:00
Yeongjin Jeong
3f2240498b h265parser: Add simple GstH265Profile/string public utilites
It makes more simplifies the conversion between GstH265Profile and string.
2019-12-20 15:43:55 +00:00
Nicolas Dufresne
416728f213 autoconvert: Fix lock-less exchange or free condition
Before this change, we would free the list we just have saved.

Fixes #1158
2019-12-19 22:35:18 +00:00
Stéphane Cerveau
c6eb17be6e h264parse: Align GST_H264_PROFILE_HIGH_422 to H264 standards
According to H264 ITU standards from 06/19, GST_H264_PROFILE_HIGH_422
(profile_idc = 122) with constraint_set1_flag = 0 and
constraint_set3_flag = 0 can be mapped to high-4:2:2 or high-4:4:4.
GST_H264_PROFILE_HIGH_422 with constraint_set1_flag = 0 and
constraint_set3_flag = 1 can be mapped to high-4:2:2, high-4:4:4,
high-4:2:2-intra or high-4:4:4-intra.
2019-12-18 03:03:40 +00:00
Olivier Crête
1f766a7145 Revert "videoparseutils: support two new EIA 608 closed caption formats"
This reverts commit f5c1c90122.
2019-12-17 16:44:10 -05:00
Aaron Boxer
f5c1c90122 videoparseutils: support two new EIA 608 closed caption formats 2019-12-17 18:26:35 +00:00
Stéphane Cerveau
6bc0e9527e remove various useless linefeed in logs 2019-12-11 10:51:29 +01:00
Alicia Boya García
f816903e65 gsttestsrcbin: Avoid not-linked errors when switching tracks
The previous implementation had a very high reproducibility race where
if after a track switch, the ex-active track pad completed a buffer
chain (now returning not-linked) the flow combiner had all their pads in
non-linked state, propagating it as an error and stopping the pipeline.

By resetting the flow combiner in response to RECONFIGURE events that
race is made impossible.
2019-12-09 18:12:29 +01:00
Sebastian Dröge
812d593c4e interlace: Store unsigned integers in unsigned integer types
And add some assertions to guard against overflows and out of bounds
reads.
2019-12-03 21:12:26 +00:00
Sebastian Dröge
c67146b27a interlace: Increment phase_index before checking if we're at the end of the phase
Incrementing it afterwards will always have to phase_index >= 1 and we
will never be at the beginning (0) of the phase again, and thus never
reset timestamp tracking accordingly.

This was broken in bea13ef43b in 2010, and
causes interlace to run into integer overflows after 2^31 frames or
about 5 hours at 29.97fps. Due to usage of wrong types for the integers
this then causes negative numbers to be used in calculations and all
calculations spectacularly fail, leading to all following buffers to
have the timestamp of the first buffer minus one nanosecond.
2019-12-03 21:12:26 +00:00
Jan Alexander Steffens (heftig)
fd6c51b2e7
rtmp2sink: Only apply @setDataFrame to onMetaData messages
Only the metadata needs to be made "sticky". Custom data messages should
be passed on unmodified.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/878
2019-12-03 14:11:47 +01:00
Jan Alexander Steffens (heftig)
042e439829
rtmp2: Add gst_rtmp_message_is_metadata
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/878
2019-12-03 14:11:47 +01:00
Jan Alexander Steffens (heftig)
e07a1bb48f
rtmp2: Add gst_rtmp_connection_set_data_frame
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/878
2019-12-03 14:11:47 +01:00