This fixes the download progress output missing the last data chunk.
Without patch (depends on the timing of the last write() call):
$ streamlink -l none --force -o /tmp/foo.mp4 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_adv_example_hevc/v9/prog_index.m3u8' best
[download] Written 563.48 MiB to /tmp/foo.mp4 (12s @ 45.01 MiB/s)
$ streamlink -l none --force -o /tmp/foo.mp4 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_adv_example_hevc/v9/prog_index.m3u8' best
[download] Written 554.26 MiB to /tmp/foo.mp4 (12s @ 45.19 MiB/s)
$ streamlink -l none --force -o /tmp/foo.mp4 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_adv_example_hevc/v9/prog_index.m3u8' best
[download] Written 545.10 MiB to /tmp/foo.mp4 (10s @ 51.81 MiB/s)
With patch:
$ streamlink -l none --force -o /tmp/foo.mp4 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_adv_example_hevc/v9/prog_index.m3u8' best
[download] Written 564.41 MiB to /tmp/foo.mp4 (11s @ 48.87 MiB/s)
Actual file size:
$ stat -c %s /tmp/foo.mp4 | numfmt --to=iec-i --format=%.2f --round=down
564.41Mi