Skip to content

stream.dash: fix SegmentTemplate's BaseURL context #5194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bastimeyer
Copy link
Member

Fixes #4586

Previously, when formatting init/media segment URLs of a SegmentTemplate, its own inherited base_url property was used, which does only work in MPD documents where the next BaseURL node is a child node of one of the SegmentTemplate's ancestor nodes, namely AdaptationSet, Period or MPD:

<MPD ...>
  <BaseURL>one</BaseURL>
  <Period ...>
    <BaseURL>two</BaseURL>
    <AdaptationSet>
      <BaseURL>three</BaseURL>
      <SegmentTemplate .../>
      <Representation .../>
    </AdaptationSet>
  </Period>
</MPD>

This left out potential BaseURL child-nodes in Representation nodes that are siblings of SegmentTemplate (and similar cases):

<MPD ...>
  <BaseURL>one</BaseURL>
  <Period ...>
    <BaseURL>two</BaseURL>
    <AdaptationSet>
      <BaseURL>three</BaseURL>
      <SegmentTemplate .../>
      <Representation ...>
        <BaseURL>four was ignored</BaseURL>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

To fix the issue, just pass the resolved base_url from the Representation instance to the SegmentTemplate's segment generator, where the init/media URLs are formatted.

@gravyboat gravyboat merged commit e684913 into streamlink:master Feb 24, 2023
@bastimeyer bastimeyer deleted the stream/dash/baseurl-segmenttemplate branch February 24, 2023 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stream.dash: nested BaseURL resolving
2 participants