Commit 1bb6f8e2 authored by Jean-Paul Saman's avatar Jean-Paul Saman

stream_filter/httplive.c: use vlc_clone() and vlc_join()

- Use vlc_clone() and vlc_join() instead of now deprecated vlc_thread-* API.
- hls_Thread() remove cancellation point for now (will come back later).
parent 620564f1
...@@ -87,9 +87,10 @@ typedef struct hls_stream_s ...@@ -87,9 +87,10 @@ typedef struct hls_stream_s
struct stream_sys_t struct stream_sys_t
{ {
vlc_url_t m3u8; /* M3U8 url */ vlc_url_t m3u8; /* M3U8 url */
vlc_thread_t thread; /* Thread function */
/* */ /* */
vlc_array_t *hls_stream;/* bandwidth adaptation */ vlc_array_t *hls_stream; /* bandwidth adaptation */
uint64_t bandwidth; /* measured bandwidth (bits per second) */ uint64_t bandwidth; /* measured bandwidth (bits per second) */
/* Download */ /* Download */
...@@ -138,7 +139,7 @@ static char *ReadLine(uint8_t *buffer, uint8_t **remain, size_t len); ...@@ -138,7 +139,7 @@ static char *ReadLine(uint8_t *buffer, uint8_t **remain, size_t len);
static int hls_Download(stream_t *s, segment_t *segment); static int hls_Download(stream_t *s, segment_t *segment);
static void* hls_Thread(vlc_object_t *); static void* hls_Thread(void *);
static segment_t *segment_GetSegment(hls_stream_t *hls, int wanted); static segment_t *segment_GetSegment(hls_stream_t *hls, int wanted);
static void segment_Free(segment_t *segment); static void segment_Free(segment_t *segment);
...@@ -1115,13 +1116,11 @@ static int Download(stream_t *s, hls_stream_t *hls, segment_t *segment, int *cur ...@@ -1115,13 +1116,11 @@ static int Download(stream_t *s, hls_stream_t *hls, segment_t *segment, int *cur
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static void* hls_Thread(vlc_object_t *p_this) static void* hls_Thread(void *p_this)
{ {
stream_t *s = (stream_t *)p_this; stream_t *s = (stream_t *)p_this;
stream_sys_t *p_sys = s->p_sys; stream_sys_t *p_sys = s->p_sys;
int canc = vlc_savecancel();
while (vlc_object_alive(s)) while (vlc_object_alive(s))
{ {
hls_stream_t *hls = hls_Get(p_sys->hls_stream, p_sys->download.stream); hls_stream_t *hls = hls_Get(p_sys->hls_stream, p_sys->download.stream);
...@@ -1214,7 +1213,6 @@ static void* hls_Thread(vlc_object_t *p_this) ...@@ -1214,7 +1213,6 @@ static void* hls_Thread(vlc_object_t *p_this)
vlc_mutex_unlock(&p_sys->download.lock_wait); vlc_mutex_unlock(&p_sys->download.lock_wait);
} }
vlc_restorecancel(canc);
return NULL; return NULL;
} }
...@@ -1522,7 +1520,7 @@ static int Open(vlc_object_t *p_this) ...@@ -1522,7 +1520,7 @@ static int Open(vlc_object_t *p_this)
vlc_mutex_init(&p_sys->download.lock_wait); vlc_mutex_init(&p_sys->download.lock_wait);
vlc_cond_init(&p_sys->download.wait); vlc_cond_init(&p_sys->download.wait);
if (vlc_thread_create(s, hls_Thread, VLC_THREAD_PRIORITY_INPUT)) if (vlc_clone(&p_sys->thread, hls_Thread, s, VLC_THREAD_PRIORITY_INPUT))
{ {
goto fail_thread; goto fail_thread;
} }
...@@ -1565,7 +1563,7 @@ static void Close(vlc_object_t *p_this) ...@@ -1565,7 +1563,7 @@ static void Close(vlc_object_t *p_this)
vlc_mutex_unlock(&p_sys->download.lock_wait); vlc_mutex_unlock(&p_sys->download.lock_wait);
/* */ /* */
vlc_thread_join(s); vlc_join(p_sys->thread, NULL);
vlc_mutex_destroy(&p_sys->download.lock_wait); vlc_mutex_destroy(&p_sys->download.lock_wait);
vlc_cond_destroy(&p_sys->download.wait); vlc_cond_destroy(&p_sys->download.wait);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment