Commit graph

9233 commits

Author SHA1 Message Date
Sebastian Dröge
a722f6e832 rtspsrc: Use a mutex for protecting against concurrent send/receives
We currently send data to the RTSP connection from multiple threads:
whenever a command is to be handled and whenever RTCP is generated. This
can cause data corruption or worse if both happen at the same time.

As such, protect gst_rtsp_connection_send() and gst_rtsp_connection_receive()
calls with a mutex. While this means that we hold a mutex during the IO
operation, this is not actually a problem as the IO operation can be
interrupted (gst_rtsp_connection_flush()) at any time and is blocking by
itself anyway.
2017-06-15 15:25:23 +03:00
Sebastian Dröge
deb9c62cd9 qtmux: Un-merge the last two stsc entries after serializing
The last entry will most likely get new samples added to it in "robust"
muxing mode, changing the samples_per_chunk and thus making it wrong to
keep the last two entries merged. It will run into an assertion later
when adding a new sample to the chunk.

Thanks to gdiener@cardinalpeak.com for the analysis of the bug and
proposal for a solution.
2017-06-15 11:50:44 +03:00
Sebastian Dröge
a82e38d607 wavparse: Actually clip to upstream size instead of size of the data chunk
There might be other chunks after the data chunk, so clipping the chunk
size with the data size can lead to a negative number and all following
calculations go wrong and cause crashes or worse.

This was introduced in 3ac119bbe2.

https://bugzilla.gnome.org/show_bug.cgi?id=783760
2017-06-14 00:11:17 +03:00
Vivia Nikolaidou
96cd941788 splitmux: Drop allocation queries
They can cause us to deadlock, while we're waiting for a new frame and
upstream is waiting for the allocation query to be answered before
sending a frame

https://bugzilla.gnome.org/show_bug.cgi?id=783753
2017-06-13 18:29:37 +03:00
Mathieu Duponchelle
f6283b082e rtspsrc: uniquify stream ids
https://bugzilla.gnome.org/show_bug.cgi?id=783307
2017-06-07 23:30:05 +02:00
Jimmy Ohn
55e0b18186 qtdemux: remove not needed code
remove not needed code about res variable.

https://bugzilla.gnome.org/show_bug.cgi?id=783422
2017-06-06 11:02:59 +02:00
Tim-Philipp Müller
18b53c2236 rtph265depay: fix caps leak 2017-06-02 11:30:15 +01:00
Tim-Philipp Müller
a68a7fb65d rtph264depay: simplify buffer accumulation control flow
There is no difference between pushing out a buffer directly
with gst_rtp_base_depayload_push() and returning it from the
process function. The base class will just call _depayload_push()
on the returned buffer as well.

So instead of marshalling buffers through three layers and back,
just push them from one place in handle_nal() and always return
NULL from the process vfunc. This simplifies the code a little.

Also rename _push_fragmentation_unit() to _finish_fragmentation_unit()
for clarity. Push sounds like it means being pushed out, whereas
it might just be pushed into an adapter.

This change has the side-effect that multiple NALs in a single STAP
(such as SPS/PPS) may no longer be pushed out as a single buffer if
we output NALs in byte-stream format (i.e. not aggregate AUs), but
that shouldn't really make any difference to anyone.
2017-06-01 17:32:17 +01:00
Juan Navarro
72d2afda18 rtpsession: print value of unknown RTCP Payload Type
This adds printing the actual value of any unknown RTCP PT
to the already existing WARNING log message.

https://bugzilla.gnome.org/show_bug.cgi?id=783248
2017-05-31 10:20:27 +03:00
Tim-Philipp Müller
a9f9166004 rtpopusdepay: minor perf improvements
Use the ::process_rtp_packet() vfunc to avoid mapping the
RTP buffer twice.

