[vlc-devel] [PATCH 00/14] Use input thread events for (pre-)parsing

Romain Vimont rom1v at videolabs.io
Thu Aug 16 16:01:57 CEST 2018


Currently, (pre-)parsing an item generates events on the input item
(its vlc_event_manager_t) directly.

This is weird, especially for the "subtree added" event, because the
subtree does not belong to the item at all: it is created only to fire
an event, then destroyed immediately. Thus, the detection of subitems is
more related to a specific (pre-)parsing task than to the item itself.

In practice, listening input items to receive preparsing results also
poses a lock-inversion problem for my media tree stuff (which also
exists in the current playlist):
 - <https://mailman.videolan.org/pipermail/vlc-devel/2018-July/120151.html>
 - <https://mailman.videolan.org/pipermail/vlc-devel/2018-July/120160.html>

This patchset aims to trigger "subtree added" events on the input thread
instead. In addition, this event is also exposed in preparser callbacks
(since the input thread is internal), along with the "preparse ended"
event.

Summary:
 - patches 1 and 2 (multithreaded preparser) were already posted:
   - <https://mailman.videolan.org/pipermail/vlc-devel/2018-July/120394.html>
   - <https://mailman.videolan.org/pipermail/vlc-devel/2018-July/120397.html>
 - patch 3 refactors vlc_input_event to make it compatible with C++;
 - patch 4 adds the "subtree added" event to the input thread;
 - patch 5 exposes preparser callbacks (the input thread is internal);
 - patches 6 and 7 refactor the fetcher, used by the preparser, to be able
   to trigger the "preparse ended" event correctly;
 - patches 8 to 12 adapt all VLC code to use input thread callbacks instead
   of input item callbacks;
 - patches 13 and 14 remove the events from the input item.

Filip Roséen (1):
  input: preparser: prepare for multithreaded background worker

Romain Vimont (13):
  misc: background_worker: make the background worker multithreaded
  input: name input event structs
  input: notify "subtree added" on the input thread
  preparser: provide events in callbacks
  fetcher: provide events in callbacks
  preparser: use fetcher callbacks
  libvlc: receive events from input thread
  playlist: receive events from input thread
  medialib: receive events from input thread
  input: pass thread event callbacks to input_Read()
  sd: mediadirs: receive events from input thread
  input: remove triggering of legacy events
  input: remove legacy events from input item

 include/vlc_events.h                          |   4 +-
 include/vlc_input.h                           | 119 +++--
 include/vlc_input_item.h                      |  18 +-
 lib/media.c                                   |  47 +-
 lib/media_internal.h                          |   1 +
 lib/media_list.c                              |   3 +-
 lib/media_player.c                            |  19 +-
 modules/gui/qt/input_manager.cpp              |   3 +-
 .../misc/medialibrary/MetadataExtractor.cpp   |  48 +-
 modules/misc/medialibrary/medialibrary.h      |   3 +-
 modules/services_discovery/mediadirs.c        |  29 +-
 src/input/es_out.c                            |   5 +-
 src/input/event.c                             |  11 +
 src/input/event.h                             |   2 +
 src/input/input.c                             |   7 +-
 src/input/input_interface.h                   |   1 -
 src/input/input_internal.h                    |   3 -
 src/input/item.c                              |  16 -
 src/libvlc-module.c                           |  14 +
 src/libvlc.c                                  |  14 +-
 src/libvlc.h                                  |   2 +
 src/misc/background_worker.c                  | 437 +++++++++++-------
 src/misc/background_worker.h                  |  20 +
 src/playlist/item.c                           |  28 +-
 src/playlist/loadsave.c                       |   2 +-
 src/playlist/playlist_internal.h              |   2 +
 src/playlist/thread.c                         |  20 +-
 src/preparser/fetcher.c                       |  29 +-
 src/preparser/fetcher.h                       |   3 +-
 src/preparser/preparser.c                     | 202 ++++++--
 src/preparser/preparser.h                     |   8 +-
 test/libvlc/media.c                           |  15 +-
 32 files changed, 738 insertions(+), 397 deletions(-)

If we exclude the two first patches, it's only:
 29 files changed, 390 insertions(+), 201 deletions(-)

-- 
2.18.0



More information about the vlc-devel mailing list