Commit 5458eb86 authored by Andreas Traczyk's avatar Andreas Traczyk

videodevices: don't change preference order when changing settings

Change-Id: I743181cb854c5bdc961ade5dceb7f6ccc1b1ba13
parent ec67b99e
......@@ -80,7 +80,7 @@ VideoDeviceMonitor::getSettings(const string& name)
}
void
VideoDeviceMonitor::applySettings(const string& name, VideoSettings settings)
VideoDeviceMonitor::applySettings(const string& name, const VideoSettings& settings)
{
std::lock_guard<std::mutex> l(lock_);
const auto iter = findDeviceByName(name);
......@@ -89,7 +89,9 @@ VideoDeviceMonitor::applySettings(const string& name, VideoSettings settings)
return;
iter->applySettings(settings);
overwritePreferences(iter->getSettings());
auto it = findPreferencesByName(settings.name);
if (it != preferences_.end())
(*it) = settings;
}
string
......@@ -303,12 +305,12 @@ VideoDeviceMonitor::findPreferencesByName(const string& name)
}
void
VideoDeviceMonitor::overwritePreferences(VideoSettings settings)
VideoDeviceMonitor::overwritePreferences(const VideoSettings& settings)
{
auto it = findPreferencesByName(settings.name);
if (it != preferences_.end())
preferences_.erase(it);
preferences_.push_back(settings);
preferences_.emplace_back(settings);
}
void
......
......@@ -51,7 +51,7 @@ class VideoDeviceMonitor : public Serializable
DRing::VideoCapabilities getCapabilities(const std::string& name) const;
VideoSettings getSettings(const std::string& name);
void applySettings(const std::string& name, VideoSettings settings);
void applySettings(const std::string& name, const VideoSettings& settings);
std::string getDefaultDevice() const;
std::string getMRLForDefaultDevice() const;
......@@ -82,7 +82,7 @@ class VideoDeviceMonitor : public Serializable
*/
std::vector<VideoSettings> preferences_;
void overwritePreferences(VideoSettings settings);
void overwritePreferences(const VideoSettings& settings);
std::vector<VideoSettings>::iterator findPreferencesByName(const std::string& name);
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment