Commit graph

219 commits

Author SHA1 Message Date
Sebastian Dröge
6cafc64416 mpdparser: If no Initialization is present in the SegmentBase, assume it is before the indexRange
https://bugzilla.gnome.org/show_bug.cgi?id=755132
2015-09-25 23:52:28 +02:00
Sebastian Dröge
a25253130b mpdparser: Only check stream->segments for a repeated last segment if we have a static list of segments
Otherwise we'll crash, trying to derefence NULL. And if we have no static list
of segments, we can't have repeated segments anyway.

Regression introduced by cfe2871a5e

https://bugzilla.gnome.org/show_bug.cgi?id=755411
2015-09-22 15:03:13 +02:00
Vincent Penquerc'h
50400fa2a6 mpdparser: support for negative repeat count in segments
Implements negative repeat segment fields, defined in 5.3.9.6.1.
2015-09-16 09:44:20 +01:00
Vincent Penquerc'h
69bfa8222f mpdparser: properly read signed r values for S elements
The spec defines these as signed in 5.3.9.6.1.
Since we don't support this behavior, warn and default to 0
(non repeating), which is the spec's default when the value
is not present.

https://bugzilla.gnome.org/show_bug.cgi?id=752480
2015-09-16 09:44:19 +01:00
Vincent Penquerc'h
23ea8ccb43 mdpparser: catch failures to parse
https://bugzilla.gnome.org/show_bug.cgi?id=752480
2015-09-16 09:44:19 +01:00
Sebastian Dröge
c9f60db2d4 mpdparser: Don't consider period start times in periods with segment lists either
https://bugzilla.gnome.org/show_bug.cgi?id=754222
2015-09-14 19:53:18 +02:00
Sebastian Dröge
0d0455e346 dashdemux: Export the period start time to the base class
https://bugzilla.gnome.org/show_bug.cgi?id=754222
2015-09-14 19:53:03 +02:00
Sebastian Dröge
b5697b8ced Revert "dashdemux: Subtract the period start time from the presentation offset"
This reverts commit 626a8f0a74.

This allows us to get the plain presentation offset and the period start time
separately. We have to adjust the timestamp by the presentation offset, but
the period start time should only adjust the stream time and running time.

https://bugzilla.gnome.org/show_bug.cgi?id=752409
2015-09-14 19:53:03 +02:00
Sebastian Dröge
bb05bbafd5 Revert "dashdemux: Include the period start in the fragment timestamps in all cases"
This reverts commit e671ad25a9.

The timestamps should restart at 0 again for each period, but we have to
adjust the segment to map those timestamps to the actual stream time and
running time of that period.

Otherwise we would have timestamps that conflict with the ones from the tfdt
inside the MP4 container, which are restarting at 0 for each period.

https://bugzilla.gnome.org/show_bug.cgi?id=752409
2015-09-14 19:53:03 +02:00
Sebastian Dröge
cfe2871a5e mpdparser: Consider the repeat count when checking if a segment is the last one
Otherwise we play only the first repetition of the last segment and then EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=752480
2015-09-14 19:49:14 +02:00
Vincent Penquerc'h
6d1eda9391 mpdparser: fix period start time scaling
This GstStreamPeriod start value is expressed in nanoseconds,
and the glib time addition function expects microseconds.
There seems to have been a confusion with GstPeriodNode's start
field, which is expressed in milliseconds.

Additionally, add a warning if the timestamp modification did
not succeed, and NULL was returned.
2015-09-07 12:52:03 +01:00
Sebastian Dröge
551e7b97f3 dashdemux: Handle encoding specified in the <xml> element when dumping nodes
Previous patch did not handle the case where an encoding (e.g. UTF-8) is
specified in the <xml ?> element. Added an extra test for with and without
encoding.

https://bugzilla.gnome.org/show_bug.cgi?id=753813
2015-08-19 21:33:47 +03:00
Alex Ashley
2ebebdbfbb dashdemux: replace xmlNodeDump with xmlNodeDumpOutput
When running on an STB, the function
gst_mpdparser_get_xml_node_as_string causes a segmentation fault. This
code works correctly on a Linux desktop.

Looking at the libxml documentation, the xmlNodeDump is deprecated.
Replacing the use of xmlNodeDump with xmlNodeDumpOutput fixes the
segfault on the STB and removes the use of the deprecated function.
2015-08-19 16:30:58 +03:00
Sebastian Dröge
31d381d5f8 mpdparser: Free UTCTiming struct if there are no values associated with it
CID 1316479
2015-08-16 12:52:51 +02:00
Alex Ashley
95c705ae8f dashdemux: add support for UTCTiming elements for clock drift compensation
Unless the DASH client can compensate for the difference between its
clock and the clock used by the server, the client might request
fragments that either not yet on the server or fragments that have
already been expired from the server. This is an issue because these
requests can propagate all the way back to the origin

ISO/IEC 23009-1:2014/Amd 1 [PDAM1] defines a new UTCTiming element to allow
a DASH client to track the clock used by the server generating the
DASH stream. Multiple UTCTiming elements might be present, to indicate
support for multiple methods of UTC time gathering. Each element can
contain a white space separated list of URLs that can be contacted
to discover the UTC time from the server's perspective.

This commit provides parsing of UTCTiming elements, unit tests of this
parsing and a function to poll a time server. This function
supports the following methods:
    urn:mpeg:dash:utc:ntp:2014
    urn:mpeg:dash:utc:http-xsdate:2014
    urn:mpeg:dash:utc:http-iso:2014
    urn:mpeg:dash:utc:http-ntp:2014

The manifest update task is used to poll the clock time server,
to save having to create a new thread.

When choosing the starting fragment number and when waiting for a
fragment to become available, the difference between the server's idea
of UTC and the client's idea of UTC is taken into account. For example,
if the server's time is behind the client's idea of UTC, we wait for
longer before requesting a fragment

[PDAM1]: http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=66068

dashdemux: support NTP time servers in UTCTiming elements

Use the gst_ntp_clock to support the use of an NTP server.

https://bugzilla.gnome.org/show_bug.cgi?id=752413
2015-08-14 06:47:20 -03:00
Thiago Santos
620af5b04b dash: mpdparser: plug leak in segmenttemplate parsing
Only copy the values from the parent if the current node doesn't
have that value, they were being copied from the parent and
then overwriten by the child node, leaking the parent's copy
2015-08-01 16:11:07 -03:00
Florin Apostol
a7751aa967 dashdemux: gst_mpdparser_get_xml_prop_duration sets default value in case of parsing errors
The gst_mpdparser_get_xml_prop_duration function will set the
property_value to the default_value in case the parsing fails.

https://bugzilla.gnome.org/show_bug.cgi?id=752426
2015-07-27 12:37:09 -03:00
Florin Apostol
90b7c137b6 dahdemux: avoid overflows in computation of segment start time and duration
Used gst_util_uint64_scale to avoid overflows when segment start time
or duration is computed.

https://bugzilla.gnome.org/show_bug.cgi?id=752620
2015-07-24 10:09:19 -03:00
Alex Ashley
71a1e3669a dashdemux: add support for generating Protection events from ContentProtection elements
If a ContentProtection element is present in an AdaptationSet element,
send Protection events on the source pad, so that qtdemux can use this
information to correctly generate its source caps for DASH CENC
encrypted streams.

This allows qtdemux to support CENC encrypted DASH streams where the
content protection specific information is carried in the MPD file
rather than in pssh boxes in the initialisation segments.

This commit adds a new function to the adaptivedemux base class to allow
a GstEvent to be queued for a stream. The queue of events are sent the
next time a buffer is pushed for that stream.

https://bugzilla.gnome.org/show_bug.cgi?id=705991
2015-07-20 16:04:22 +01:00
Florin Apostol
e12d3d9be2 dashdemux: default timescale is 1
default timescale value should be 1, not 0.

