Skip to content

Parsing error for representations without segment info #164

Open
@nhasselmeyer

Description

@nhasselmeyer

The following file fails to parse:

<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:cenc="urn:mpeg:cenc:2013" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" type="static" minBufferTime="PT30S" profiles="urn:mpeg:dash:profile:isoff-main:2011" mediaPresentationDuration="PT1M4.800S">
  <Period start="PT0S" duration="PT1M4.800S" id="1">
    <AdaptationSet mimeType="video/webm" frameRate="30/1" segmentAlignment="true" subsegmentAlignment="true" startWithSAP="1" subsegmentStartsWithSAP="1" bitstreamSwitching="false">
      <Representation id="1" width="1920" height="1080" bandwidth="1800000" codecs="vp9">
        <BaseURL>864_vp9.webm</BaseURL>
      </Representation>
    </AdaptationSet>
    <AdaptationSet mimeType="audio/mp4" lang="eng" segmentAlignment="0">
      <Representation id="2" bandwidth="96000" audioSamplingRate="48000" codecs="mp4a.40.2">
        <BaseURL>864_aac.mp4</BaseURL>
        <SegmentBase indexRange="658-961">
          <Initialization range="0-657"/>
        </SegmentBase>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

The problem seems to be in

const segmentsInfo = {
attributes
};
if (!segmentsFn) {
return segmentsInfo;
}

For the first representation, there are no elements with any segment information, so segmentsFn is not set. The toM3u8 function requires segmentsInfo.segments to be a list, leading to a error that is hard to debug (trying to call undefined.reduce())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions