Commit graph

182 commits

Author SHA1 Message Date
Hosang Lee
f7a8ece5ef smoothstreaming: clear live adapter on seek
In live streaming, buffers sent by souphttpsrc are pushed to the live
adapter. The buffers in the adapter are sent out of mssdemux when it
is greater than 4096 bytes.

Occasionally, when seeking in live streams, if seek occurs just
after the last data chunk was received, and if this data chunk is
smaller than 4096 bytes, it will be kept in the live adapter.
This remaining data in the live adapter will be erroneously prepended
to the new data that is downloaded after seek and pushed out.
When qtdemux receives this data, since it does not start with
a moof box, it is impossible to demux the fragment, and bogus
size error will occur.

Clear out the live adapter on seek so that no unnecessary remaining
data is pushed out together with the new fragment after seeking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1345>
2020-09-30 11:48:02 +00:00
Hosang Lee
d9dda36e02 smoothstreaming: start closer to the edge in live streams
It is more appropriate to start closer to the live edge in
live streams. Some live streams maintain a large dvr window
(over few hours in some cases), so starting from the first
fragment will be too far away from the live edge.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1346>
2020-08-10 16:13:30 +09:00
Hosang Lee
e04be18c49 mssdemux: ignore unrecognized stream
Only create pads for steams with caps that can be recognized
from the fourcc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1348>
2020-06-17 06:48:18 +00:00
yychao
cb0e4bffea smoothstreaming: fix H264 CodecPrivateData parsing
Do not pass SPS nal_unit_type (0x67) into gst_h264_parse_sps()

Fixes #648
2020-03-10 12:55:05 +00:00
Tim-Philipp Müller
f218ec2794 Remove autotools build system 2019-10-14 13:54:27 +01:00
Jan Schmidt
8899a471e3 h264parse lib: Remove the SPS parse_vui_params flag
The SPS parsing functions take a parse_vui_param flag
to skip VUI parsing, but there's no indication in the output
SPS struct that the VUI was skipped.

The only caller that ever passed FALSE seems to be the
important gst_h264_parser_parse_nal() function, meaning - so the
cached SPS were always silently invalid. That needs changing
anyway, meaning noone ever passes FALSE.

I don't see any use for saving a few microseconds in
order to silently produce garbage, and since this is still
unstable API, let's remove the parse_vui_param.
2019-07-05 00:17:59 +10:00
Thibault Saunier
47a49f3381 docs: Build documentation with hotdoc 2019-05-13 17:00:00 -04:00
Thibault Saunier
7fe3f36ac8 Minor documentation fixes 2019-05-13 11:36:27 -04:00
Xabier Rodriguez Calvar
7c136bbb5e mssdemux: fix protection data double free
For not being duplicated here it was being freed when the manifest was
being destroyed and a second time when the buffer was being destroyed.
2019-03-18 15:23:07 +01:00
Nirbheek Chauhan
b55dfb5313 Add feature options for almost all plugins
The only plugins remaining are those that haven't been ported to Meson
yet, and msdk. Also, the tests are still automagic.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 19:04:38 +05:30
Xavier Claessens
83d0623293 Meson: Generate pc file for all plugins in bad
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:08:09 +01:00
Edward Hervey
6e1e87d403 smoothstreaming: Handle invalid XML
Nothing guarantees the manifest is valid and will return a root node
2017-11-21 15:33:57 +01:00
Tim-Philipp Müller
6eff4f8d81 mssdemux: fix caps leak in error code path
https://bugzilla.gnome.org/show_bug.cgi?id=787736
2017-09-15 20:34:28 +01:00
Tim-Philipp Müller
54d7e2811f meson: fix build for isoff lib addition 2017-08-26 12:03:06 +01:00
Seungha Yang
0f1de50222 smoothstreaming: Use isoff to parse tfxd/tfrf
https://bugzilla.gnome.org/show_bug.cgi?id=777825
2017-08-25 17:21:41 -07:00
Alessandro Decina
f33b2fcf4c meson: make smoothstreaming depend on gio 2017-07-20 18:44:25 +10:00
Nicolas Dufresne
4261692187 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:05:52 -04:00
Sebastian Dröge
29feef4913 mssdemux: Fix compiler warning
../subprojects/gst-plugins-bad/ext/smoothstreaming/gstmssdemux.c: In function ‘gst_mss_demux_requires_periodical_playlist_update’:
../subprojects/gst-plugins-bad/ext/smoothstreaming/gstmssdemux.c:729:16: error: unused variable ‘mssdemux’ [-Werror=unused-variable]
   GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
                ^~~~~~~~
