Commit graph

429 commits

Author SHA1 Message Date
Edward Hervey 00a1879d65 tsparse: Use GstFlowCombiner
In addition to the fact that it's a sane thing to do for multi-source
pad elements, it also avoids the situation where just using a request
pad (and not the main static pad) would result in the processing
stopping.
2016-02-19 18:04:23 +01:00
Vineeth TM ee8a5455d0 mpegtsbase: Refactor code to check for subclass seek handling
If subclass is not able to handle seek event, then there is no need to
stop streaming and send flush events. We should simply return FALSE

https://bugzilla.gnome.org/show_bug.cgi?id=758516
2016-02-17 10:51:07 +02:00
Vineeth TM 6676ed6cb0 mpegtsbase: Add condition to check for non working negative rate
tsdemux is not able to handle negative playback rates.
But in mpegtsbase, the same check is not being done.
added a check to not handle negative rate while seeking unless
the same is handled upstream.

https://bugzilla.gnome.org/show_bug.cgi?id=758516
2016-02-17 10:51:07 +02:00
Edward Hervey a21c2618c5 tsdemux: Expose DVB Subpicture as subpictures
For some reason we were considering them as private data.
2015-12-02 14:15:04 +01:00
Edward Hervey 531117b7df tsdemux: Push GAP events *after* deactivating old programs
The order in which program switch must happen is:
1) drain all data on old pads (but don't push EOS)
2) add new pads (but don't push any data on them)
3) Push EOS and remove old pads
4) Start pushing data on new pads

There was one caveat in this implementation, which is that when
we activate a sparse pad (step 2) we would push a GAP event. The problem
is that, while being an event, it is actually *data*.

We therefore need to make sure pushing those GAP event is done at the step
we start pushing data.

https://bugzilla.gnome.org/show_bug.cgi?id=750402
2015-12-02 14:15:04 +01:00
Edward Hervey 7336294635 tsdemux: Make sure old streams are drained before switching
Before we add any streams, make sure we drain all streams. This ensures
there's consistency that only "new" data will be pushed on buffers once
the new pads are added

https://bugzilla.gnome.org/show_bug.cgi?id=750402
2015-12-02 14:15:04 +01:00
Edward Hervey 14e6d2d427 mpegtsdemux: Allow deactivation of programs to be delayed
When changing programs, the order of events needs to be the following:
* add pads from new program
* send EOS on old pads
* remove old pads
* emit 'no-more-pads'

Previously tsdemux was not doing that, and was first deactivating and
removing old pads before adding new ones.

We fix this by allowing subclasses of mpegtsbase to be able to handle
themselves the deactivation of programs. In this case tsdemux will
properly deactivate it once it has activated the new program.

https://bugzilla.gnome.org/show_bug.cgi?id=750402
2015-12-02 14:15:04 +01:00
Reynaldo H. Verdejo Pinochet 86ec812429 Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2015-11-18 16:05:42 -08:00
Nicolas Huet d65d8657e6 mpegtsdemux: fix section_data leak
If packet->payload_unit_start_indicator is true and pointer 0, there is no
discontinuity check. Therefore there could be a previous section not complete
that need to be cleared.

https://bugzilla.gnome.org/show_bug.cgi?id=758010
2015-11-13 09:37:53 +01:00
Luis de Bethencourt fc23467152 tsdemux: remove memory leak
The values of channel_mapping are copied by gst_codec_utils_opus_create_caps ()
but it doesn't free or take ownership of the g_new0 allocated memory. This
needs to be freed before going out of scope.

CID 1338692
2015-11-12 12:08:15 +00:00
Nicolas Huet 21a025c2a1 tsdemux: fix pending buffers leak when flushing
https://bugzilla.gnome.org/show_bug.cgi?id=757895
2015-11-11 15:35:54 +01:00
Etienne Peron a336181ef5 tsdemux: Fix pad leak when the pad is never exposed
If tsdemux never receives data for a stream, the corresponding pad will never
be added and stream->active will remain FALSE. When the stream is removed, the
pad will not be unreffed and will be leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=757873
2015-11-11 15:32:30 +01:00
Matthew Waters ac9a2971bd tsdemux: provide our own definition of log2()
The log2 function/macro doesn't exist when targetting android API < 18 (or MSVC
< 2013) whereas our current baseline is API 9.
2015-11-11 18:57:55 +11:00
Tim-Philipp Müller edab4deb3a glshader, tsdemux: simplify code
Jus use _delete_link() instead of _remove_link() + _free1()
2015-11-06 13:00:55 +00:00
Sebastian Dröge ee2e082a27 tsdemux: Don't create an incomplete OpusHead but set all the other caps fields instead
OpusHead is optional, the other fields are not.