https://bugzilla.gnome.org/show_bug.cgi?id=752414
2015-07-16 20:05:58 +01:00
Florin Apostol
8b558d68cb dashdemux: free prop_string only after it's no longer needed
https://bugzilla.gnome.org/show_bug.cgi?id=752419
2015-07-16 19:57:40 +01:00
Sebastian Dröge
a6507de48e mpdparse: g_slice_new() can't return NULL
It will abort() if allocation fails.
2015-07-10 13:26:51 +03:00
Sebastian Dröge
77b618ca77 mpdparser: Don't allow network access when reading the XML data 2015-07-10 13:20:26 +03:00
Sebastian Dröge
cd47556351 mpdparser: Fix some memory leaks in the MPD parser and unit test 2015-07-08 23:15:14 +03:00
Sebastian Dröge
a755fbb440 Revert "Revert "dashdemux: fixed gst_mpd_client_advance_segment to return GST_FLOW_EOS""
This reverts commit 4875ddf585.

This was based on a misunderstanding of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=752085
2015-07-08 16:33:50 +03:00
Sebastian Dröge
4875ddf585 Revert "dashdemux: fixed gst_mpd_client_advance_segment to return GST_FLOW_EOS"
This reverts commit dfe37ffc59.

https://bugzilla.gnome.org/show_bug.cgi?id=752085
2015-07-07 19:51:39 +03:00
Sebastian Dröge
07d27d906a mpdparser: Fix off-by-one in has-next-segment calculation 2015-07-07 19:51:39 +03:00
Florin Apostol
cc9885ef4e dashdemux: added parsing of bitstreamSwitching@AdaptationSet
https://bugzilla.gnome.org/show_bug.cgi?id=751170
2015-07-07 14:08:04 +03:00
Florin Apostol
dfe37ffc59 dashdemux: fixed gst_mpd_client_advance_segment to return GST_FLOW_EOS
Fixed gst_mpd_client_advance_segment to return GST_FLOW_EOS if the
new index is out of range.

https://bugzilla.gnome.org/show_bug.cgi?id=751850
2015-07-07 13:30:07 +03:00
Florin Apostol
8551f74a05 dashdemux: fixed segment start when specified by SegmentTimeline
@t attribute in segment Timeline is relative to the period start.
Corrected the code to take this into account when computing segment
timestamp.

https://bugzilla.gnome.org/show_bug.cgi?id=751841
2015-07-05 13:54:00 -03:00
Florin Apostol
8e82129875 dashdemux: wrong segment duration computed by gst_mpd_client_setup_representation
Corrected computation of segment start and duration.

https://bugzilla.gnome.org/show_bug.cgi?id=751914
2015-07-05 13:31:38 -03:00
Florin Apostol
5151c42085 dashdemux: corrected search for audio languages
Corrected the initialisation of mimeType in
gst_mpdparser_get_list_and_nb_of_audio_language: the variable is used
in a loop, so it must be set to NULL at the beginning of each iteration.

https://bugzilla.gnome.org/show_bug.cgi?id=751911
2015-07-05 13:25:12 -03:00
Florin Apostol
0f37768626 dashdemux: corrected parsing of %u in segment templates
https://bugzilla.gnome.org/show_bug.cgi?id=751716
2015-06-30 15:24:28 +02:00
Florin Apostol
e2d1126391 dashdemux: corrected recognition of $$$ in segment templates
fixed recognition of $$ after a $ that ends an identifier, eg $Time$$$

https://bugzilla.gnome.org/show_bug.cgi?id=751682
2015-06-29 19:28:56 -03:00
Florin Apostol
e09cf2f3b6 dashdemux: corrected next fragment duration validation
Before returning the next fragment duration value, the
gst_mpd_client_get_next_fragment_duration function tries to validate it.
But the condition was incorrect.

