summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2009-11-11 03:54:41 (GMT)
committerJustin McPherson <justin.mcpherson@nokia.com>2009-11-12 05:39:37 (GMT)
commitcc6406d4971c5656fc4b3eb53f96058a9640c6f7 (patch)
tree28ef10a4b8289af70e7c9287c45fc152a051c796
parent88342df1680f2152663ccb2ae0e3b740f4f13ac0 (diff)
downloadQt-cc6406d4971c5656fc4b3eb53f96058a9640c6f7.zip
Qt-cc6406d4971c5656fc4b3eb53f96058a9640c6f7.tar.gz
Qt-cc6406d4971c5656fc4b3eb53f96058a9640c6f7.tar.bz2
Gstreamer: Do not assume that the list index is the same as the device id.
Integrated KDE change 1027568 by cguthrie. This commit fixes a bug that was highlighted when devices had been added/removed or the backend was reloaded. The AudioDevice used to use a static counter to allocate itself a device id that was propigated through the Phonon API. Code in the Backend invalidly assumed that the index in the list was the same as this id.
-rw-r--r--src/3rdparty/phonon/gstreamer/backend.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/3rdparty/phonon/gstreamer/backend.cpp b/src/3rdparty/phonon/gstreamer/backend.cpp
index 7a06378..dab6f35 100644
--- a/src/3rdparty/phonon/gstreamer/backend.cpp
+++ b/src/3rdparty/phonon/gstreamer/backend.cpp
@@ -294,10 +294,13 @@ QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescripti
switch (type) {
case Phonon::AudioOutputDeviceType: {
QList<AudioDevice> audioDevices = deviceManager()->audioOutputDevices();
- if (index >= 0 && index < audioDevices.size()) {
- ret.insert("name", audioDevices[index].gstId);
- ret.insert("description", audioDevices[index].description);
- ret.insert("icon", QLatin1String("audio-card"));
+ foreach(const AudioDevice &device, audioDevices) {
+ if (device.id == index) {
+ ret.insert("name", device.gstId);
+ ret.insert("description", device.description);
+ ret.insert("icon", QLatin1String("audio-card"));
+ break;
+ }
}
}
break;