avformat/hls: avoid unnecessary segment retrievals

Check if the playlist is still needed just before requesting the next
segment instead of after exhausting the previous segment.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