cc1: all warnings being treated as errors
2017-04-25 13:22:33 +03:00
Matthew Waters
5199aa60d5 mss: always periodically update the manifest taking the new fragments
Without this, for streams where the content is stored indefinitely and
can be seeked on, the duration would never increase when in paused or,
until we reached near the end of the currently advertised stream (where
the internal fragment parser would see descriptions of new fragments).
2017-04-25 14:16:15 +10:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Matthew Waters
0a25fe2893 mssdemux: only add live fragments after manifest fragments
A live manifest may have a set (> LookAheadFragmentCount) of fragments
that have already been served and are stored on the server, maybe
indefinitely.  Adding the parsed live fragments after the manifest
fragments breaks duration reporting and the seekable range.

Fix by only adding parsed fragments outside the list of fragments which
assumes that the fragment list in the manifest is accurate enough to not
stray too far off what's in the retrieved data.

https://bugzilla.gnome.org/show_bug.cgi?id=779447
2017-03-27 18:42:07 +11:00
Matthew Waters
fd8d35298f Revert "adaptivedemux: answer duration queries for live streams"
Completely disabling duration reporting with live streams is not cool.

This reverts commit e1b68d9a65.

https://bugzilla.gnome.org/show_bug.cgi?id=753879
2017-03-14 16:50:30 +11:00
Nicolas Dufresne
e03e7e7574 dash/smoothstreaming: Use GST_PLUGIN_LIBTOOLFLAGS
Use the flags defined by configure script instead of always disabling
static plugins.
2017-03-08 20:04:23 -05:00
Alex Ashley
e1b68d9a65 adaptivedemux: answer duration queries for live streams
For duration queries on live streams, adaptivedemux ignores the query.
The problem then is that the query is answered by the downstream
qtdemux element, with the duration of the currently passing fragment.

This commit changes the behaviour of adaptivedemux to answer the duration
queries for live streams, returning GST_CLOCK_TIME_NONE.

    https://bugzilla.gnome.org/show_bug.cgi?id=753879
2017-03-02 19:54:04 +02:00
Arun Raghavan
a3e33a0fc1 smoothstreaming: Fix minor use after free reference
Just a matter of reordering a g_free() /after/ cleaning out all the
members.

CID 1396746
2017-01-02 17:50:02 +05:30
Philippe Normand
efbb6d2a13 mssdemux: fix meson build
Follow-up of 73721ad4e9.
Forgot to add the fragment parser in the meson build file.
2016-11-29 15:18:43 +01:00
Philippe Normand
73721ad4e9 mssdemux: improved live playback support
When a MSS server hosts a live stream the fragments listed in the
manifest usually don't have accurate timestamps and duration, except
for the first fragment, which additionally stores timing information
for the few upcoming fragments. In this scenario it is useless to
periodically fetch and update the manifest and the fragments list can
be incrementally built by parsing the first/current fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=755036
2016-11-29 14:43:41 +01:00
Philippe Normand
b35979c31a mssdemux: wrap unmodified data in protection event
PlayReady being the one of the few DRM formats encoding its data with
base64 it was not consistent to have a special case for this. So the
base64 decoding operation now needs to be done by the protection event
consumer, if needed.

https://bugzilla.gnome.org/show_bug.cgi?id=774112
2016-11-14 11:50:07 +01:00
Matthew Waters
0fbee8f374 smoothstreaming: use the duration from the list of fragments if not present in the manifest
Provides a more accurate duration for live streams that may be minutes
or hours in front of the earliest fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=774178
2016-11-11 00:18:47 +11:00
Matthew Waters
e9178fa082 smoothstreaming: implement adaptivedemux's get_live_seek_range()
Allows seeking through the available fragments that are still available
on the server as specified by the DVRWindowLength attribute in the
manifest.

