Commit db662d79 authored by Sébastien Le Stum's avatar Sébastien Le Stum Committed by Sébastien Blin

sip: avoid modifying video codec list collection while iterating

Replace that unsafe behavior by a better erase + remove_if logic.

Change-Id: I388357653449524b83c9776c169e1104160fec57
parent da09a686
......@@ -331,11 +331,8 @@ Sdp::setLocalMediaVideoCapabilities(
video_codec_list_ = selectedCodecs;
// Do not expose H265 if accel is disactivated
if (not jami::Manager::instance().videoPreferences.getEncodingAccelerated()) {
for (auto it = video_codec_list_.begin(); it != video_codec_list_.end(); ++it) {
if ((*it)->systemCodecInfo.name == "H265") {
video_codec_list_.erase(it);
}
}
video_codec_list_.erase(std::remove_if(video_codec_list_.begin(), video_codec_list_.end(),
[](const std::shared_ptr<AccountCodecInfo>& i){ return i->systemCodecInfo.name == "H265"; }), video_codec_list_.end());
}
#else
(void) selectedCodecs;
......
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