gst_rtp_buffer_get_payload_buffer() returns a new sub-buffer
which will always be writable, so no need to make it writable.
2017-05-24 16:41:45 +01:00
Tim-Philipp Müller
f9a740b319 rtp: opus: use existing utility funcs for copying/dropping metas
We had our own copies of those while the code was in -bad, but now
we can use the existing utility functions instead of re-implementing
them.
2017-05-24 16:18:01 +01:00
Tim-Philipp Müller
4a28e649c3 rtp: cache meta tag quarks and add more utility functions for metas
Every g_quark_from_static_string() is a hash table lookup serialised
on the global quark lock in GLib. Let's just look up the two quarks
we need once and cache them locally for future use. While we're at it,
add new utility functions for the two most commonly used tags
(audio + video). Make first argument a gpointer so we don't have to
cast and make the code ugly. These are used for logging purposes
only anyway.
2017-05-24 13:32:10 +01:00
vijay
810c0bb084 aacparse : Fix, Caps were not set while reusing aacparse
While reusing aacparse caps were not set.This fix enables aacparse to reuse in same pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=783027
2017-05-24 13:59:52 +02:00
Tim-Philipp Müller
e67a5a9f18 multifile: remove some cruft 2017-05-21 10:33:43 +01:00
Luis de Bethencourt
fb00a357cd multifilesink: fix property name in example pipeline
Since the move from CVS the property name of the documentation example
has been filename instead of location. Users trying the gst-launch
command as is will get:
no property name "filename" in element

Fixing it.
2017-05-20 11:51:33 +01:00
Edward Hervey
4f713717de isomp4: Safely ignore [skip] atoms
Instead of warning about them
2017-05-18 18:12:15 +02:00
Tim-Philipp Müller
6cb49cf2c3 Fix up package name and origin in some plugins 2017-05-18 10:44:07 +01:00
Nicolas Dufresne
b68d936ae0 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:41:19 -04:00
Vivia Nikolaidou
a910329f6d splitmuxsink: Add alignment-threshold argument
If a non-reference stream is behind the reference stream by an amount of
time smaller than the alignment threshold (in nsec), it counts as being
after it.

https://bugzilla.gnome.org/show_bug.cgi?id=782563
2017-05-16 15:30:52 +03:00
Vivia Nikolaidou
5f7fe63fea qtmux: Do not check timecode data for mp4 container
Timecode trak is only supported for mov right now, not for mp4. That
code would otherwise create an invalid trak if the muxed video contained
timecode metadata.

https://bugzilla.gnome.org/show_bug.cgi?id=782684
2017-05-16 15:16:58 +03:00
Sebastian Dröge
347e814074 qtmux: When accepting renegotiation, just return TRUE and change nothing
We only accept new caps if they are basically the same. We don't want to
reset anything as if the caps are new, otherwise various state could get
out of sync with the current run.
2017-05-11 20:01:15 +02:00
Sebastian Dröge
10f4693163 qtmux: In prefill mode, only pad buffers with > 0 sized memories as needed
Adding a 0-byte memory has not much effect.

Also add some debug output.
2017-05-11 19:21:22 +02:00
Sebastian Dröge
63492ee141 qtmux: Lateness is in QT timescale, diff in GstClockTime
Print the right one in debug output to get meaningful numbers.
2017-05-10 15:58:41 +02:00
Sebastian Dröge
163b62fc25 qtmux: Error out if a gap edit list has to be written in prefill mode
We don't have any space reserved for this in the moov and the
pre-finalized moov would have broken A/V synchronization. Error out here
now
2017-05-10 14:31:40 +02:00
Sebastian Dröge
c0f505e80e qtmux: Calculate with reserved moov size instead of last moov size
We have some padding added after the initial moov, so a bigger updated
moov can be handled to some degree and is expected. Previously we just
ignored the padding and errored out in cases when the padding would've
just been enough.
2017-05-10 11:42:09 +02:00
Sebastian Dröge
419f53259f qtmux: Error out directly if sending filler data results in a flow error
CID 1405994
2017-05-10 11:12:23 +02:00
Sebastian Dröge
3fcfe774e6 qtmux: In prefill mode, handle the case when only the first chunk was ever used 2017-05-09 16:02:43 +02:00
Sebastian Dröge
55f949676e qtmux: Add new prefill recording mode
This sets up a moov with the correct sample positions beforehand and
only works with constant framerate, I-frame only streams.