https://bugzilla.gnome.org/show_bug.cgi?id=757152
2015-11-03 20:35:41 +02:00
Sebastian Dröge 2609c394d7 tsmux: Simplify Opus caps parsing by using codecutils helpers
https://bugzilla.gnome.org/show_bug.cgi?id=757152
2015-11-03 20:35:41 +02:00
Sebastian Dröge ecf7c7742c tsdemux/mux: Add support for GstAudioClippingMeta for Opus
https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02:00
Sebastian Dröge 1e785a3778 tsdemux: Add support for Opus
Code partially based on
  https://git.videolan.org/?p=ffmpeg.git;a=commit;h=74141f693ded2fbf75af56fff309d2db35183635
and based on the spec draft at
  https://wiki.xiph.org/OpusTS

Makes it possible to demux
  http://www.obe.tv/Downloads/opus.ts

https://bugzilla.gnome.org/show_bug.cgi?id=757049
2015-11-03 20:35:41 +02:00
Tim-Philipp Müller 54fc1ed5f4 tsdemux: fix latency handling again
The tsdemux latency should always be added to the minimum
latency (which is always a valid clock time value). The
"cleanup" in commit a1f709c2 made it so that it would not
be added if upstream reported 0 as minimum latency (as
e.g. udpsrc would). This broke playback of live mpeg-ts
streaming in some cases, leading to playback stutter due
to a too-small configured latency for the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=751508
2015-08-24 10:46:31 +01:00
Edward Hervey 7ea4a66b9f mpegtsdemux: Fix illogical comparision
A variable can't be two values at once. We want to stop if it's not the
actual ts *AND* not the other ts

CID #1316475
2015-08-16 12:56:56 +02:00
Luis de Bethencourt 7ddaf8741b mpegtsbase: remove redundant check
No need to check if done is True since break will already terminate the for
loop.
2015-07-29 16:52:08 +01:00
Edward Hervey 631b2d8826 mpegtsbase: Fix previous commit
We only want to do a hard reset of the observations if we're working
with TIME segments in push mode. For BYTE segment we want to keep
the observations (in order to do seeks in push-mode).
2015-07-09 18:33:00 +02:00
Edward Hervey 0247dc7489 mpegtsbase: Flush more on DISCONT buffers in push mode
When in push mode, we want to discard all previous observations from the
mpegtspacketizer when we get a DISCONT buffer.

This avoids trying to calculate bogus timestamps (estimating them using old
PCR observations).

We only do a hard reset in push-mode. In pull-mode we still need the observations
(in order to seek properly)
2015-07-09 18:15:54 +02:00
Tim-Philipp Müller f0358aac16 tsdemux: remove unnecessary check
This is not public API, use g_assert() instead of
g_return_if_fail(), so that it's compiled out in
releases. It's only called from our code, with &foo.
2015-07-08 14:50:00 +01:00
Tim-Philipp Müller eeaf4d11b7 tsdemux: add support for KLV metadata streams
There's no timestamps for these streams though, we
might want to make some up based on the last/next
video PTS or so.
2015-07-08 14:50:00 +01:00
Nicolas Dufresne 338f7e8c8d tsdemux: Segment start should match first PTS
The segment should start at first PTS, and the vairable name lower_pts
state so correctly. Though we where using the first DTS instead. This
could lead to small desynchronization of video stream.

https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-06-12 17:10:29 -04:00
Luis de Bethencourt afcb49dcce tsdemux: correct fix for dead code
Rename template to caps to keep the original intention of the code after
commit b4c9aa1c

CID #1304674
2015-06-08 14:19:27 +01:00
Luis de Bethencourt e9cb38017b Revert "tsdemux: remove dead code"
This reverts commit 0635acfec0.
2015-06-08 14:14:41 +01:00
Luis de Bethencourt 0635acfec0 tsdemux: remove dead code
After commit b4c9aa1c30 template will always be
NULL. The if conditional will always be FALSE, so removing it.

CID #1304674
2015-06-08 13:37:35 +01:00
Luis de Bethencourt 7aed8e184f tsdemux: remove ignored assignment
Function goes to done before the value set in start_offset is ever used.
2015-06-05 14:34:59 +01:00
Thiago Santos b4c9aa1c30 tsdemux: refactor pad creation
Avoid repeating the same pad creation code everywhere
2015-06-04 13:51:01 -03:00
Thiago Santos d91f5e85e7 mpegtsbase: do not access variable after unref
Data might not exist anymore
2015-06-02 16:55:08 -03:00
Aurélien Zanelli 633b4db556 tsdemux: enable Chinese AVS video stream
Chinese broadcaster encapsulate AVS video codec into MPEG2-TS. They
use the stream_id 0x42 to identify AVS video streams. It should be noted
that this id is currently within the ISO reserved range, hence it's
utilisation is unofficial.

