]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9704: [mod_av] Seeking video files with mod_av after it reaches the end does not...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 15 Mar 2017 23:03:53 +0000 (18:03 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 15 Mar 2017 23:03:53 +0000 (18:03 -0500)
src/mod/applications/mod_av/avformat.c

index 2203eb3d0b6a0e583504be1f900e921fc4808c41..5da61930c10994915addf84cbcc033e19e715841 100644 (file)
@@ -2122,9 +2122,13 @@ static switch_status_t av_file_close(switch_file_handle_t *handle)
                av_file_write(handle, NULL, NULL);
        }
 
-       if (context->file_read_thread_running && context->file_read_thread) {
+       if (context->file_read_thread_running) {
                context->file_read_thread_running = 0;
+       }
+       
+       if (context->file_read_thread) {
                switch_thread_join(&status, context->file_read_thread);
+               context->file_read_thread = NULL;
        }
 
        if (context->eh.video_queue) {
@@ -2163,6 +2167,12 @@ static switch_status_t av_file_seek(switch_file_handle_t *handle, unsigned int *
        if (!context->file_read_thread_running) {
                switch_threadattr_t *thd_attr = NULL;
 
+               if (context->file_read_thread) {
+                       switch_status_t status;
+                       switch_thread_join(&status, context->file_read_thread);
+                       context->file_read_thread = NULL;
+               }
+
                switch_threadattr_create(&thd_attr, handle->memory_pool);
                switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
                switch_thread_create(&context->file_read_thread, thd_attr, file_read_thread_run, context, handle->memory_pool);