Currently only support for ProRes and raw audio is implemented but
adding new codecs is just a matter of defining appropriate maximum frame
sizes.

https://bugzilla.gnome.org/show_bug.cgi?id=781447
2017-05-09 14:17:04 +02:00
Sebastian Dröge
f0163a016c qtmux: Error out on discontinuities/gaps when muxing raw audio
When muxing raw audio, we have no way of storing timestamps but are just
storing a continuous stream of audio samples. If the difference between
the expected and the real timestamp becomes to big, we should error out
instead of silently creating files with wrong A/V sync.

https://bugzilla.gnome.org/show_bug.cgi?id=780679
2017-05-09 14:16:51 +02:00
Tim-Philipp Müller
d826c5ad96 matroskademux: improve index memory usage
Re-arrange order of index entry struct members to avoid padding
bytes in the middle of the struct, thus potentially reducing the
overall size of the struct and reducing memory used by the index.
On Linux x86_64 the size goes down from 32 bytes to 24 bytes for
each index entry.
2017-05-06 22:39:31 +01:00
Seungha Yang
66448be77f qtdemux: Fix crash on mss stream caused by invalid stsd entry access
Since mss has no moov, default stsd entry should be created with media-caps.

https://bugzilla.gnome.org/show_bug.cgi?id=782042
2017-05-02 14:20:02 +03:00
Sebastian Dröge
875fc630d5 qtdemux: Don't crash in debug output if stream==NULL
That case is correctly handled below but not in the debug output.

https://bugzilla.gnome.org/show_bug.cgi?id=781270
2017-04-27 12:56:27 +03:00
Sebastian Dröge
a593e4966e qtdemux: Don't perform seeks with inconsistent seek values
If gst_segment_do_seek() fails, we shouldn't try seeking on that
resulting segment but just error out. Crashes further down the line
otherwise.
2017-04-25 17:12:30 +03:00
Tim-Philipp Müller
e7e7f26200 rtph264depay: don't insert SPS/PPS inline for AVC output
SPS/PPS are in the caps in this case and shouldn't be in
the stream data.
2017-04-24 17:29:37 +01:00
Sebastian Dröge
c99f7579f3 rtspsrc: Chain up to the parent class' provide_clock() implementation
If no clock was provided directly by rtspsrc. This behaviour was removed
by f8013487c9 and results in rtspsrc not
providing the system clock via the rtpjitterbuffer.

As a result, if another element like an audio sink, provides a clock,
the pipeline would select that (when going to PAUSED/PLAYING again later).
Audio clocks usually don't progress in PAUSED, and thus our live source
won't be able to use the clock to produce data, making the sink never
preroll and everything is stuck.
2017-04-21 19:14:09 +01:00
Jürgen Sachs
7c658c3c04 qtdemux: reset sample_description_id to default
Fixes stream where sample_description_id is specified in the tfhd

https://bugzilla.gnome.org/show_bug.cgi?id=778337
2017-04-21 06:45:10 +02:00
Sebastian Dröge
fe77e2efe8 splitmuxsink: Don't use an explicit name for requesting audio pads
... unless the muxer uses the same audio pad template name as
splitmuxsink. We can't request a pad called "audio_0" on a muxer that
wants pads to be "sink_%d".
2017-04-20 13:17:33 +01:00
ChangBok Chae
3d19d6d8bc flvdemux: remove duplicated segment initialization
It's also done in gst_flv_demux_cleanup().