https://bugzilla.gnome.org/show_bug.cgi?id=751539
2015-06-26 10:43:42 -03:00
Sebastian Dröge
626a8f0a74 dashdemux: Subtract the period start time from the presentation offset
We're interested in the offset between the period start timestamp and the
actual media timestamp so that we can properly correct for it. The absolute
presentation offset to timestamp 0 is useless as the only thing we really
care about is the offset between the current fragment timestamp and the
media timestamp.
2015-06-25 23:36:10 +02:00
Sebastian Dröge
95eb1aa49c dashdemux: Subtract the period start when seeking based on a template
Otherwise we will look for segments after the period usually. The seek
timestamp is relative to the start of the first period and we have to
select a segment relative to the current period's start.
2015-06-25 23:36:09 +02:00
Sebastian Dröge
e671ad25a9 dashdemux: Include the period start in the fragment timestamps in all cases
We didn't do this for fragments that are generated on demand from a template,
only for the other cases when they were all generated upfront. This caused
fragment timestamps to start from 0 again for each new period.
2015-06-25 23:35:46 +02:00
Florin Apostol
fa9b03186a dash: Correct check for valid timeShiftBufferDepth
If not set, the timeShiftBufferDepth has a default value of -1.
The standard says that this should be interpreted as infinite.

The gst_mpd_client_check_time_position function incorrectly compares
timeShiftBufferDepth with 0 instead of -1 to determine if it was set.

https://bugzilla.gnome.org/show_bug.cgi?id=751500
2015-06-25 16:27:18 +02:00
Florin Apostol
dbf12ab760 dashdemux: Corrected duration argument for gst_mpd_client_add_media_segment call
The last parameter of gst_mpd_client_add_media_segment function is a
duration. But when called from gst_mpd_client_setup_representation, the
last argument was wrongly set to PeriodEnd

https://bugzilla.gnome.org/show_bug.cgi?id=751449
2015-06-25 10:16:24 +02:00
Florin Apostol
93f08347de dashdemux: incorrect use of period start
The period start information, calculated in gst_mpd_client_setup_media_presentation
function is stored in stream_period->start. The information read from
xml file and stored in stream_period->period->start is not changed.

If the xml file does not contain the period start information,
stream_period->period->start will be -1.

The function gst_mpd_client_get_next_segment_availability_end_time wants to
use period start time, but incorrectly uses stream_period->period->start
(value from xml file, which could be -1) instead of stream_period->start
(computed value)

https://bugzilla.gnome.org/show_bug.cgi?id=751465
2015-06-25 10:14:30 +02:00
Florin Apostol
8336d7a60b dashdemux: corrected computation of period's duration
According to ISO/IEC 23009-1:2014(E), chapter 5.3.2.1
"The Period extends until the PeriodStart of the next Period, or until
the end of the Media Presentation in the case of the last Period."

This means that a configured value for optional attribute period duration
should be ignored if the next period contains a start attribute or it is
the last period and the MPD contains a mediaPresentationDuration attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=750797
2015-06-22 13:47:54 +02:00
Florin Apostol
d268f812eb dashdemux: added warnings in gst_mpd_client_setup_streaming function
Added some warning messages in gst_mpd_client_setup_streaming to help
debug situations when the function will return FALSE.

Renamed a wrongly spelled variable.

https://bugzilla.gnome.org/show_bug.cgi?id=751149
2015-06-18 12:40:01 -03:00
Florin Apostol
9f56cc27ab dashdemux: fixed getting representation based on max bandwidth
The gst_mpdparser_get_rep_idx_with_max_bandwidth function assumes
representations are ordered by bandwidth and incorrectly returns the
first one when wanting the one with minimum bandwidth.

Corrected gst_mpdparser_get_rep_idx_with_max_bandwidth function to get the
correct representation in case max_bandwidth parameter is 0.

https://bugzilla.gnome.org/show_bug.cgi?id=751153
2015-06-18 11:29:45 -03:00
Florin Apostol
b23e4452a2 dashdemux: fixed segfault for missing default namespace
Added a check for a_node->ns before accessing a_node->ns->href in
gst_mpdparser_get_xml_node_namespace. This could happen if the xml
is missing the default namespace.

