summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@qt.io>2016-08-18 14:18:59 +0200
committerYoann Lopes <yoann.lopes@qt.io>2016-08-31 10:16:34 +0000
commit6817067ff72c4493ab39fd065c9382568da06378 (patch)
treee83b3b9a5528578f89b92eb5e918660c70ff775e
parent6d95682d7ff282180655f2f384d8aba69c4f67af (diff)
Optimize QMediaPlaylistPrivate::readItems()
When reading playlist items from a file, pass them to the playlist backend all at once rather than one by one. This might be faster depending on the implementation. Task-number: QTBUG-54849 Change-Id: I57acdc68604ee56fe5d7615ba0a72655e668443f Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--src/multimedia/playback/qmediaplaylist.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/multimedia/playback/qmediaplaylist.cpp b/src/multimedia/playback/qmediaplaylist.cpp
index c6334063..7246d2ad 100644
--- a/src/multimedia/playback/qmediaplaylist.cpp
+++ b/src/multimedia/playback/qmediaplaylist.cpp
@@ -428,10 +428,12 @@ bool QMediaPlaylist::clear()
bool QMediaPlaylistPrivate::readItems(QMediaPlaylistReader *reader)
{
+ QList<QMediaContent> items;
+
while (!reader->atEnd())
- playlist()->addMedia(reader->readItem());
+ items.append(reader->readItem());
- return true;
+ return playlist()->addMedia(items);
}
bool QMediaPlaylistPrivate::writeItems(QMediaPlaylistWriter *writer)