https://bugzilla.gnome.org/show_bug.cgi?id=727731
2015-06-02 12:41:26 +01:00
Vincent Penquerc'h 1dd94be326 tsdemux: fix buffer timestamp not being in stream time
Timestamps should start at the segment start, rather than 0, so
we need to not subtract the first timestamp. This makes the sink
correctly account for running time when switching PMTs where a
stream starts not quite at zero, causing timing offsets that can
become noticeable and causing dropped frames after a few times.
2015-05-15 14:50:35 +01:00
Vincent Penquerc'h 4a219df304 tsdemux: accumulate previous segment base time 2015-05-15 14:49:04 +01:00
Vincent Penquerc'h 29fd6332a4 tsdemux: fix refcounting when applying a new PMT
A new program object is created to replace an existing one
in the programs hash table, so its refcount needs to match.

With the default of 0 refcount on creation, the next PAT
change will cause that refcount to be both incremented and
decremented (assuming the new PAT references that stream too),
which will cause the program to be destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=748412
2015-05-15 14:45:49 +01:00
Guillaume Desmottes 94446498de tsdemux: fix taglist leak
If the stream which is about to be removed still has a ref on a tag list we
should drop it.

Fix a leak which was occasionally happening with the
validate.file.playback.change_state_intensive.tron_en_ge_aac_h264_ts scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=748576
2015-04-28 14:58:03 +01:00
Jimmy Ohn 365375a1de mpegtspacketizer: fix find_subtable() return value
find_subtable() returns a pointer, so return NULL and
not FALSE when nothing is found.

https://bugzilla.gnome.org/show_bug.cgi?id=748527
2015-04-28 14:48:22 +01:00
Luis de Bethencourt 925b65b02e Rename property enums from ARG_ to PROP_
Property enum items should be named PROP_ for consistency and readability.
2015-04-27 10:55:18 +01:00
Tim-Philipp Müller 699452ef31 Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:59:32 +01:00
Luis de Bethencourt fa4822a41b tsdemux: clean assignment typo
No need to set the value twice.

https://bugzilla.gnome.org/show_bug.cgi?id=745102

CID #295122
2015-04-20 11:30:28 +01:00
Luis de Bethencourt f52cf2a7c4 tsdemux: remove dead code
position of GstSegment is an unsigned int64, it can never be below zero.

CID #1295123
2015-04-20 10:58:33 +01:00
Olivier Crête b4219a3e63 mpegtsbase: Remove unused latency query code
The behavior changes based on the type of segment,
not on the liveness of the source.
2015-04-17 13:59:08 -06:00
Olivier Crête a1f709c293 tsdemux: Cleanup latency query handling
The minimum latency is always 0 or more. And we should
requery upstream as it may have changed.
2015-04-17 13:59:08 -06:00
Edward Hervey ed27244c03 mpegtspacketizer: Unify debug statements
Use 0x%04x for PIDs
2015-04-17 16:21:28 +02:00
Edward Hervey b80ae9cdcd tsdemux: Unify duration querying code
And properly use it in the SEEKING query.

Fixes seeking with gst-play
2015-04-17 16:21:28 +02:00
Vincent Penquerc'h cb0eaeadfd tsdemux: fix segment position tracking for the general case
Different streams can have different PTS/DTS bases, and some
streams may not even have DTS.

https://bugzilla.gnome.org/show_bug.cgi?id=745102
2015-04-16 13:35:40 +01:00
Vincent Penquerc'h 338bfe5e35 tsdemux: handle seeks with no target (ie, keep current position)
Such seeks are used to change playback rate and we do not want
to alter the position in that case, so we bypass the flush/seek
logic, and set things up so a new segment is scheduled to be
regenerated.

https://bugzilla.gnome.org/show_bug.cgi?id=735100
2015-04-09 15:44:20 +01:00
Vincent Penquerc'h 68f57d20b9 tsparse: fix timestamps not updating after a PMT change
The PCRs stay locked onto the same PID as before the change,
but the relevant PID has no reason to be the same after it.

https://bugzilla.gnome.org/show_bug.cgi?id=745102
2015-04-09 15:44:20 +01:00
Vincent Penquerc'h ade79a9ad2 tsdemux: send new segment when a stream is added
This will happen when the PMT changes, replacing streams with
new ones. In that case, we need to accumulate the running time
from the previous chain in the segment base.

https://bugzilla.gnome.org/show_bug.cgi?id=745102
2015-04-09 15:44:20 +01:00