https://bugzilla.gnome.org/show_bug.cgi?id=750866
2015-06-12 22:45:51 +02:00
Alex Ashley
5beeccdba2 dashdemux: fix error calculating large presentationTimeOffset values
If the presentationTimeOffset attribute of a DASH manifest contains
a value that is larger than 2^32, gstmpdparser incorrectly calculates
the stream's presentation time offset. This is due to two bugs:

1: Using gst_mpdparser_get_xml_prop_unsigned_integer rather than
   gst_mpdparser_get_xml_prop_unsigned_integer_64 to parse the
   attribute
2: gst_mpd_client_setup_representation multiplying the value by
   GST_SECOND and then dividing by timescale

https://bugzilla.gnome.org/show_bug.cgi?id=750804
2015-06-11 19:41:11 +02:00
Sebastian Dröge
9bcddde9bc mpdparser: Fix inverted logic introduced in last commit 2015-06-05 14:33:57 +02:00
Sebastian Dröge
15de547760 mpdparser: Calculate the number of segments we have when a segment template instead of a list is used
Otherwise we would just continue downloading new files forever until we get
404 for the first one, and then error out instead of going EOS.
2015-06-05 14:11:47 +02:00
Sebastian Dröge
ec226e856d Revert "mpdparser: Don't consider streams with a known media presentation duration as live"
This reverts commit 37011e5198.

This change was actually completely unnecessary, the streams in question are
marked as static and are not considered live anyway.
2015-06-05 13:28:39 +02:00
Sebastian Dröge
37011e5198 mpdparser: Don't consider streams with a known media presentation duration as live 2015-06-05 13:21:55 +02:00
Sebastian Dröge
2b207c0b65 mpdparser: Don't crash in debug output if stream->segments is NULL 2015-06-04 15:58:46 +02:00
Sebastian Dröge
64a2dcf582 mpdparse: Clamp seek times to the availabilityStartTime
Otherwise we will seek to negative times, which are interpreted as unsigned
integers later.
2015-06-04 13:36:05 +02:00
Sebastian Dröge
f9ada426d4 mpdparser: Improve debug output a bit when advancing segments 2015-06-04 13:13:39 +02:00
Sebastian Dröge
60047b6b92 mpdparser: Use 64 bit integer format strings when passing a 64 bit integer
Otherwise we'll only get half of its bits printed on 32 bit architectures.

For this, promote the %d-style format strings to something that accepts
64 bit integers with G_GINT64_MODIFIER.
2015-06-04 11:05:07 +02:00
Sebastian Dröge
1be223fdc3 mpdparse: Validate format strings before using them
Using format strings from an untrusted source without validation is
calling for problems, and at least allows to remotely crash your application.
If not worse.
2015-06-04 10:47:07 +02:00
Sebastian Dröge
88d8dfd9c6 mpdparser: Add the startNumber as offset to the segment index when using a template 2015-06-03 20:03:59 +02:00
David Waring
c4ff5359aa dashdemux: Fix segfault introduced by segment iteration refactoring (2105a310).
The functions to get the next fragment, next fragment timestamp and to advance
to the next fragment need to work differently when stream->segments is NULL.
Use logic similar to that introduced by commit 2105a310 to perform these
functions.

https://bugzilla.gnome.org/show_bug.cgi?id=749684
2015-05-25 10:02:07 -03:00
Thiago Santos
0910540d58 dashdemux: use signed integet to represent segment index
We need to be able to represent -1 to check when we are EOS
on reverse playback and unsigned integer won't allow that.

CID #1298193
CID #1298194
CID #1298195

https://bugzilla.gnome.org/show_bug.cgi?id=749534
2015-05-25 09:02:30 -03:00
Thiago Santos
f4789d0430 dashdemux: avoid busy-looping when waiting for new fragment
When all fragments have already been downloaded on a live stream
dashdemux would busy loop as the default implementation of
has_next_fragment would return TRUE. Implement it to correctly
signal if adaptivedemux should wait for the manifest update before
trying to get new fragments.
2015-05-13 13:39:32 -03:00
Thiago Santos
23ad922b64 dashdemux: Improve live stream manifest update repositioning
When updating the manifest the timestamps on it might have changed a little
due to rounding and timescale conversions. If the change makes the timestamp
of the current segment to go up it makes dashdemux reposition to the previous
one causing one extra unnecessary download.

