Commit graph

242 commits

Author SHA1 Message Date
Florin Apostol
013655d886 dashdemux: inherited segment URLs are ignored if they are defined again in a lower SegmentList
According to the standard:
"SegmentBase, SegmentTemplate and SegmentList shall inherit
attributes and elements from the same element on a higher level.
If the same attribute or element is present on both levels,
the one on the lower level shall take precedence over the one
on the higher level."

gst_mpdparser_parse_segment_list_node will now discard any inherited
segment URLs if the parsed element defines some too.

https://bugzilla.gnome.org/show_bug.cgi?id=751832
2015-10-30 14:31:21 +00:00
Alex Ashley
c8ef39cac7 dashdemux: provide a default suggestedPresentationDelay
If MPD@suggestedPresentationDelay is not present in the manifest,
dashdemux selects the fragment closest to the most recently generated
fragment. This causes a playback issue because this choice does not allow
the DASH client to build up any buffer of downloaded fragments without
pausing playback. This is because by definition new fragments appear on
the server in real-time (e.g. if segment duration is 4 seconds, a new
fragment will appear on the server every 4 seconds). If the starting
playback position was n*segmentDuration seconds behind "now", the DASH
client could download up to 'n' fragments faster than realtime before it
reached the point where it needed to wait for fragments to appear on the
server.

The MPD@suggestedPresentationDelay attribute allows a content publisher
to provide a suggested starting position that is behind the current
"live" position.

If the MPD@suggestedPresentationDelay attribute is not present, provide
a suitable default value as a property of the dashdemux element. To
allow the default presentation delay to be specified either using
fragments or seconds, the property is a string that contains a number
and a unit (e.g. "10 seconds", "4 fragments", "2500ms").
2015-10-29 13:26:46 +00:00
Vincent Penquerc'h
7443f35249 dash_mpd: restrict segment template format strings to %0[0-9]*d as per spec
https://bugzilla.gnome.org/show_bug.cgi?id=751735
2015-10-29 12:04:31 +00:00
Florin Apostol
4eea6c3833 dashdemux: segment template parsing: added support for %d
Added support for %d in template identifier.
Added testcases for %d, %3d, %0-4d identifier formats.
2015-10-29 11:58:47 +00:00
Florin Apostol
933d367440 dashdemux: corrected parsing of segment templates
Corrected the parsing of a segment template string.
Added unit tests to test the segment template parsing.
All reported problems are now correctly handled.

https://bugzilla.gnome.org/show_bug.cgi?id=751735
2015-10-29 11:54:34 +00:00
Florin Apostol
566e84cec1 dashdemux: fixed crash when segment timeline list is greater than segment url list
When building the media segment list using a SegmentList node, the
gst_mpd_client_setup_representation function will iterate through the
list of S nodes and will expect to find a matching SegmentUrl node. If
one does not exist, the code made an illegal memory access.

https://bugzilla.gnome.org/show_bug.cgi?id=752496
2015-10-29 10:20:45 +00:00
Vincent Penquerc'h
5c8f702116 mpdparser: do not dereference profiles is absent
These are used to apply restrictions on what the MPD file may
use, so no profile means no restrictions.

Besides, nothing actually uses the profiles (yet) anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=750869
2015-10-29 10:20:45 +00:00
Florin Apostol
cdfec06092 dashdemux: parser rejects negative values for mediaPresentationDuration
https://bugzilla.gnome.org/show_bug.cgi?id=752326
2015-10-29 10:20:45 +00:00
Florin Apostol
7c2746f741 dashdemux: corrected parsing of negative values into unsigned data
https://bugzilla.gnome.org/show_bug.cgi?id=752429
2015-10-29 10:20:45 +00:00
Vincent Penquerc'h
54d93f597d mpdparser: forbid negative values for duration
https://bugzilla.gnome.org/show_bug.cgi?id=752492
2015-10-28 15:43:00 +00:00
Florin Apostol
c763d1e8fd dashdemux: parser rejects XMLs with negative period duration
https://bugzilla.gnome.org/show_bug.cgi?id=752329
2015-10-28 15:41:17 +00:00
Vincent Penquerc'h
60133b1472 mpdparser: check segment lists have either duration or timeline
And add error checking along the way.

Add duration where appropriate so unit tests still pass.

https://bugzilla.gnome.org/show_bug.cgi?id=751650
2015-10-28 15:34:29 +00:00
Vincent Penquerc'h
b8df6cc316 mpdparser: validate representation set identifier
It must have no whitespace, and must comply with RFC 1738 when
used to build a URL.

https://bugzilla.gnome.org/show_bug.cgi?id=750852
2015-10-28 15:11:50 +00:00
Sebastian Dröge
1f7156d478 mpdparser: Set default last_byte_pos to -1
The value is optional in the range, and if it is absent it means we should
download until the end of stream. Not until position 0.

https://bugzilla.gnome.org/show_bug.cgi?id=748316
2015-10-14 16:57:56 +03:00
Florin Apostol
1d1094b71b dashdemux: fixed has_next_period
gst_mpd_client_has_next_period now calls gst_mpd_client_setup_media_presentation
to refresh the period information.

https://bugzilla.gnome.org/show_bug.cgi?id=756186
2015-10-07 15:50:08 +01:00
Chris Bass
69f86e51b2 dashdemux: create src pads for subtitle streams.
Create src pads for Representations that contain timed-text subtitles,
both when the subtitles are encapsulated in ISO BMFF (i.e., the
Representation has mimeType "application/mp4") and when they are
unencapsulated (i.e., the Representation has mimeType
"application/ttml+xml").

https://bugzilla.gnome.org/show_bug.cgi?id=747774
2015-09-26 00:50:55 +02:00
Sebastian Dröge
93d85bd361 dashdemux: Implement lazy-loading of external periods
https://bugzilla.gnome.org/show_bug.cgi?id=752230
2015-09-25 23:52:28 +02:00
Sebastian Dröge
b70dab8f27 mpdparser: Load OnLoad external resources immediately instead of on demand
https://bugzilla.gnome.org/show_bug.cgi?id=752230
2015-09-25 23:52:28 +02:00
Sebastian Dröge
49931eda69 mpdparser: Add support for loading external SegmentLists
https://bugzilla.gnome.org/show_bug.cgi?id=752230
2015-09-25 23:52:28 +02:00
Sebastian Dröge
51e8624d56 mpdparser: Add support for loading external AdaptationSets
https://bugzilla.gnome.org/show_bug.cgi?id=752230
2015-09-25 23:52:28 +02:00
Sebastian Dröge
97f5b82bf6 mpdparser: Implement loading of external Period nodes
The same has to be done for AdaptationSet and SegmentList nodes still.

Also this does not correctly implement the semantics: by default Period (and
other nodes) should only be loaded when needed, not in the very beginning. We
need to implement lazy loading for them, which means adjusting
gst_mpd_client_setup_media_presentation().

https://bugzilla.gnome.org/show_bug.cgi?id=752230
2015-09-25 23:52:28 +02:00
Sebastian Dröge
572e54574b mpdparser: Store an URI downloader in the parser for downloading additional MPD resources if needed
https://bugzilla.gnome.org/show_bug.cgi?id=752230
2015-09-25 23:52:28 +02:00
Sebastian Dröge
07ee57228b mpdparser: Parse xlink attributes from Period, AdaptationSet and SegmentList
We still have to do something useful with them, like actually loading the
content behind the URL.

https://bugzilla.gnome.org/show_bug.cgi?id=752230
2015-09-25 23:52:28 +02:00
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