Allow a received audio codec's payload type to change.

This will create another decoder instance, which isn't ideal, but
that's better than the current behavior where things don't work at all.

We still need to fix the root cause of the linked bug, which is that we
don't remember previous payload type mappings when generating an offer.

This CL also adds a check for what is a real error: when a payload type
that was mapped to one codec is changed to map to a different codec.

And lastly, this CL removes a DCHECK for an assumption that was not
valid: that subsequently applied codec lists will always be supersets of
previous lists.

BUG=webrtc:5847

Review-Url: https://codereview.webrtc.org/2831333002
Cr-Commit-Position: refs/heads/master@{#17897}
This commit is contained in:
deadbeef
2017-04-26 16:28:42 -07:00
committed by Commit bot
parent 1517caaf7d
commit cb3836773c
4 changed files with 58 additions and 38 deletions

View File

@ -45,6 +45,11 @@ SdpAudioFormat::SdpAudioFormat(const std::string& name,
num_channels(num_channels),
parameters(param) {}
bool SdpAudioFormat::Matches(const SdpAudioFormat& o) const {
return STR_CASE_CMP(name.c_str(), o.name.c_str()) == 0 &&
clockrate_hz == o.clockrate_hz && num_channels == o.num_channels;
}
SdpAudioFormat::~SdpAudioFormat() = default;
SdpAudioFormat& SdpAudioFormat::operator=(const SdpAudioFormat&) = default;
SdpAudioFormat& SdpAudioFormat::operator=(SdpAudioFormat&&) = default;

View File

@ -41,6 +41,11 @@ struct SdpAudioFormat {
const Parameters& param);
~SdpAudioFormat();
// Returns true if this format is compatible with |o|. In SDP terminology:
// would it represent the same codec between an offer and an answer? As
// opposed to operator==, this method disregards codec parameters.
bool Matches(const SdpAudioFormat& o) const;
SdpAudioFormat& operator=(const SdpAudioFormat&);
SdpAudioFormat& operator=(SdpAudioFormat&&);