So when repositioning add an extra 10 microseconds to cover for that rounding
issues and increase the chance of falling in the same segment.

Additionally, also improve the time used when the client is already after the
last segment. Instead of using the last segment starting timestamp use the
final timestamp to make it reposition to the next one and not to the one that
has already been downloaded.
2015-05-13 13:39:31 -03:00
Thiago Santos
7de9fbc122 dashdemux: add more protection when acessing gptrarray entries
The glib structure doesn't do range checking so we have to do it
ourselves.

Also adds some more debugging messages
2015-05-13 13:39:24 -03:00
Thiago Santos
f298fca8ad dashdemux: remove unused functions
These functions of directly getting and setting segment indexes
are no longer useful as now we need 2 indexes: repeat and segment
index.

The only operations needed are advance_segment, going back to the
first one or seeking for a timestamp.
2015-05-13 13:39:18 -03:00
Thiago Santos
d617139ee7 dashdemux: reuse seeking function to reduce repeated code
Instead of writing a seek routine, just use the mpdparser function.

Also remove function that is not needed anymore
2015-05-13 13:35:14 -03:00
Thiago Santos
57a2105a31 dashdemux: refactor segment iteration for better performance
Segments are now stored with their repeat counts instead of spanding
them to multiple segments. This caused advancing to the next segment
using a single index to have to iterate over the whole list every time.

This commit addresses this by storing both the segment index as well
as the repeat index and makes advancing to next segment just an
increment of the repeat or the segment index.
2015-05-13 13:35:14 -03:00
Thiago Santos
6344f86e44 dashdemux: improve mpd parsing for repeated segment entries
Use a single segment to represent it internally to avoid using too
much memory. This has the drawback of issuing a linear search to
find the correct segment to play but this can be fixed by using
binary searches or caching the current position and just looking
for the next one.

https://bugzilla.gnome.org/show_bug.cgi?id=748369
2015-05-13 13:35:14 -03:00
Jun Xie
9e6198d9ef dashdemux: set default @startNumber and also avoid wrong overwrite
Set default @startNumber to 1, if @startNumber is missing at all level.
Also avoid incorrect overwriting inherited value.

https://bugzilla.gnome.org/show_bug.cgi?id=746347
2015-03-24 16:35:59 -03:00
xixi
5a1ed14c3c dashdemux: fetch wrong segment at the end of Period
Fix check for end of Period time to avoid trying
to fetch a segment that doesn't exist

https://bugzilla.gnome.org/show_bug.cgi?id=746038
2015-03-15 12:02:58 +00:00
Mathieu Duponchelle
bd70c73a8a dashdemux: implement get_presentation_offset.
To account for presentationTimeOffset as per section 7.2.1 .

https://bugzilla.gnome.org/show_bug.cgi?id=745455
2015-03-10 15:17:37 +01:00
Mathieu Duponchelle
793b4bca93 gstmpdparser: Really set the default value for startNumber.
+ The specs ask for a default of 1, the current code only did
 set a default when the field was present.

https://bugzilla.gnome.org/show_bug.cgi?id=745455
2015-03-10 15:17:37 +01:00
Thiago Santos
81b555838a dashdemux: protect against malformed isombff format
Be more careful around malformed mpds that announce using
isombff profile but actually are regular mpds
2015-02-18 08:19:59 -03:00
Thiago Santos
cb94de5d2f dashdemux: set proper stream type to streams
strncmp returns 0 when it compares equal and not a
boolean
2015-02-12 11:16:25 -03:00
Sebastian Dröge
80e02cbdf9 Constify some static arrays everywhere 2015-01-21 10:18:50 +01:00
Thiago Santos
3b920131f0 dashdemux: add log message about segment time information
For debugging purposes
2015-01-19 08:37:59 -03:00
David Waring
6dca8f5cce dashdemux: Fix detection for the end of segment.
The segment start time is calculated as the offset into the current segment.
The old condition to detect the end of period (i.e. segment start time >
period start + period duration) failed when the period start was not 0 since
the segment start time does not take the period start time into account.
Fix this detection by only comparing the segment start to the period duration.

https://bugzilla.gnome.org/show_bug.cgi?id=733369
2015-01-16 17:07:22 -03:00
Thiago Santos
b40e5decb2 dashdemux: check for profiles
Check for available profiles to enable certain features for
dash playback. For now we check for the ISOFF On Demand 2011 profile.
2015-01-16 15:00:11 -03:00
Thiago Santos
afc392c47b dashdemux: do not try to ref null pointer
Playlists might be missing the availability start time, so check for
it before trying to ref the object
2014-12-29 11:39:22 -03:00
Thiago Santos
a862ba4b45 dashdemux: run gst-indent on mpdparser
Run gst-indent on mpdparser to have it stop complaining on every
commit
2014-12-29 11:39:22 -03:00
David Waring
1c0c6b6f48 dashdemux: Change period when setting by period id.
Make gst_mpd_client_set_period_id set the current period index when it finds a
period with a matching period id.

https://bugzilla.gnome.org/show_bug.cgi?id=741322
2014-12-10 16:22:31 -03:00
David Waring
95c3fdc193 dashdemux: Find the current period in a live stream
Start from the correct period on a live stream

https://bugzilla.gnome.org/show_bug.cgi?id=737421
2014-12-02 14:22:09 -03:00
Thiago Santos
58a1b0d058 dashdemux: port to adaptive demux 2014-11-30 21:56:25 -03:00
David Waring
29f1f4533e dash: Use GstUri to join URIs 2014-09-29 12:22:19 +03:00
George Kiagiadakis
ea90ceac01 dashdemux: support downloading segments in reverse order
When a seek with a negative rate is requested, find the target
segment where gstsegment.stop belongs in and then download from
this segment backwards until the first segment.

This allows proper reverse playback.
2014-08-07 16:52:37 +03:00
Sebastian Dröge
ae679506b1 dashdemux: Always use the redirect target to resolve relative URIs
But redownload the playlists from the original URI if it's not
a permanent redirect.
2014-05-28 12:47:51 +02:00
Thiago Santos
16d969b945 dashdemux: mpdparser: properly unref gstdatetime
Avoid leaking the GstDateTime instances when summing dates

CID #1212143
2014-05-13 11:22:58 -03:00
Thiago Santos
288e8d5c0e dashdemux: mpdparser: avoid double free of segment timeline node
The parsing function already frees the old value (if any), avoid a double
free by not freeing it before calling the function without setting the
pointer to NULL

Coverity ID: 1212178
2014-05-13 10:45:29 -03:00
Thiago Santos
64bea0252b dashdemux: mpdparser: avoid double free
The _parse_url function already frees the previous pointer, avoid
freeing it before without setting to null or we have a double free.

Coverity ID: 1212181
Coverity ID: 1212180
Coverity ID: 1212179
2014-05-13 10:13:37 -03:00
Edward Hervey
651a4ae2e7 dash: Don't leak GstActiveStream
CID #1212142
2014-05-13 13:52:48 +02:00
Wim Taymans
6c014f7e36 mpdparse: only add location when node existed
Actually return FALSE when the location node was non-existing
Only add the location node when it existed
2014-04-03 11:48:07 +02:00
Thiago Santos
3d2f3bcf62 dashdemux: remove unnecessary variable
Instead of using 2 indexes that were actually the same, use only
one. Saves a variable.
2014-01-09 09:13:48 -03:00
Thiago Santos
cea909b877 dashdemux: fix seeking when the mpd uses a segment template
Remove the dashdemux seeking function to use the one implemented
in mpdparser as it is more complete. This also makes dashdemux not
crash when seeking on streams that use segment templates.
2014-01-09 09:11:23 -03:00
Thiago Santos
d353d229b1 dash: detect EOS when segments are generated by template
Use the Period duration do know when to end the stream
2013-12-24 17:07:52 -03:00
Thiago Santos
1d2de4a034 dashdemux: run gst-indent
Lots of indentation issues making it very annoying to commit
because of the indent hook. Fix this for once.
2013-12-24 17:07:51 -03:00
Thiago Santos
08636f3bab dashdemux: expose all streams
always expose all streams instead of only exposing one of each type.