https://bugzilla.gnome.org/show_bug.cgi?id=779106
2017-04-20 12:42:58 +01:00
Xavier Claessens
6b42569ded splitmuxsink: Correctly catch FLUSH events in probes
https://bugzilla.gnome.org/show_bug.cgi?id=767498
2017-04-20 20:17:35 +10:00
Tim-Philipp Müller
50a4b5bc0d Revert "rtpbin: pipeline gets an EOS when any rtpsources byes"
This reverts commit eeea2a7fe8.

It breaks EOS in some sender pipelines, see
https://bugzilla.gnome.org/show_bug.cgi?id=773218#c20
2017-04-19 12:28:12 +01:00
Edward Hervey
58e3033747 qtdemux: Reset adapter in more discontinuity cases
In push mode we process as much as possible in the adapter. When we receive
a DISCONT buffer which we can't match to an actual sample (based on the existing
sample table) and there is still data remaining in the incoming adapter,there is
one of two cases happening:
1) We are doing reverse playback, in which case we should flush out all pending
  data
2) We have leftover data from the previous incoming buffer... which we can't do
  anything about.

For the second case, make sure we flush out the remaining data so that we can start
parsing again from scratch.

https://bugzilla.gnome.org/show_bug.cgi?id=781319
2017-04-17 13:10:06 +02:00
Edward Hervey
474819cc3d rtspsrc: Use GST_ELEMENT_ERROR_WITH_DETAILS
Allows the application to know the exact status code that was returned
by the server in a programmatic fashion.

https://bugzilla.gnome.org/show_bug.cgi?id=781304
2017-04-17 13:10:06 +02:00
Seungha Yang
3b9ea4b85f qtdemux: Fix leak on QtDemuxStreamStsdEntry
Fix unit test failure

https://bugzilla.gnome.org/show_bug.cgi?id=781362
2017-04-16 23:37:55 +01:00
Sebastian Dröge
e51c08b0a2 qtmux: Fix timescale of timecode tracks
They should have ideally the same timescale of the video track, which we
can't guarantee here as in theory timecode configuration and video
framerate could be different. However we should set a correct timescale
based on the framerate given in the timecode configuration, and not just
use the framerate numerator.
2017-04-14 13:38:53 +03:00
Edward Hervey
c6e9c67f63 qtdemux: Properly reset demuxer when all streams are EOS
Make sure offset and neededbytes are properly resetted when all
streams are EOS in push-mode.

Avoids cases when some data might still be pushed by upstream (because
it didn't yet see the resulting GST_FLOW_EOS yet) and qtdemux gets
completely lost.

https://bugzilla.gnome.org/show_bug.cgi?id=781266
2017-04-13 13:26:36 +02:00
Edward Hervey
7077425c3d qtmux: Don't forget to update pad->last_buf
buf is the current pad->last_buf value. If ever it gets copied/unreffed,
we need to make sure to write back the new  pointer to the last_buf
variable.

Fixes using wrong pointer values in the case of decrasing DTS value
2017-04-12 13:26:59 +02:00
Jürgen Sachs
9684c88c60 qtdemux: fix: sample description index override in tfhd not evaluated
https://bugzilla.gnome.org/show_bug.cgi?id=778337
2017-04-12 11:04:46 +02:00
Edward Hervey
26f9869668 qtdemux: Add out-of-bound check
Make sure we don't read invalid memory
2017-04-12 11:03:24 +02:00
Thiago Santos
9ac3861a9b qtdemux: move parsing of tkhd out of stsd entry loop
It needs only to be read once.
2017-04-11 23:42:56 -07:00
Thiago Santos
cf6733a55e qtdemux: check for a different stsd entry before pushing a sample
Before pushing a sample, check if there was a change in the current
stsd entry. This patch also assumes that the first stsd entry is
used as default for the first sample. It might cause an uneeded
caps renegotiation when this isn't the case.
2017-04-11 23:42:56 -07:00