[3.0.x] adaptive fails on IPv6 literals
If the base URL of an HLS stream contains an IPv6 literal, the demuxer fails to download the first segment, and gives up. Judging from the logs, the absolute segment URLs are calculated correctly, but the URLs get corrupted later on:
[0000512000030100] main input source debug: creating demux: access='http' demux='any' location='[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/index.m3u8' file='(null)'
[0000513000069f00] main demux debug: looking for demux module matching "any": 53 candidates
[0000513000069f00] adaptive demux debug: Updated playlist ID http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/index.m3u8, after 0s
[0000513000069f00] adaptive demux debug: Representation http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/index.m3u8
[0000513000069f00] adaptive demux debug: Segment #1700381787 url=http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/1714898959-1-1700381787.hls.ts?servicetype=1 duration 10000000
[0000513000069f00] adaptive demux debug: Segment #1700381788 url=http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/1714898969-1-1700381788.hls.ts?servicetype=1 stime 10000000 duration 10000000
[0000513000069f00] adaptive demux debug: Segment #1700381789 url=http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/1714898979-1-1700381789.hls.ts?servicetype=1 stime 20000000 duration 10000000
[0000513000069f00] adaptive demux debug: Period
[0000513000069f00] adaptive demux debug: BaseAdaptationSet default_id#0
[0000513000069f00] adaptive demux debug: Representation http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/index.m3u8
[0000513000069f00] adaptive demux debug: Segment #1700381787 url=http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/1714898959-1-1700381787.hls.ts?servicetype=1 duration 10000000
[0000513000069f00] adaptive demux debug: Segment #1700381788 url=http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/1714898969-1-1700381788.hls.ts?servicetype=1 stime 10000000 duration 10000000
[0000513000069f00] adaptive demux debug: Segment #1700381789 url=http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/1714898979-1-1700381789.hls.ts?servicetype=1 stime 20000000 duration 10000000
[0000513000069f00] adaptive demux debug: playlist Start/End 0/0 len 0rap pl/demux (0/0)
[0000513000069f00] adaptive demux debug: cached.i_time (0) cur 0 rap start (pl 0/dmx 0) pos 0,000000
[0000513000069f00] adaptive demux debug: opening playlist file ([2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/index.m3u8)
[0000513000069f00] main demux debug: using demux module "adaptive"
...
[000051d0000bff40] main input debug: `http://[2409:8087:1a01:df::4077]:80/PLTV/88888888/224/3221225799/index.m3u8' successfully opened
[0000513000069f00] adaptive demux debug: Retrieving http://2409:8087:1a01:df::4077:80/PLTV/88888888/224/3221225799/1714898959-1-1700381787.hls.ts?servicetype=1
[0000513000069f00] adaptive demux error: Failed to create demuxer (nil) Unknown
[000051d0000bff40] main input debug: EOF reached
[0000513000069f00] main demux debug: removing module "adaptive"
[0000514000032100] main stream debug: removing module "record"
[0000514000030500] main stream debug: removing module "prefetch"
[0000514000030300] main stream debug: removing module "access"
[0000516000007640] main playlist debug: dead input
The problem is not observed in 4.0. Note: this HLS manifest contains directory-relative URLs, not absolute URLs. I did not test other cases.
See also https://forum.videolan.org/viewtopic.php?f=14&t=164529 for the sample (probably will expire eventually).
Edited by Rémi Denis-Courmont