Each time the song is changed, the podcast backend checks whether the
new song is a podcast and, if so, mark it as listened to. This requires
1-2 db queries, so do it off the main thread.
Time to change song before: 300 ms
after: 50 ms usually, 80 ms sometimes
When starting clementine, each playlist is loaded in turn.
When loading a playlist, the new tab order is committed to the db,
but we don't need to do that here because we know that once all the
playlists are loaded the tab order will be the same as it was initially.
This speeds startup substantially.
kstartperf:
Before: 3.5s
After: 1.5s
The playlist fetching uses QtConcurrent to make the playlist on a
different thread (possibly concurrently for each item).
However, profiling reveals that the slow operation is fetching
the rows from the SQLite database, making this redundant.
Instead move the whole playlist loading, including the database access,
into a single function, and call that function in a different thread via
QtConcurrent::run.
This has the side effect of moving all the concurrent stuff from
PlaylistBackend into the callers.
kstartperf measures:
Before: 7.5s cold
3.6 s warm
After: ~4.0 s cold
3.5 s warm
Shouldn't change anything in practice, but better to have items correctly inserted as Internet items FWIW. And will avoid other "custom context menu not working" issues if one day we implement one for
these services.
A bit more information:
Normal transcoding worked fine, the transcoder object was in the main thread. In the network remote, a new transcoder object is created which runs in the network remote thread. When a song was transcoded there, the UI became unresponsive.
Removing the async bus callback solved the problem, exactly the g_source_remove() method caused it. Since the bus callback returned FALSE (GST_BUS_DROP), the watch was already removed. (See http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-add-watch)
- It is configurable in the settings.
- Any format can be chosen that is supported by the transcoder.
- The status of the transcoder is send to the remote.
- Transcoder format settings have now a postfix so we can define mutliple transcoder formats and use them separatly. Here one for the normal transcoder and one for the network remote transcode. You can pass the postfix in the constructor.
- Fixed Transcoder crash (was introduced with the gstreamer1.0 merge, decodebin doesn't have a "new-decoded-pad").
- Transcoder emits the output filename as well on "JobComplete" signal
- Transcoder can now convert a file to a temporary file ("AddTemporaryJob")