vlc_mutex_unlock(&hls->lock);
/* Is there a new segment to process? */
- if ((p_sys->playback.segment < (count - 6)) ||
+ if ((!p_sys->b_live && (p_sys->playback.segment < (count - 6))) ||
(client->segment >= count))
{
/* wait */
vlc_mutex_lock(&client->lock_wait);
while (((client->segment - p_sys->playback.segment > 6) ||
(client->segment >= count)) &&
- (client->seek == -1))
+ (client->seek == -1) &&
+ (mdate() < p_sys->playlist.wakeup))
{
vlc_cond_wait(&client->wait, &client->lock_wait);
if (!vlc_object_alive(p_this)) break;
if (!vlc_object_alive(p_this)) break;
+ /* reload the m3u8 index file */
+ if (p_sys->b_live)
+ {
+ double wait = 1;
+ mtime_t now = mdate();
+ if (now >= p_sys->playlist.wakeup)
+ {
+ if (hls_ReloadPlaylist(client->s) != VLC_SUCCESS)
+ {
+ /* No change in playlist, then backoff */
+ p_sys->playlist.tries++;
+ if (p_sys->playlist.tries == 1) wait = 0.5;
+ else if (p_sys->playlist.tries == 2) wait = 1;
+ else if (p_sys->playlist.tries >= 3) wait = 3;
+ }
+ else p_sys->playlist.tries = 0;
+
+ /* determine next time to update playlist */
+ p_sys->playlist.last = now;
+ p_sys->playlist.wakeup = now + ((mtime_t)(hls->duration * wait)
+ * (mtime_t)1000000);
+ }
+
+ if (!vlc_object_alive(p_this)) break;
+ }
+
vlc_mutex_lock(&hls->lock);
segment_t *segment = segment_GetSegment(hls, client->segment);
assert(segment);
if (Download(client->s, hls, segment, &client->current) != VLC_SUCCESS)
{
+ if (!vlc_object_alive(p_this)) break;
+
if (!p_sys->b_live)
{
p_sys->b_error = true;
client->segment++;
vlc_cond_signal(&client->wait);
vlc_mutex_unlock(&client->lock_wait);
-
- /* reload the m3u8 index file */
- if (p_sys->b_live)
- {
- double wait = 1;
- mtime_t now = mdate();
- if (now >= p_sys->playlist.wakeup)
- {
- if (hls_ReloadPlaylist(client->s) != VLC_SUCCESS)
- {
- /* No change in playlist, then backoff */
- p_sys->playlist.tries++;
- if (p_sys->playlist.tries == 1) wait = 0.5;
- else if (p_sys->playlist.tries == 2) wait = 1;
- else if (p_sys->playlist.tries >= 3) wait = 3;
- }
- else p_sys->playlist.tries = 0;
-
- /* determine next time to update playlist */
- p_sys->playlist.last = now;
- p_sys->playlist.wakeup = now + ((mtime_t)(hls->duration * wait)
- * (mtime_t)1000000);
- }
- }
}
vlc_restorecancel(canc);