[vlc-commits] [Git][videolan/vlc][master] 2 commits: preparser: cancel the correct executor when thumbnailing

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 22 09:24:55 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5947daf6 by Thomas Guillem at 2024-11-22T09:04:43+00:00
preparser: cancel the correct executor when thumbnailing

- - - - -
182e5516 by Thomas Guillem at 2024-11-22T09:04:43+00:00
preparser: explicitly check options when canceling

- - - - -


1 changed file:

- src/preparser/preparser.c


Changes:

=====================================
src/preparser/preparser.c
=====================================
@@ -562,21 +562,42 @@ size_t vlc_preparser_Cancel( vlc_preparser_t *preparser, vlc_preparser_req_id id
         if (id == VLC_PREPARSER_REQ_ID_INVALID || task->id == id)
         {
             count++;
-            /* TODO: the fetcher should be cancellable too */
-            bool canceled = preparser->parser != NULL
-              && vlc_executor_Cancel(preparser->parser, &task->runnable);
+
+            bool canceled;
+            if (task->options & VLC_PREPARSER_TYPE_PARSE)
+            {
+                assert(preparser->parser != NULL);
+                canceled = vlc_executor_Cancel(preparser->parser,
+                                               &task->runnable);
+            }
+            else if (task->options & VLC_PREPARSER_TYPE_THUMBNAIL)
+            {
+                assert(preparser->thumbnailer != NULL);
+                canceled = vlc_executor_Cancel(preparser->thumbnailer,
+                                               &task->runnable);
+            }
+            else /* TODO: the fetcher should be cancellable too */
+                canceled = false;
+
             if (canceled)
             {
                 vlc_list_remove(&task->node);
                 vlc_mutex_unlock(&preparser->lock);
                 task->preparse_status = -EINTR;
-                if (task->options == VLC_PREPARSER_TYPE_THUMBNAIL)
+                if (task->options & (VLC_PREPARSER_TYPE_PARSE |
+                                     VLC_PREPARSER_TYPE_FETCHMETA_ALL))
+                {
+                    assert((task->options & VLC_PREPARSER_TYPE_THUMBNAIL) == 0);
+                    task->cbs.parser->on_ended(task->item, task->preparse_status,
+                                               task->userdata);
+                }
+                else
+                {
+                    assert(task->options & VLC_PREPARSER_TYPE_THUMBNAIL);
                     task->cbs.thumbnailer->on_ended(task->item,
                                                     task->preparse_status, NULL,
                                                     task->userdata);
-                else
-                    task->cbs.parser->on_ended(task->item, task->preparse_status,
-                                               task->userdata);
+                }
                 TaskDelete(task);
 
                 /* Small optimisation in the likely case where the user cancel



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5c72487111bf072dec2d24e4a5bd67c2d10d5f4f...182e55167a130a08fb7ab5dff566bb67bd1e1e01

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5c72487111bf072dec2d24e4a5bd67c2d10d5f4f...182e55167a130a08fb7ab5dff566bb67bd1e1e01
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list