https://bugzilla.gnome.org/show_bug.cgi?id=774178
2016-11-11 00:18:35 +11:00
Sebastian Dröge
4f6ae1f48c adaptivedemux: Enable bitrate selection for trick mode streaming again
And scale the bitrate with the absolute rate (if it's bigger than 1.0) to get
to the real bitrate due to faster playback.

This allowed in my tests to play a stream with 10x speed without buffering as
the lowest bitrate is chosen, instead of staying/selecting the highest bitrate
and then buffering all the time.

It was previously disabled for not very well specified reasons, which seem to
be not valid anymore nowadays.
2016-08-25 19:52:37 +03:00
Nirbheek Chauhan
42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
Tim-Philipp Müller
7d46d67c59 smoothstreaming: update fps calculation for h264 codec parser API changes
Use new gst_h264_video_calculate_framerate() API instead of fps_n/fps_d
fields in SPS struct which are to be removed.

Apparently H264 content in MSS is always non-interlaced/progressive,
so we can just pass 0 for field_pic_flag and don't need to parse any
slice headers first if there's no external signalling. But even if
that's not the case the new code is not worse than the existing code.

https://msdn.microsoft.com/en-us/library/cc189080%28VS.95%29.aspx

https://bugzilla.gnome.org/show_bug.cgi?id=723352
2016-05-28 10:29:20 +01:00
Vineeth TM
8cdfb13658 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Luis de Bethencourt
8d445ee758 mssdemux: remove unnecessary check
stream->current_fragment has the value of g_list_previous (iter) which has
just been checked. No need to check it again.

Just to be safe, use a g_assert() to check fragment before dereferencing.

CID #1352041
2016-02-09 21:41:33 +00:00
Thiago Santos
ac2734f5cb mssdemux: implement snap seeking
Implement snap seek flags handling in stream_seek to allow the
parent class to handle it for us

https://bugzilla.gnome.org/show_bug.cgi?id=759158
2016-02-04 14:20:16 -03:00
Thiago Santos
c01d266238 mssdemux: use correct seek position on reverse seeks
Otherwise it was always using the 'start' value, leading to wrong
behavior
2016-02-04 14:20:16 -03:00
Thiago Santos
1b12d7f8a3 mssdemux: only update download position if the seek requests to
Some seeks are only updating the stop position, there is no need
to change the current downloading position.
2016-02-04 14:20:16 -03:00
Thiago Santos
86fb14f5ed mssdemux: do not assert on fragment reloads for non-live
It can be used as a resource to verify if the server has updated
something in the Manifest when downloads are failing
2016-02-04 14:20:16 -03:00
Thiago Santos
731ab94cc3 adaptivedemux: handle snap seeks
Adaptive demuxers need to start downloading from specific positions
(fragments) for every stream, this means that all streams can snap-seek
to a different position when requested. Snap seeking in this case will
be done in 2 steps:

1) do the snap seeking on the pad that received the seek event and
   get the final position

2) use this position to do a regular seek on the other streams to
   make sure they all start from the same position

More arguments were added to the stream_seek function, allowing better control
of how seeking is done. Knowing the flags and the playback direction allows
subclasses to handle snap-seeking.
And also adds a new return parameter to inform of the final
selected seeking position that is used to align the other streams.

https://bugzilla.gnome.org/show_bug.cgi?id=759158
2016-02-04 14:05:08 -03:00
Tim-Philipp Müller
be03c0a7ed smoothstreaming: remove unused dependency on uridownloader 2016-01-31 16:02:33 +00:00
Thiago Santos
b7a0be23c6 adaptivedemux: replace ghostpad with a standard pad
Handling the ghostpad and its internal pad was causing more issues
than helping because of their coupled activation/deactivation
actions.

As we have to install custom chain,event and query functions it is
better to use a floating sink pad internally in the demuxer and just
use those pad functions to push through a standard pad in the demuxer

https://bugzilla.gnome.org/show_bug.cgi?id=757951
2016-01-15 11:32:37 -03:00
Maroš Ondrášek
b902c4a293 mssdemux: add depth field to audio caps if available
depth field can be retrieved from "BitsPerSample" or
from "WaveFormatEx" structure, if provided in Manifest

https://bugzilla.gnome.org/show_bug.cgi?id=758586
2015-11-24 09:13:06 -03:00
Tim-Philipp Müller
734d5a79c5 Fix code indentation 2015-11-06 19:29:49 +00:00
Philippe Normand
bf1246cb13 mssdemux: activate streams before configuring bitrate
Doing the contrary has no effect and the consequence is that playback
will start with the lowest bitrate even if we can already handle
higher bitrate.

https://bugzilla.gnome.org/show_bug.cgi?id=755108
2015-09-30 16:54:20 +01:00
Philippe Normand
ae7d938842 mssdemux: PlayReady WRM parsing support
If the manifest has a ProtectionHeader node then parse it and emit
protection events according to the specified protection SystemID.

https://bugzilla.gnome.org/show_bug.cgi?id=753613
2015-09-30 16:49:11 +01:00
Philippe Normand
5d4388bf9e mssdemux: always use timescale for gst timestamp calculation
Not doing this can lead the demuxer to attempt downloading fragments
for an invalid start time. The server would then send a HTTP
Precondition failed error, the demuxer would try some more times to
download the invalid fragment and eventually error out.

https://bugzilla.gnome.org/show_bug.cgi?id=754523
2015-09-30 10:04:37 +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
Sebastian Dröge
0cd3938345 adaptivedemux: Allow subclasses to override how a new manifest would be downloaded 2015-04-23 17:47:18 +02:00
Thiago Santos
2526c7b286 mssdemux: use correct function to clear fragment info
Just freeing the url won't reset the byte ranges and can lead to wrong
ranges being used.
2015-02-17 11:41:27 -03:00