Skip to content

Commit

Permalink
Do not require AdaptationSet ids for update
Browse files Browse the repository at this point in the history
When updating a DASH manifest, we can key off of Period and
Representation only.  The spec says that Representation IDs are unique
within the Period, and that Period IDs are unique within the
presentation.  Therefore we do not need an AdaptationSet ID to merge
on update.

Relates to #310

Change-Id: I12b9f83c2bfda958a14e9ee31d459c04da8722e6
  • Loading branch information
joeyparrish committed Mar 21, 2016
1 parent 547fc03 commit e50832f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
8 changes: 3 additions & 5 deletions lib/dash/segment_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ shaka.dash.SegmentList.createStream = function(
/** @type {shaka.media.SegmentIndex} */
var segmentIndex = null;
var id = null;
if (context.period.id && context.adaptationSet.id &&
context.representation.id) {
// Only check/store the index if all IDs are set.
id = context.period.id + ',' + context.adaptationSet.id + ',' +
context.representation.id;
if (context.period.id && context.representation.id) {
// Only check/store the index if period and representation IDs are set.
id = context.period.id + ',' + context.representation.id;
segmentIndex = segmentIndexMap[id];
}

Expand Down
8 changes: 3 additions & 5 deletions lib/dash/segment_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ shaka.dash.SegmentTemplate.createStream = function(
/** @type {shaka.media.SegmentIndex} */
var segmentIndex = null;
var id = null;
if (context.period.id && context.adaptationSet.id &&
context.representation.id) {
// Only check/store the index if all IDs are set.
id = context.period.id + ',' + context.adaptationSet.id + ',' +
context.representation.id;
if (context.period.id && context.representation.id) {
// Only check/store the index if period and representation IDs are set.
id = context.period.id + ',' + context.representation.id;
segmentIndex = segmentIndexMap[id];
}

Expand Down
14 changes: 7 additions & 7 deletions test/dash_parser_live_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('DashParser.Live', function() {
var template = [
'<MPD type="dynamic" minimumUpdatePeriod="PT%(updatePeriod)dS">',
' <Period id="1" %(attr)s>',
' <AdaptationSet id="2" mimeType="video/mp4">',
' <AdaptationSet mimeType="video/mp4">',
' <Representation id="3" bandwidth="500">',
' <BaseURL>http://example.com</BaseURL>',
'%(contents)s',
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('DashParser.Live', function() {
' timeShiftBufferDepth="PT1S"',
' availabilityStartTime="1970-01-01T00:00:00Z">',
' <Period id="1">',
' <AdaptationSet id="2" mimeType="video/mp4">',
' <AdaptationSet mimeType="video/mp4">',
' <Representation id="3" bandwidth="500">',
' <BaseURL>http://example.com</BaseURL>',
'%(contents)s',
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('DashParser.Live', function() {
var template = [
'<MPD type="dynamic" minimumUpdatePeriod="PT%(updateTime)dS">',
' <Period id="4">',
' <AdaptationSet id="5" mimeType="video/mp4">',
' <AdaptationSet mimeType="video/mp4">',
' <Representation id="6" bandwidth="500">',
' <BaseURL>http://example.com</BaseURL>',
'%(contents)s',
Expand Down Expand Up @@ -238,7 +238,7 @@ describe('DashParser.Live', function() {
var template = [
'<MPD type="dynamic" minimumUpdatePeriod="PT%(updatePeriod)dS">',
' <Period id="1" duration="PT30S">',
' <AdaptationSet id="2" mimeType="video/mp4">',
' <AdaptationSet mimeType="video/mp4">',
' <Representation id="3" bandwidth="500">',
' <SegmentTemplate startNumber="1" media="s$Number$.mp4">',
' <SegmentTimeline>',
Expand Down Expand Up @@ -360,7 +360,7 @@ describe('DashParser.Live', function() {
' <Location>http://foobar</Location>',
' <Location>http://foobar2</Location>',
' <Period id="1" duration="PT10S">',
' <AdaptationSet id="2" mimeType="video/mp4">',
' <AdaptationSet mimeType="video/mp4">',
' <Representation id="3" bandwidth="500">',
'<SegmentTemplate startNumber="1" media="s$Number$.mp4" duration="2" />',
' </Representation>',
Expand Down Expand Up @@ -402,7 +402,7 @@ describe('DashParser.Live', function() {
' timeShiftBufferDepth="PT2M"',
' availabilityStartTime="1970-01-01T00:05:00Z">',
' <Period id="1">',
' <AdaptationSet id="2" mimeType="video/mp4">',
' <AdaptationSet mimeType="video/mp4">',
' <Representation id="3" bandwidth="500">',
' <BaseURL>http://example.com</BaseURL>',
'<SegmentTemplate startNumber="1" media="s$Number$.mp4" duration="2" />',
Expand Down Expand Up @@ -454,7 +454,7 @@ describe('DashParser.Live', function() {
' <UTCTiming schemeIdUri="urn:mpeg:dash:utc:http-xsdate:2014"',
' value="http://foo.bar/date" />',
' <Period id="1">',
' <AdaptationSet id="2" mimeType="video/mp4">',
' <AdaptationSet mimeType="video/mp4">',
' <Representation id="3" bandwidth="500">',
' <BaseURL>http://example.com</BaseURL>',
' <SegmentTemplate startNumber="1" media="s$Number$.mp4"',
Expand Down

0 comments on commit e50832f

Please sign in to comment.