[vlc-devel] [PATCH 0/5] qt: medialib: avoid blocking the UI thread for generating thumbnails

Romain Vimont rom1v at videolabs.io
Thu Jan 7 13:23:56 UTC 2021


In the VLC medialibrary module, the control VLC_ML_MEDIA_GENERATE_THUMBNAIL,
called from the UI thread, requests asynchronous thumbnail generation.

However, even if the generation was asynchronous, the control itself executed
I/O calls on the UI thread:
 1. it executed a SQL query to retrieve a Media from a media id (so that it
    could call requestThumbnail()).
 2. the Init() and Start() calls (to initialize the medialib and start
    discovery), called on every thumbnail generation request, executed some SQL
    queries or blocked on the medialibrary mutex (hold during SQL queries).

To solve the first issue, a new medialib API has been added for asynchronous
thumbnail generation from a media id:
https://code.videolan.org/videolan/medialibrary/-/merge_requests/350
This patchset bumps the medialibrary version and uses it.

For the second issue, the Init()/Start() calls are improved to guarantee that
they do not cause any I/O except on the very first call (the actual
initialization/starting), which can be an acceptable compromise for now.

Branch: https://code.videolan.org/rom1v/vlc/-/commits/async_thumbnails

Regards

Romain Vimont (5):
  medialib: rename medialib.cpp to medialibrary.cpp
  medialib: bump contrib & reflect API changes
  medialib: fix initialization
  medialib: improve starting
  qt: medialib: use new requestThumbnail() API

 configure.ac                                  |  2 +-
 contrib/src/medialibrary/rules.mak            |  4 +-
 modules/misc/Makefile.am                      |  2 +-
 modules/misc/medialibrary/fs/file.cpp         |  2 +-
 modules/misc/medialibrary/fs/file.h           |  2 +-
 .../{medialib.cpp => medialibrary.cpp}        | 37 ++++++++++++-------
 modules/misc/medialibrary/medialibrary.h      |  5 +++
 po/POTFILES.in                                |  2 +-
 8 files changed, 35 insertions(+), 21 deletions(-)
 rename modules/misc/medialibrary/{medialib.cpp => medialibrary.cpp} (98%)

-- 
2.30.0



More information about the vlc-devel mailing list