Prevent recv-stream reconfig on identical codecs.
Receive streams seem to be reconfigured with identical codecs when another stream is removed. Preventing this reconfiguration makes sure that existing streams don't report stats during teardown when the stream is still supposed to be running. BUG=1788 R=asapersson@webrtc.org Review URL: https://webrtc-codereview.appspot.com/44249004 Cr-Commit-Position: refs/heads/master@{#9059}
This commit is contained in:
@@ -718,6 +718,19 @@ bool WebRtcVideoChannel2::SetRecvCodecs(const std::vector<VideoCodec>& codecs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent reconfiguration when setting identical receive codecs.
|
||||
if (recv_codecs_.size() == supported_codecs.size()) {
|
||||
bool reconfigured = false;
|
||||
for (size_t i = 0; i < supported_codecs.size(); ++i) {
|
||||
if (recv_codecs_[i] != supported_codecs[i]) {
|
||||
reconfigured = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!reconfigured)
|
||||
return true;
|
||||
}
|
||||
|
||||
recv_codecs_ = supported_codecs;
|
||||
|
||||
rtc::CritScope stream_lock(&stream_crit_);
|
||||
@@ -2250,6 +2263,11 @@ bool WebRtcVideoChannel2::VideoCodecSettings::operator==(
|
||||
rtx_payload_type == other.rtx_payload_type;
|
||||
}
|
||||
|
||||
bool WebRtcVideoChannel2::VideoCodecSettings::operator!=(
|
||||
const WebRtcVideoChannel2::VideoCodecSettings& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
std::vector<WebRtcVideoChannel2::VideoCodecSettings>
|
||||
WebRtcVideoChannel2::MapCodecs(const std::vector<VideoCodec>& codecs) {
|
||||
assert(!codecs.empty());
|
||||
|
@@ -246,7 +246,9 @@ class WebRtcVideoChannel2 : public rtc::MessageHandler,
|
||||
|
||||
struct VideoCodecSettings {
|
||||
VideoCodecSettings();
|
||||
bool operator ==(const VideoCodecSettings& other) const;
|
||||
|
||||
bool operator==(const VideoCodecSettings& other) const;
|
||||
bool operator!=(const VideoCodecSettings& other) const;
|
||||
|
||||
VideoCodec codec;
|
||||
webrtc::FecConfig fec;
|
||||
|
Reference in New Issue
Block a user