This is more aligned with gstreamer's way of working. Allows the user
to select the stream that it wants to use by linking its pad and leaving
the unused ones as unlinked.
2013-12-24 17:07:51 -03:00
Alex Ashley
42fd04ce48 dashdemux: stop fetching live fragments that don't yet exist
There is an issue for live streams where download_loop will keep
downloading segments until it gets a 404 error for a segment
that has not yet been published. This is a problem because this
request for a segment that doesn't exist will propagate all the
way back to the origin server(s). This means that dashdemux causes
extra load on the origin server(s) for segments that aren't yet
available.

This patch uses availabilityStartTime, period
and the host's idea of UTC to decide if a fragment is available to
be requested from an HTTP server and filter out requests for fragments
that are not yet available.

https://bugzilla.gnome.org/show_bug.cgi?id=701404
2013-10-03 09:15:37 -03:00
Josep Torra
0b54b0568d dashdemux: Fix warnings when building in OS X Snow Leopard
gstmpdparser.h:530: warning: type qualifiers ignored on function return type
gstmpdparser.c:4177: warning: type qualifiers ignored on function return type
2013-08-30 21:36:19 +02:00
Chris Bass
7f21226956 dashdemux: offset segment numbers by startNumber
For SegmentTemplate elements containing a startNumber attribute, the
`number' member of GstMediaSegments should be offset by the value of
startNumber; however, this is not currently the case. As a result, the
first URI(s) requested by the download loop will be wrong.

This commit ensures that segment numbers will be offset by startNumber
when one is present in a SegmentTemplate element.

https://bugzilla.gnome.org/show_bug.cgi?id=705661
2013-08-16 11:15:47 -03:00
Chris Bass
19a45554bf dashdemux: remove incorrect timestamp scaling.
When using a SegmentTemplate element, the timestamps of the buffers
output by dashdemux are incorrect, causing problems downstream.

The reason is that GstMediaSegment start times are calculated (in
gst_mpdparser_get_chunk_by_index) by multiplying segment index by
segment duration and then scaling the result according the `timebase'
attribute from the MPD. However, the segment duration is already a
GstClockTime (i.e., it has already been scaled according to the timebase
from the MPD and converted to a nanosecond value), so multiplying it by
the segment index will give the correct timestamp without the need for
any further scaling.

https://bugzilla.gnome.org/show_bug.cgi?id=705679
2013-08-16 10:22:21 -03:00
Edward Hervey
97426a1caa all: Fix for GST_DISABLE_GST_DEBUG
Where applicable, remove methods that don't do anything different than
the default implementation.
2013-07-29 09:42:12 +02:00
Thiago Santos
5a5e66ec90 dashdemux: handle live playback resync
During a live stream it is possible for dashdemux to lag behind on a
slow connection or to rush ahead of the connection os too fast.

For the first case it is necessary to jump some segments ahead to be able to
continue playback as old segments are usually deleted from the server.

For the later, dashdemux should wait a little before attempting another
download do give time to the server to produce a new segment
2013-07-08 23:40:14 -03:00
Thiago Santos
b316d8a677 dashdemux: fix template based segment generation
When using a template based segment list, do not try to
contruct a finite segment list for the limits of the available periods.

We might not know when the period ends (for live streams) and we can
always create the segment on demand when requested by dashdemux,
avoiding use of some memory and cpu when re-creating this list.
2013-07-08 23:39:49 -03:00